MantisBT - CMake
View Issue Details
0014158CMakeCMakepublic2013-05-20 07:482013-10-07 10:09
Berkus 
 
normalminoralways
closedduplicate 
WindowsWindowsWin7, Win8
CMake 2.8.10.2 
 
0014158: CMake generated project doesn't create PDB files in the right place.
We have a somewhat non-standard configuration where to save build time we generate OBJECT library and then assemble a final library out of $<TARGET_OBJECTS> of that library.

The minimal reproducible example is posted on https://github.com/berkus/cmake-pdb [^]

During compile files of the OBJECT sub-library seem to receive invalid /Fd option which specifies PDB file location, which leads to the following during linking:
outerlib.lib(lib2.obj) : warning LNK4099: PDB 'vc110.pdb' was not found with 'outerlib.lib(lib2.obj)' or at 'C:\Users\***\Documents\cmake-pdb\_build_\_exe_\Debug\vc110.pdb'; linking object as if no debug info

I don't know if this is intended behavior or not, but all my attempts to fix this even manually were futile - cmake overrides /Fd setting.

Please advise how this can be fixed (either in cmake or in our code).
You can easily reproduce the case by checking out the repo and following the steps outlined in the README.txt file.

Tested in VS2010 and VS2012.
       ClCompile:
         C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\CL.exe /c /Zi /nologo /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D _DEBUG /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /GR /Fo"innerlib_internal.dir\Debug\\" /Fd"innerlib_internal.dir\Debug\vc110.pdb" /Gd /TP /analyze- /errorReport:prompt /Zm1000 "C:\Users\***\Documents\cmake-pdb\lib\lib2.cpp"
         lib2.cpp

while for outerlib.lib lib1.cpp PDB proper file name is specified:

       ClCompile:
         C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\CL.exe /c /Zi /nologo /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D _DEBUG /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /GR /Fo"outerlib.dir\Debug\\" /Fd"C:/Users/***/Documents/cmake-pdb/_build_/_lib_/Debug/outerlib.pdb" /Gd /TP /analyze- /errorReport:prompt /Zm1000 "C:\Users\***\Documents\cmake-pdb\lib\lib1.cpp"
         lib1.cpp
msvc
duplicate of 0014062closed Brad King Setting Compiler and Linker PDB to the same path in Visual Studio is unsupported. 
Issue History
2013-05-20 07:48BerkusNew Issue
2013-05-20 07:49BerkusTag Attached: msvc
2013-05-20 08:48Brad KingNote Added: 0033100
2013-05-23 07:26BerkusNote Added: 0033119
2013-05-23 08:33Brad KingRelationship addedduplicate of 0014062
2013-05-23 08:33Brad KingNote Added: 0033120
2013-05-23 08:33Brad KingStatusnew => resolved
2013-05-23 08:33Brad KingResolutionopen => duplicate
2013-10-07 10:09Robert MaynardNote Added: 0034058
2013-10-07 10:09Robert MaynardStatusresolved => closed

Notes
(0033100)
Brad King   
2013-05-20 08:48   
Please see issues 0011899, 0014062, and this recent fix:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=42ba1b08 [^]

Does that resolve this issue?
(0033119)
Berkus   
2013-05-23 07:26   
It seems to fix the issues we had.

To make it simpler in maintenance we have switched to using /Z7 and no PDB files though.

This report can be closed.
(0033120)
Brad King   
2013-05-23 08:33   
Great, thanks for reporting back.
(0034058)
Robert Maynard   
2013-10-07 10:09   
Closing resolved issues that have not been updated in more than 4 months.