MantisBT - CMake
View Issue Details
0012295CMakeCMakepublic2011-06-21 18:112014-05-23 16:49
Ben Medina 
Brad King 
normalminoralways
closedno change required 
Windows7
CMake 2.8.4 
 
0012295: LINK_FLAGS_RELEASE has no effect on static libraries for MSVC generators
Setting the LINK_FLAGS_RELEASE target property does not effect the output from the MSVC generators for static libraries.
1. Use CMake to generate project files for the attached project. I've tried the Visual Studio 2008 and 2010 generators.
2. Build the project in release mode. The following warning will be generated for the static library, but not the shared library:
   a.obj : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
The cmake code attempts to add /LTCG to the LINK_FLAGS_RELEASE for both libraries. It does get added to the shared library, but not the static library. You can verify this in the Visual Studio GUI by going to project properties for the static library, and checking Configuration Properties>Librarian>General. The last entry is Link Time Code Generation, which is expected to be set to "Yes (/LTCG)".
c++, msvc
zip link_test.zip (663) 2011-06-21 18:11
https://public.kitware.com/Bug/file/3956/*
Issue History
2011-06-21 18:11Ben MedinaNew Issue
2011-06-21 18:11Ben MedinaFile Added: link_test.zip
2011-06-21 18:16Brad KingNote Added: 0026944
2011-06-21 18:16Brad KingStatusnew => resolved
2011-06-21 18:16Brad KingResolutionopen => no change required
2011-06-21 18:16Brad KingAssigned To => Brad King
2011-11-11 10:45David ColeNote Added: 0027780
2011-11-11 10:45David ColeStatusresolved => closed
2014-05-23 16:48SaadTag Attached: c++
2014-05-23 16:49SaadTag Attached: msvc

Notes
(0026944)
Brad King   
2011-06-21 18:16   
Static libraries are not generated by a linker. Use STATIC_LIBRARY_FLAGS to pass flags to the librarian:

http://www.cmake.org/cmake/help/cmake-2-8-docs.html#prop_tgt:STATIC_LIBRARY_FLAGS [^]
(0027780)
David Cole   
2011-11-11 10:45   
Closing resolved issues that have not been updated in more than 4 months.