[Cmake] Adding linker flags in CMakeLists.txt
Bill Hoffman
bill . hoffman at kitware . com
Tue, 26 Aug 2003 08:51:50 -0400
There are two variables that can be set:
SET (CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS}
CACHE STRING "Flags used by the linker during the creation of dll's.")
# module linker flags
SET (CMAKE_MODULE_LINKER_FLAGS ${CMAKE_MODULE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}
CACHE STRING "Flags used by the linker during the creation of modules.")
For a single library, you can also do this:
SET_TARGET_PROPERTIES(foo PROPERTIES LINK_FLAGS -Wl,-specialFlag)
-Bill
At 05:29 PM 8/25/2003, Dean Browne wrote:
>I'm not sure if this is something I should be emailing to the whole group so sorry if this is spam to you.
>I've been trying to add a linker flag to a build on Solaris of a .so file. I don't see an option for adding linker flags in the documentation, just one for adding compiler flags. I searched around on the Web and found references to CMAKE_SHARED_LINKER_FLAGS and CMAKE_EXTRA_LINK_FLAGS but they were in reference to older versions of CMake. I'm running 1.6 patch 7.
>Is there a way to add linker options still?
>Thanks,
>-D
>
>_______________________________________________
>Cmake mailing list
>Cmake at www . cmake . org
>http://www . cmake . org/mailman/listinfo/cmake