PDB_OUTPUT_DIRECTORY target property does not support generator expressions
The documentation for the RUNTIME_OUTPUT_DIRECTORY, LIBRARY_OUTPUT_DIRECTORY, ARCHIVE_OUTPUT_DIRECTORY and PDB_OUTPUT_DIRECTORY target properties all state that they support generator expressions. I'm using CMake 3.7.0-rc1 with the Visual Studio 2015 generator and it would seem the generator expressions are not being expanded or even detected. Typical linker errors look something like this:
2>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(1226,23): error MSB4198: The expression "DirectoryName" cannot be evaluated on item "E:/rls-vs2015/binaries/$<CONFIG>/lib/Debug/RlsLib_d.pdb". Illegal characters in path.
The documentation says that it will add a config-specific directory to the path if no generator expressions are used and the above example shows that it has indeed added such a directory (my CMakeLists.txt file stops at lib
, the final Debug
was appended by CMake).
Interestingly, one specific case does seem to work for me and that's a static library. Shared libraries, PDB files and I think executables exhibit the above problem.