On 12/07/2012 12:04 AM, Evan Pipho wrote: > I am looking for a way to set global flags for the librarian when creating > static libraries, similar to CMAKE_SHARED_LINKER_FLAGS or > CMAKE_EXE_LINKER_FLAGS. This would facilitate things like using 3rd party > libraries that already use cmake without having to modify their > CMakeLists.txt to set these > flags. > > > I found http://public.kitware.com/Bug/view.php?id=10094 which mentions > using CMAKE_STATIC_LINKER_FLAGS as well as this fairly old thread > http://www.cmake.org/pipermail/cmake/2009-October/032563.html also mentioning > this. > > Has there been any progress on this feature? > If not, does a feature that exposes a CMAKE_STATIC_LINKER_FLAGS (and > CMAKE_STATIC_LINKER_FLAGS_<TARGET>) which are then passed to the librarian > (ar, lib.exe etx) make sense? I think this would be quite useful, especially > for those of us that use cmake with visual studio. > > I would like to get the lists input, and if it is positive I would be > interested in creating a patch to add this functionality.
There is also this issue: http://www.cmake.org/Bug/view.php?id=10768 which was resolved here: http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fe971d97 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d3303dbc to add a STATIC_LIBRARY_FLAGS_<CONFIG> version of the property as requested in the mailing list thread you linked. What is still missing is the cache variables equivalent to CMAKE_EXE_LINKER_FLAGS CMAKE_EXE_LINKER_FLAGS_<CONFIG> CMAKE_SHARED_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS_<CONFIG> CMAKE_MODULE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS_<CONFIG> for static libraries. Following the above convention the names CMAKE_STATIC_LINKER_FLAGS CMAKE_STATIC_LINKER_FLAGS_<CONFIG> make sense even though no linking is actually performed. To add them, look for places already handling the above variables and find the equivalents for static libs. You will need to modify at least: cmLocalGenerator::GetTargetFlags cmGlobalXCodeGenerator::CreateBuildSettings cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules cmLocalVisualStudio7Generator::OutputBuildTool cmLocalVisualStudio6Generator::WriteDSPHeader You will also need to modify the module Modules/CMakeCommonLanguageInclude.cmake to add the empty default cache entries. Finally, look in the cmDocumentVariables.cxx source file to add documentation. BTW, what kind of flags do you want to add to the librarian? -Brad -- 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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
