View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0015865 | CMake | CMake | public | 2015-11-26 14:11 | 2016-06-10 14:31 | ||||
Reporter | temp4746 | ||||||||
Assigned To | Kitware Robot | ||||||||
Priority | normal | Severity | major | Reproducibility | always | ||||
Status | closed | Resolution | moved | ||||||
Platform | Windows | OS | Windows 7 | OS Version | 7 SP1 | ||||
Product Version | CMake 3.4 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0015865: Can't use /PDBALTPATH:%_PDB% in MSVC IDE generator due to CMake escaping percent signs | ||||||||
Description | When using the MSVC generator and using a linker flag that is added to the AdditionalOptions of the linker in the vcxproj, CMake will escape the linker flag. For example it will double up percent signs in a flag such as: /PDBALTPATH:%_PDB% Resuling in: /PDBALTPATH:%%_PDB%% Which is wrong in the MSVC IDE but might be correct for makefile generators. This prevents using this flag properly. Any fix for this need to be carefully thought out to prevent introducing an escaping bug in a different location in CMake. BTW if you try using percent signs in a compiler option it will escape it TWICE meaning you get FOUR percent signs for one percent sign. | ||||||||
Steps To Reproduce | Try the following: cmake_minimum_required(VERSION 3.4) project(Bug) add_executable(bug main.cpp) set_target_properties(bug PROPERTIES LINK_FLAGS "/PDBALTPATH:%_PDB%") And look in the IDE under linker->Command Line | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0039998) Davy Durham (reporter) 2015-12-18 15:10 edited on: 2015-12-18 15:15 |
+1 I am also running into this. I've tried 3.4.0 and 3.3.2. I've tried various ways of attempting to escape or give the percent signs in other ways. No success. |
(0039999) Brad King (manager) 2015-12-18 15:18 |
The problem here is that CMake knows how to ensure that a literal "%" in a command line option is properly escaped, and there is no way for it to know that in this case you don't want a literal "%". To what do you expect %PDB% to evaluate if it were written to the project file without escaping? |
(0040000) Davy Durham (reporter) 2015-12-18 15:21 |
Last paragraph: https://msdn.microsoft.com/en-us/library/dd998269.aspx [^] It can be used to have the linker supply the filename (without the path) of the pdb file it's writing for the final exe/dll. This is more convenient as a general linker flag rather than something to do per target. I my case, the general linker flags are set up front and dozens of targets are later defined. |
(0040010) Brad King (manager) 2015-12-21 08:56 |
Thanks for explaining. The LINK_FLAGS property is meant as a last resort to add flags not supported by other means, and so generically supports strings. In this case I think the best solution is to offer a first-class interface, such as a target property, to activate this behavior. That way it can be implemented properly by each generator as needed. If interested in this, please read CONTRIBUTING.rst and raise this for discussion on the developer mailing list. |
(0042893) Kitware Robot (administrator) 2016-06-10 14:29 |
Resolving issue as `moved`. This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2015-11-26 14:11 | temp4746 | New Issue | |
2015-12-18 15:10 | Davy Durham | Note Added: 0039998 | |
2015-12-18 15:15 | Davy Durham | Note Edited: 0039998 | |
2015-12-18 15:18 | Brad King | Note Added: 0039999 | |
2015-12-18 15:21 | Davy Durham | Note Added: 0040000 | |
2015-12-21 08:56 | Brad King | Note Added: 0040010 | |
2016-06-10 14:29 | Kitware Robot | Note Added: 0042893 | |
2016-06-10 14:29 | Kitware Robot | Status | new => resolved |
2016-06-10 14:29 | Kitware Robot | Resolution | open => moved |
2016-06-10 14:29 | Kitware Robot | Assigned To | => Kitware Robot |
2016-06-10 14:31 | Kitware Robot | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |