MantisBT - CMake
View Issue Details
0010830CMakeCMakepublic2010-06-14 17:352013-04-05 07:58
Andreas Johansen 
Brad King 
normalfeaturealways
closedfixed 
CMake-2-8 
CMake 2.8.10CMake 2.8.10 
0010830: Add option to specify output of Visual Studio .pdb files (Debug symbols)
I need to be able to either a: specify the output name of the debug symbols file, or b: specify the output directory for the debug symbols file. Currently CMake just grabs the output name of the target, and changes the file ending to .pdb leaving the debug symbols to always end up with the binary file.

In most cases this if fine, but I'm currently working with a project where there's two targets with the same output name (one is .exe and the other is .dll). The current system in CMake makes those two projects write out the exact same .pdb file (one overwriting the other) when both binaries are set to output in the same directory (won't overwrite each other).
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. 
patch set_debug_symbols_name.patch (1,782) 2010-06-17 09:52
https://public.kitware.com/Bug/file/3198/set_debug_symbols_name.patch
patch 0001-Add-target-property-PDB_NAME-to-set-MS-.pdb-names.patch (1,971) 2010-12-15 10:19
https://public.kitware.com/Bug/file/3572/0001-Add-target-property-PDB_NAME-to-set-MS-.pdb-names.patch
patch 0001-PDB_NAME-target-property-to-set-full-PDB-file-path.patch (4,251) 2011-01-25 03:34
https://public.kitware.com/Bug/file/3653/0001-PDB_NAME-target-property-to-set-full-PDB-file-path.patch
patch 0001-Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch (19,343) 2011-01-28 08:43
https://public.kitware.com/Bug/file/3666/0001-Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch
patch Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch (19,057) 2012-09-22 04:48
https://public.kitware.com/Bug/file/4492/Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch
patch 2-Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch (19,686) 2012-09-22 08:30
https://public.kitware.com/Bug/file/4493/2-Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch
patch loaden-v3-Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch (21,091) 2012-09-22 10:24
https://public.kitware.com/Bug/file/4494/loaden-v3-Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch
patch loaden-V4-Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch (21,090) 2012-09-22 10:52
https://public.kitware.com/Bug/file/4495/loaden-V4-Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch
patch loaden-V5-Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch (21,180) 2012-09-22 21:15
https://public.kitware.com/Bug/file/4496/loaden-V5-Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch
patch loaden-V6-based-master-d550801a-Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch (21,331) 2012-09-24 21:32
https://public.kitware.com/Bug/file/4498/loaden-V6-based-master-d550801a-Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch
patch d550801a+0001-Add-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-target-propert.patch (21,380) 2012-09-25 15:26
https://public.kitware.com/Bug/file/4499/d550801a%2B0001-Add-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-target-propert.patch
patch d550801a+0002-Verify-that-PDB_-NAME-OUTPUT_DIRECTORY-are-honored-i.patch (3,550) 2012-09-25 15:26
https://public.kitware.com/Bug/file/4500/d550801a%2B0002-Verify-that-PDB_-NAME-OUTPUT_DIRECTORY-are-honored-i.patch
patch d550801a+0003-Document-that-PDB_-NAME-OUTPUT_DIRECTORY-are-ignored.patch (3,512) 2012-09-25 15:26
https://public.kitware.com/Bug/file/4501/d550801a%2B0003-Document-that-PDB_-NAME-OUTPUT_DIRECTORY-are-ignored.patch
Issue History
2010-06-14 17:35Andreas JohansenNew Issue
2010-06-17 09:52Andreas JohansenNote Added: 0021064
2010-06-17 09:52Andreas JohansenFile Added: set_debug_symbols_name.patch
2010-06-17 10:16Andreas JohansenNote Edited: 0021064
2010-06-17 10:17Andreas JohansenNote Edited: 0021064
2010-12-03 09:39NodrevNote Added: 0023693
2010-12-15 09:55David ColeAssigned To => Brad King
2010-12-15 09:55David ColeStatusnew => assigned
2010-12-15 10:19Brad KingFile Added: 0001-Add-target-property-PDB_NAME-to-set-MS-.pdb-names.patch
2010-12-15 10:21Brad KingNote Added: 0024153
2011-01-25 03:34Thomas BernardNote Added: 0025064
2011-01-25 03:34Thomas BernardFile Added: 0001-PDB_NAME-target-property-to-set-full-PDB-file-path.patch
2011-01-25 08:54Brad KingNote Added: 0025068
2011-01-28 08:42Thomas BernardNote Added: 0025120
2011-01-28 08:43Thomas BernardFile Added: 0001-Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch
2011-01-28 10:32Brad KingNote Added: 0025123
2011-02-28 09:02Brad KingRelationship addedhas duplicate 0011899
2011-02-28 09:02Brad KingRelationship deletedhas duplicate 0011899
2011-02-28 09:32Brad KingRelationship addedrelated to 0011899
2011-02-28 10:11Brad KingNote Added: 0025599
2012-08-13 10:36Brad KingStatusassigned => backlog
2012-08-13 10:36Brad KingNote Added: 0030479
2012-09-09 00:20Yuchen DengNote Added: 0030961
2012-09-22 04:48Yuchen DengFile Added: Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch
2012-09-22 04:54Yuchen DengNote Added: 0031084
2012-09-22 08:30Yuchen DengFile Added: 2-Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch
2012-09-22 08:31Yuchen DengNote Added: 0031085
2012-09-22 10:24Yuchen DengFile Added: loaden-v3-Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch
2012-09-22 10:26Yuchen DengNote Added: 0031086
2012-09-22 10:52Yuchen DengFile Added: loaden-V4-Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch
2012-09-22 10:53Yuchen DengNote Added: 0031087
2012-09-22 21:15Yuchen DengFile Added: loaden-V5-Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch
2012-09-22 21:16Yuchen DengNote Added: 0031088
2012-09-24 09:38Brad KingNote Added: 0031092
2012-09-24 21:26Yuchen DengNote Added: 0031098
2012-09-24 21:32Yuchen DengFile Added: loaden-V6-based-master-d550801a-Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch
2012-09-25 15:25Brad KingStatusbacklog => assigned
2012-09-25 15:26Brad KingFile Added: d550801a+0001-Add-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-target-propert.patch
2012-09-25 15:26Brad KingFile Added: d550801a+0002-Verify-that-PDB_-NAME-OUTPUT_DIRECTORY-are-honored-i.patch
2012-09-25 15:26Brad KingFile Added: d550801a+0003-Document-that-PDB_-NAME-OUTPUT_DIRECTORY-are-ignored.patch
2012-09-25 15:28Brad KingNote Added: 0031103
2012-09-27 02:47Yuchen DengNote Added: 0031108
2012-09-27 08:43Brad KingNote Added: 0031109
2012-09-27 08:43Brad KingStatusassigned => resolved
2012-09-27 08:43Brad KingResolutionopen => fixed
2012-10-01 14:05Brad KingFixed in Version => CMake 2.8.10
2012-10-01 14:05Brad KingTarget Version => CMake 2.8.10
2013-03-04 08:38Robert MaynardNote Added: 0032462
2013-03-04 08:38Robert MaynardStatusresolved => closed
2013-04-05 07:58Brad KingRelationship addedrelated to 0014062

Notes
(0021064)
Andreas Johansen   
2010-06-17 09:52   
(edited on: 2010-06-17 10:17)
Attached a patch that adds "DEBUG_SYMBOLS_NAME" property for a target. When set, the VS7 generator will use this for the name of the .pdb file. Tested with VS2008.

(0023693)
Nodrev   
2010-12-03 09:39   
Problem still exist, no options are provided
(0024153)
Brad King   
2010-12-15 10:21   
I propose patch

 0001-Add-target-property-PDB_NAME-to-set-MS-.pdb-names.patch

instead. I'd like to name the property "PDB_NAME" for now to reserve the name "SYMBOLS_NAME" until we have first-class support for debug symbol files on a cross-platform basis.

Meanwhile, please apply my version of the patch locally and amend it to add a test (possibly modifying one of the existing tests).
(0025064)
Thomas Bernard   
2011-01-25 03:34   
May I propose a small variation of your other patch in order to be able to set the whole PDB file path using the PDB_NAME target property.
(0025068)
Brad King   
2011-01-25 08:54   
0010830:0025064: That would not be consistent with all the other properties ending in "_NAME". To accomplish that we would need a new "SYMBOLS_OUTPUT_DIRECTORY" (matching "SYMBOLS_NAME") similar to the current RUNTIME_OUTPUT_DIRECTORY, LIBRARY_OUTPUT_DIRECTORY, and ARCHIVE_OUTPUT_DIRECTORY properties. The advantage of a separate property for the directory is that it can be set for all targets by setting CMAKE_SYMBOLS_OUTPUT_DIRECTORY as a variable before creating targets. That makes it easy to put all .pdb files together.

Again, however, until we have full cross-platform debug symbol file support the name "SYMBOLS_" should be reserved. Therefore the name should be PDB_OUTPUT_DIRECTORY for now.

Can anyone pick up the patch mentioned in 0010830:0024153 and add the requested test?
(0025120)
Thomas Bernard   
2011-01-28 08:42   
The patch 0001-Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch
is an improved version of the PDB_NAME patch which also implements the PDB_OUTPUT_DIRECTORY logic suggested by Brad.

I added a test for the properties but I don't know how the make the test fail if the pdb file names don't match what is expected. I've checked that manually for nmake, VS 2008 and 2010 targets.

The test at least makes sure the targets using the properties can be build.
(0025123)
Brad King   
2011-01-28 10:32   
0010830:0025120: Thanks, Thomas! I look forward to reviewing the patch as soon as I get a chance.
(0025599)
Brad King   
2011-02-28 10:11   
Issue 0011899 brings up a complicating factor. There is a distinction between the .pdb files generated by the compiler and those generated by the linker. The compiler-generated pdb is temporary for .dll and .exe targets so the output name/directory applies to that generated by the linker. However, for static libraries the compiler-generated pdb file *is* the .pdb file that goes with the static (.lib) library.
(0030479)
Brad King   
2012-08-13 10:36   
Sending issues I'm not actively working on to the backlog to await someone with time for them.

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it:

 http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer or contributor who has the bandwidth to take it on.
(0030961)
Yuchen Deng   
2012-09-09 00:20   
I need change the pdb filename to support share PCH file using MSVC.
For now I can't find any valid way.
Can this patch still has chance to applied?
(0031084)
Yuchen Deng   
2012-09-22 04:54   
Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch [^] (19,057 bytes) 2012-09-22 04:48

Rebase + cleanup + code_style_fix + test:STATIC->SHARED changed.
(0031085)
Yuchen Deng   
2012-09-22 08:31   
2-Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch
Test can passed for STATIC lib.
But still failed for SHARED library.
Because can't create the .lib files.
(0031086)
Yuchen Deng   
2012-09-22 10:26   
loaden-v3-Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch [^] (21,091 bytes) 2012-09-22 10:24 [Show Content]

Should works well now.
Fix all issue as I know.
Add Nanja Generator support.

Only tested on Command Line (Windows SDK 7.1).
(0031087)
Yuchen Deng   
2012-09-22 10:53   
loaden-V4-Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch [^] (21,090 bytes) 2012-09-22 10:52

Pdb -> PDB
(0031088)
Yuchen Deng   
2012-09-22 21:16   
loaden-V5-Added-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-as-target-pr.patch [^] (21,180 bytes) 2012-09-22 21:15
- typo fix
- little change
(0031092)
Brad King   
2012-09-24 09:38   
Re 0010830:0031088: Thanks for working on this! The patch looks pretty good at quick glance.

On what version of CMake was this based? The patch does not apply cleanly on top of a recent master (f31de15b).
(0031098)
Yuchen Deng   
2012-09-24 21:26   
It based the release branch. I will post a new patch for master soon.
(0031103)
Brad King   
2012-09-25 15:28   
Re 0010830:0031098: Thanks! I tweaked the patch for some style and documentation typos and extended the series with a test. Please try attached patches

 d550801a+0001-Add-PDB_OUTPUT_DIRECTORY-and-PDB_NAME-target-propert.patch
 d550801a+0002-Verify-that-PDB_-NAME-OUTPUT_DIRECTORY-are-honored-i.patch
 d550801a+0003-Document-that-PDB_-NAME-OUTPUT_DIRECTORY-are-ignored.patch

based on commit d550801a.
(0031108)
Yuchen Deng   
2012-09-27 02:47   
Start 128: PDBDirectoryAndName
128/229 Test 0000128: PDBDirectoryAndName ......................... Passed 3.99 sec

It seems works well.
(0031109)
Brad King   
2012-09-27 08:43   
Applied:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3f60dbf1 [^]
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b294457e [^]
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=efc83b36 [^]
(0032462)
Robert Maynard   
2013-03-04 08:38   
Closing resolved issues that have not been updated in more than 4 months.