Dear All,
I have a similar issue as Matt Keeler. In our project we have some global
linker flags that we set for all targets using the CMAKE_EXE_LINKER_FLAGS,
CMAKE_SHARED_LINKER_FLAGS and CMAKE_MODULE_LINKER_FLAGS cache variables.
Now it turns out that for some libraries in the project I need to modify these
flags. I can't modify the flags on the directory level, I need to modify them
at the target level.
I tried just setting extra flags in LINK_FLAGS for my specific targets. But the
problem is that the placement of the flags set in this target specific property
is not "well defined" wrt. the global properties.
In this particular case we use "-Wl,--as-needed" globally for all of our
targets. But for some particular libraries I'd like to turn this off. When I
add "-Wl,--no-as-needed" to the LINK_FLAGS property of this library, it is put
before the other flag in my final build configuration. And as such, it has no
effect.
I tried modifying CMAKE_SHARED_LINKER_FLAGS before the add_library call for
this library, and then restoring it to its original value afterwards. (Since as
I said, I can't modify the flag for the entire directory.) But this didn't work
as expected. Since by the generation stage CMake doesn't remember that the
variable was set differently in the different lines of the directory's
CMakeLists.txt file.
So, any ideas? I'd really hate to give up on using these global variables, and
starting to set the flags one by one for all of our targets. Since it's a lot
less work to just remove the flag for the targets that don't need it.
Cheers,
Attila
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake