[CMake] get name of .lib file

Tim Gallagher tim.gallagher at gatech.edu
Mon Nov 7 08:27:08 EST 2011


I think the CMAKE_SHARED_LIBRARY_PREFIX/CMAKE_SHARED_LIBRARY_SUFFIX variables would tell you what you want. We use them to determine the output name as:

${CMAKE_SHARED_LIBRARY_PREFX}<library target name>${CMAKE_SHARED_LIBRARY_SUFFIX}

We also have an if statement in case STATIC libraries are built, in which case you just replace SHARED with STATIC in the variable names.

These came from:

http://cmake.org/Wiki/CMake_Useful_Variables

Tim

----- Original Message -----
From: "Tomasz Grobelny" <tomasz at grobelny.oswiecenia.net>
To: cmake at cmake.org
Sent: Monday, November 7, 2011 8:23:10 AM
Subject: [CMake] get name of .lib file

I have a library created like this:
  add_library(mylib SHARED ${SOURCES} ${PRIVATE_HEADERS}
${PUBLIC_HEADERS})
Now I want to get names of all output files for mylib target (on Unix this
would be .so file, but on Windows it would be .dll, .lib and possibly .pdb
files). Is there any better way to get those names without constructing
them manually eg. using get_filename_component from main file? I get the
main file as follows:
  get_property(location TARGET mylib PROPERTY LOCATION)
Are there any other properties that would give me the other names?
-- 
Regards,
Tomasz Grobelny
--

Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list