MantisBT - CMake
View Issue Details
0015399CMakeCMakepublic2015-02-10 05:572015-07-08 08:57
Florent 
 
normalminoralways
closedno change required 
Windows7
CMake 3.1.1 
 
0015399: cmake xml-escapes ";" for visual studio generators resulting in malformed "ignore default libraries"
I have the following cmakelist :

set_property(TARGET MyLibraryUsingFortranRt APPEND PROPERTY LINK_FLAGS
            "/NODEFAULTLIB:svml_disp.lib"
            "libifcoremt.lib"
            "libcmt.lib"
            "libcmtd.lib"
            "libmmt.lib"
            "libifport.lib")

this generates the following xml fragment with 3.1 (Visual 2010 generator)
      <IgnoreSpecificDefaultLibraries>svml_disp.lib%3Blibifcoremt.lib%3Blibcmt.lib%3Blibcmtd.lib%3Blibmmt.lib%3Blibifport.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>


(notice how ";" got correctly escaped to %3B ! )

However for this specific filed VS expect to have ";" present in the xml as it is the case with 3.0 making it impossible to ignore several libraries.



from my end-less researches, this is linked to

http://www.cmake.org/Bug/view.php?id=15031 [^]

and most likely this commit :
http://www.cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8fa087ab [^]
No tags attached.
png VS_escaped_ignore_specific_libraries.PNG (6,749) 2015-02-10 05:57
https://public.kitware.com/Bug/file/5378/VS_escaped_ignore_specific_libraries.PNG
png
Issue History
2015-02-10 05:57FlorentNew Issue
2015-02-10 05:57FlorentFile Added: VS_escaped_ignore_specific_libraries.PNG
2015-02-10 08:59Brad KingNote Added: 0037948
2015-02-10 08:59Brad KingStatusnew => resolved
2015-02-10 08:59Brad KingResolutionopen => no change required
2015-02-11 03:48FlorentNote Added: 0037956
2015-02-11 03:49FlorentStatusresolved => closed
2015-02-11 08:37Brad KingNote Added: 0037957
2015-02-11 08:37Brad KingStatusclosed => resolved
2015-07-08 08:57Robert MaynardNote Added: 0039048
2015-07-08 08:57Robert MaynardStatusresolved => closed

Notes
(0037948)
Brad King   
2015-02-10 08:59   
The LINK_FLAGS property is one of the oldest properties and pre-dates the modern ;-list convention. It is supposed to be a command-line string, and so should be space-separated. Add each /NODEFAULTLIB:somelib.lib as its own flag, e.g.:

set_property(TARGET MyLibraryUsingFortranRt APPEND PROPERTY LINK_FLAGS "/NODEFAULTLIB:svml_disp.lib /NODEFAULTLIB:libifcoremt.lib ...")
(0037956)
Florent   
2015-02-11 03:48   
It works for me, thanks !

Why did the behavior changed ? just out of curiosity ...
(0037957)
Brad King   
2015-02-11 08:37   
Re-setting to 'resolved' because we leave issues open for comments until after 4 months of inactivity before marking as 'closed'.

> Why did the behavior changed

The old behavior of not encoding ";" in values was a bug. For any code using the official interfaces/approach within CMake to set things the only change in behavior was to make a case that previously didn't work (";" in actual flag values passed to the tools) now work. Your LINK_FLAGS case worked only by accident due to the bug. Using the command-line space-separated value will work in both old and new versions of CMake.

(0039048)
Robert Maynard   
2015-07-08 08:57   
Closing resolved issues that have not been updated in more than 4 months.