View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014932CMakeCMakepublic2014-05-23 16:552014-11-03 08:38
ReporterSaad 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionno change required 
PlatformPCOSWindowsOS Version7
Product VersionCMake 2.8.12.2 
Target VersionFixed in Version 
Summary0014932: Cannot set library linker flags for each configuration individually
DescriptionIssue is related to: 0012295(http://www.cmake.org/Bug/view.php?id=12295 [^])

We already have CMAKE_EXE_LINKER_FLAGS_RELEASE for specifying executable linker flags (as well as MODULE and SHARED) but no variable for STATIC libraries. STATIC_LIBRARY_FLAGS does not work because it sets the flag(s) for all configurations. A variable such as CMAKE_STATIC_LINKER_FLAGS_RELEASE (and CMAKE_STATIC_LINKER_FLAGS_DEBUG etc.) that sets the flags for the VC++ librarian would be ideal.
Tagsc++, msvc
Attached Files7z file icon StaticLibLTCG.7z [^] (317 bytes) 2014-05-27 16:04

 Relationships

  Notes
(0035940)
Brad King (manager)
2014-05-27 08:48

We already have the requested variables:

http://www.cmake.org/cmake/help/v3.0/variable/CMAKE_STATIC_LINKER_FLAGS.html [^]
http://www.cmake.org/cmake/help/v3.0/variable/CMAKE_STATIC_LINKER_FLAGS_CONFIG.html [^]

One can see the implementation here:

http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmLocalGenerator.cxx;hb=v2.8.12.2#l1530 [^]
(0035945)
Saad (reporter)
2014-05-27 16:04

It does not seem to be working (see StaticLibLTCG.7z) - tested with VC++ 2010 and 2013.

Perhaps I am not using it properly?
(0035946)
Brad King (manager)
2014-05-27 16:18

You can't set the CMAKE_STATIC_LINKER_FLAGS_RELEASE variable before the project() command. The toolchain initialization done by that command creates the cache entry of the same name, and that unsets the local variable. The cache entry is supposed to be something that the local user can modify. If you want to add something beyond the user-specified value you can do

 set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} -my-flag")

after the project() command.
(0035947)
Saad (reporter)
2014-05-27 16:23

Thanks Brad, that worked.
(0035948)
Brad King (manager)
2014-05-27 16:24

Great, thanks for reporting back.
(0037143)
Robert Maynard (manager)
2014-11-03 08:38

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2014-05-23 16:55 Saad New Issue
2014-05-23 16:56 Saad Tag Attached: c++
2014-05-23 16:56 Saad Tag Attached: msvc
2014-05-27 08:48 Brad King Note Added: 0035940
2014-05-27 16:04 Saad Note Added: 0035945
2014-05-27 16:04 Saad File Added: StaticLibLTCG.7z
2014-05-27 16:18 Brad King Note Added: 0035946
2014-05-27 16:23 Saad Note Added: 0035947
2014-05-27 16:24 Brad King Note Added: 0035948
2014-05-27 16:24 Brad King Status new => resolved
2014-05-27 16:24 Brad King Resolution open => no change required
2014-11-03 08:38 Robert Maynard Note Added: 0037143
2014-11-03 08:38 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team