Can't use /PDBALTPATH:%_PDB% in MSVC IDE generator due to CMake escaping percent signs
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
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.
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