View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0010768CMakeCMakepublic2010-05-27 13:442012-12-07 10:44
ReporterFraser Hutchison 
Assigned ToBrad King 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake-2-8 
Target VersionFixed in Version 
Summary0010768: Request STATIC_LIBRARY_FLAGS_<build type> variable for use by MSVC
DescriptionI'd like to pass flags to build-specific static library targets (e.g. "/LTCG" to only Release build of my static lib). The only way to pass additional flags to the Librarian Command Line is by setting STATIC_LIBRARY_FLAGS, but this adds the flags to all build types.
TagsNo tags attached.
Attached Filespatch file icon static_lib_flags.patch [^] (4,539 bytes) 2010-05-28 00:04 [Show Content]

 Relationships
related to 0010094closedPatrick R. Gansterer Add support for CMAKE_STATIC_LINKER_FLAGS variable to set librarian flags 

  Notes
(0020850)
Fraser Hutchison (reporter)
2010-05-28 00:05

The uploaded patch works for me on Win 7 with MSVC 2008 Express. I don't have access to MSVC 6 or 10 so I haven't amended cmLocalVisualStudio6Generator.cxx or cmVisualStudio10TargetGenerator.cxx.

Please look at the 2nd and 3rd changes I made to cmLocalGenerator.cxx; these aren't related to this feature request, but looked like bugs me. If I'm wrong, then my 1st change in this file is probably wrong too :-)

Also in cmLocalGenerator.cxx at the same places, it looks like per-config LINK_FLAGS are only considered if LINK_FLAGS is not empty. I matched this behaviour in my patch, but I'm not sure this is desired behaviour - should per-config flags not be added regardless of defining universal flags?
(0020853)
Brad King (manager)
2010-05-28 08:27

The references to LINK_FLAGS and STATIC_LINK_FLAGS in cmLocalGenerator.cxx are not used in any real generators and need not be updated for this change. They are left from an experimental feature that was never finished AFAIK. If the code were actually used then the bugs you spotted would be real bugs. As a separate task I may look at removing this whole chunk of code for cleanup purposes.

I have changes almost ready for all generators. Unfortunately this is very hard to test because there is no link flag that will be accepted by all linkers. Therefore any test needs to be customized for each platform :(
(0020855)
Fraser Hutchison (reporter)
2010-05-28 08:40

The joys of cross-platform testing :-)

Lemme know if I can help - I've only got access to MSVC 2008 on Win 7 or Xp, and CodeBlocks on Win7, Xp, Ubuntu and Fedora.

My gmail address is fraser.hutchison
(0020858)
Brad King (manager)
2010-05-28 11:35

I decided to test this by adding bogus flags and regex-matching the errors in the output.

I've published a series of four commits to fix up LINK_FLAGS_<CONFIG>, test LINK_FLAGS and STATIC_LIBRARY_FLAGS, and add support for STATIC_LIBRARY_FLAGS_<CONFIG>. The topic has been merged into next:

http://cmake.org/gitweb?p=cmake.git;a=shortlog;h=be834bac [^]
(0020859)
Brad King (manager)
2010-05-28 13:33

I pushed support for STATIC_LIBRARY_FLAGS in Xcode, which was previously missing:

http://cmake.org/gitweb?p=cmake.git;a=shortlog;h=c81d128e [^]
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5c49aa0c [^]
(0020860)
Fraser Hutchison (reporter)
2010-05-28 14:30

Great!

Thanks for implementing this so quickly.
(0020936)
Brad King (manager)
2010-06-07 16:15

This topic has been merged to 'master' for inclusion in the next release.

 Issue History
Date Modified Username Field Change
2010-05-27 13:44 Fraser Hutchison New Issue
2010-05-27 14:56 Bill Hoffman Status new => assigned
2010-05-27 14:56 Bill Hoffman Assigned To => Brad King
2010-05-28 00:04 Fraser Hutchison File Added: static_lib_flags.patch
2010-05-28 00:05 Fraser Hutchison Note Added: 0020850
2010-05-28 08:27 Brad King Note Added: 0020853
2010-05-28 08:40 Fraser Hutchison Note Added: 0020855
2010-05-28 11:35 Brad King Note Added: 0020858
2010-05-28 13:33 Brad King Note Added: 0020859
2010-05-28 14:30 Fraser Hutchison Note Added: 0020860
2010-06-07 16:15 Brad King Note Added: 0020936
2010-06-07 16:15 Brad King Status assigned => closed
2010-06-07 16:15 Brad King Resolution open => fixed
2012-12-07 10:44 Brad King Relationship added related to 0010094


Copyright © 2000 - 2018 MantisBT Team