[cmake-developers] CMAKE_<lang>_LINK_EXECUTABLE and BG/Q
Todd Gamblin
tgamblin at llnl.gov
Sat Apr 12 18:49:32 EDT 2014
Hey all,
I'm working on putting together some platform files for CMake for Blue Gene/Q, and I'd really like to be able to make *one* platform file for both static and dynamic executables, so that I can install both from the same build.
BG/Q (like BG/P) requires that you add -dynamic (gcc) or -qnostaticlink (XL) when you link a dynamic executable. You don't add that flag when you link static executables. Unfortunately, there is only one variable that determines the link rule for an executable:
CMAKE_<lang>_LINK_EXECUTABLE
When I wrote the platform files for BG/P (see Modules/Platform/BlueGeneP-base.cmake), we decided that there really need to be two platform files for BG -- one for static and one for dynamic executables. That is why there is a profusion of BG/P platform files in the Modules/Platform directory, but I find this cumbersome -- it would be nice to have a build that can install both static and dynamic executables.
What would it take to give CMake some way to mark an executable as static or dynamic? How is this done on other platforms? Do people typically just set extra linker flags on an exe when they want it to be static? Or is there a target property that controls this?
-Todd
______________________________________________________________________
Todd Gamblin, tgamblin at llnl.gov, http://people.llnl.gov/gamblin2
CASC @ Lawrence Livermore National Laboratory, Livermore, CA, USA
More information about the cmake-developers
mailing list