MantisBT - CMake
View Issue Details
0014600CMakeCMakepublic2013-11-26 20:222014-10-06 10:32
Charles Karney 
Brad King 
normalmajoralways
closedfixed 
CMake 2.8.12 
CMake 3.0CMake 3.0 
0014600: Document PDB behavior w.r.t. static libraries
I'm building using cmake 2.8.11 with the Visual Studio 10 Generator and
src/CMakeLists.txt contains

  set_target_properties (${PROJECT_STATIC_LIBRARIES} PROPERTIES
      VERSION "${LIBVERSIONFULL}" OUTPUT_NAME GeographicLib
      PDB_NAME GeographicLib_STATIC)

After building I have

  <build-dir>/src/DEBUG/GeographicLib_STATIC.pdb

alongside my .lib file as expected. (Actually it's
geographiclib_static.pdb, but never mind about that.)

A colleague is using cmake 2.8.12 with my project and for him the pdb
file is buried as

  <build-dir>/src/GeographicLib_STATIC.dir/Dedug/vc100.pdb

I.e., the directory and the name are wrong. This bug was introduced
between 2.8.11 and 2.8.12. The following deletion seems to be
responsible.

--- cmake-2.8.11/Source/cmVisualStudio10TargetGenerator.cxx 2013-05-15 13:38:13.000000000 -0400
+++ cmake-2.8.12/Source/cmVisualStudio10TargetGenerator.cxx 2013-10-07 11:31:00.000000000 -0400
@@ -1260,18 +1409,7 @@
 
   clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
                                           "\n", "CXX");
- this->WriteString("<AssemblerListingLocation>", 3);
- *this->BuildFileStream << configName
- << "</AssemblerListingLocation>\n";
   this->WriteString("<ObjectFileName>$(IntDir)</ObjectFileName>\n", 3);
- if(this->Target->GetType() != cmTarget::OBJECT_LIBRARY)
- {
- this->WriteString("<ProgramDataBaseFileName>", 3);
- *this->BuildFileStream << this->Target->GetPDBDirectory(configName.c_str())
- << "/"
- << this->Target->GetPDBName(configName.c_str())
- << "</ProgramDataBaseFileName>\n";
- }
   this->WriteString("</ClCompile>\n", 2);
 }
 
Set the PDB_NAME property on a library, build the Debug config. PDB file is
in the right location with 2.8.11 and in the wrong location with 2.8.12.
No tags attached.
related to 0011899closed Brad King Put compiler's program database files into intermediate directory rather than output one for VS 2005 
related to 0014062closed Brad King Setting Compiler and Linker PDB to the same path in Visual Studio is unsupported. 
related to 0014577closed Brad King Need to map /Fd to ProgramDataBaseFileName in VS 7,8,9 
related to 0014763closed Brad King Add target properties to specify MS compiler PDB files 
Issue History
2013-11-26 20:22Charles KarneyNew Issue
2013-11-26 20:56Charles KarneyNote Added: 0034576
2013-11-27 10:29Brad KingRelationship addedrelated to 0011899
2013-11-27 10:29Brad KingRelationship addedrelated to 0014062
2013-11-27 10:31Brad KingNote Added: 0034587
2013-11-27 10:31Brad KingRelationship addedrelated to 0014577
2013-11-27 10:32Brad KingNote Added: 0034588
2013-12-02 07:48Charles KarneyNote Added: 0034623
2013-12-02 12:08Brad KingNote Added: 0034679
2013-12-02 12:10Brad KingAssigned To => Brad King
2013-12-02 12:10Brad KingStatusnew => resolved
2013-12-02 12:10Brad KingResolutionopen => fixed
2013-12-02 12:10Brad KingFixed in Version => CMake 3.0
2013-12-02 12:10Brad KingTarget Version => CMake 3.0
2013-12-02 12:10Brad KingSummaryPDB_NAME target property ignored => Document PDB behavior w.r.t. static libraries
2014-02-18 09:59Brad KingRelationship addedrelated to 0014763
2014-10-06 10:32Robert MaynardNote Added: 0036909
2014-10-06 10:32Robert MaynardStatusresolved => closed

Notes
(0034576)
Charles Karney   
2013-11-26 20:56   
To reproduce:

git clone git://git.code.sf.net/p/geographiclib/code [^] geographiclib
cd geographiclib
git checkout d3deb4d003ed87878f649e9f2f18e8af73edaa86
mkdir BUILD
cd BUILD
cmake -G 'Visual Studio 10' -D CMAKE_INSTALL_PREFIX=wherever ..
cmake --build . --config Debug
cmake --build . --config Debug --target INSTALL

PDB files are correctly installed with cmake 2.8.11. The install gives
an error with 2.8.12:

CMake Error at src/cmake_install.cmake:44 (FILE):
  file INSTALL cannot find
  "C:/jenkins/workspace/geographiclib-win7-agc/geographiclib-build/win7/geographiclib/src/DEBUG/GeographicLib_STATIC.pdb".
Call Stack (most recent call first):
  cmake_install.cmake:41 (INCLUDE)
(0034587)
Brad King   
2013-11-27 10:31   
See this commit:

 VS: Separate compiler and linker PDB files
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=42ba1b08 [^]

addressing issue 0014062.
(0034588)
Brad King   
2013-11-27 10:32   
See also discussion in 0014577.
(0034623)
Charles Karney   
2013-12-02 07:48   
So bottom line is that this isn't a bug because PDB files for static libraries are not supported (and maybe even meaningless)? I'm fine with this outcome and only suggest that the documentation make this restriction more explicit.
(0034679)
Brad King   
2013-12-02 12:08   
Re 0014600:0034623: The commit linked in 0014600:0034587 updated the PDB_NAME and PDB_OUTPUT_DIRECTORY documentation to say that they are only for linker-generated .pdb files for executables and shared libraries. However, I agree the new wording does not stand out much when not looking at that diff.

I've made some documentation updates:

Help: Document CMAKE_PDB_OUTPUT_DIRECTORY_<CONFIG> variable
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cb7b9072 [^]

Help: Format PDB_NAME and PDB_OUTPUT_DIRECTORY documentation
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=09c05f37 [^]

Help: Document PDB behavior w.r.t. static libraries explicitly
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c0897cfa [^]
(0036909)
Robert Maynard   
2014-10-06 10:32   
Closing resolved issues that have not been updated in more than 4 months.