visual c++ - cmake - extracting pdb files from object libraries -


i building static library using object libraries shown using cmake 3.1.3.

i have

add_subdirectory(a) add_subdirectory(b) .... add_library(mylib static ${sources}                   $<target_objects:a>                    $<target_objects:b> ) set_target_properties(mylib properties compile_pdb_name mylib compile_pdb_output_dir ${cmake_binary_dir}) 

now, problem generates vc120.pdb in a's cmake subdirectory. b generates own vc120.pdb in b's cmake subdirectory. and, mylib generates mylib.pdb in main binary cmake folder.

i want 1 static library , 1 pdb file. want mylib , mylib.pdb.

how can merge vc120.pdbs mylib.pdb or ideally generate 1 pdb file?

this not direct answer question, alternate solution may want consider.

with static libraries, better off using /z7 generation of debugging information. when using /z7 compiler not produce .pdb file, embeds debugging info directly generated object files.

when these object files linked static library, lib.exe copy debugging info object files resulting .lib file. there not need distribute .pdb file .lib file.

unlike link.exe, used cmake produce dll or , exe, lib.exe not have option output .pdb file.

via cmake can set required options in following way. object library use:

add_library(a object lib2.cpp) set_target_properties(a properties compile_options "/z7") 

to produce final static library, use:

add_library(mylib static main.cpp $<target_objects:a> $<target_objects:b> ) set_target_properties(mylib properties compile_options "/z7") 

Popular posts from this blog