[CMake] get name of .lib file

Tomasz Grobelny tomasz at grobelny.oswiecenia.net
Mon Nov 7 11:55:38 EST 2011


Thanks. But it still means that I have to construct the .lib file name
sort of manually. And possibly put some IF(WIN32)'s in my CMakeLists.txt. I
would much prefer to have a list of all files that were produced by given
target.
-- 
Regards,
Tomasz Grobelny

On Mon, 07 Nov 2011 08:27:08 -0500 (EST), Tim Gallagher
<tim.gallagher at gatech.edu> wrote:
> 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?


More information about the CMake mailing list