[cmake-developers] [CMake 0012348]: Setting CMAKE_CXX_CREATE_STATIC_LIBRARY has no effect in VS2008

Mantis Bug Tracker mantis at public.kitware.com
Mon Jul 18 09:48:11 EDT 2011


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=12348 
====================================================================== 
Reported By:                Dan Thill
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   12348
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2011-07-18 09:48 EDT
Last Modified:              2011-07-18 09:48 EDT
====================================================================== 
Summary:                    Setting CMAKE_CXX_CREATE_STATIC_LIBRARY has no
effect in VS2008
Description: 
Overriding the CMAKE_CXX_CREATE_STATIC_LIBRARY rule doesn't seem to have any
effect when generating a 64-bit VS2008 project. I am attempting to add the /LTCG
(link time code generation) on a global basis.  I've trolled the lists and bug
tracker quite a bit and I'm not the only one who has had problems with this.


Steps to Reproduce: 
1) Create a simple static library using ADD_LIBRARY( libname STATIC [files])

2) Modify CMAKE_CXX_CREATE_STATIC_LIBRARY, e.g., add link time code generation:

STRING( REPLACE "/nologo" "/nologo /LTCG" CMAKE_CXX_CREATE_STATIC_LIBRARY
${CMAKE_CXX_CREATE_STATIC_LIBRARY})

3) Inspect the generated project properties ( Configuration Properties ->
Librarian -> Command Line )and see that the command line is still "/OUT:"[xxxx]"
/NOLOGO".



Additional Information: 
As a test, I manually added "/LTCG" to to the original
CMAKE_CXX_CREATE_STATIC_LIBRARY value in Platform/cl.cmake.  During
configuration, printing the value of CMAKE_CXX_CREATE_STATIC_LIBRARY shows the
expected value.  But the flag does not appear in the generated .vcproj file. 
It's as if the project file generator is using a hardcoded value.

I am aware of the STATIC_LIBRARY_FLAGS and STATIC_LIBRARY_FLAGS_* target
properties and they work correctly, but I'd prefer to not have to add (what
should be) a global compiler setting explicitly on every static library in my
project (of which there are dozens), or override/create my own ADD_LIBRARY
macro.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-07-18 09:48 Dan Thill      New Issue                                    
======================================================================




More information about the cmake-developers mailing list