[CMake] How to change PDB filename?

Loaden loaden at gmail.com
Sat Sep 22 00:42:25 EDT 2012


I find a dirty way, but it does not work with Ninja generator.

> function(fix_msvc_pch_shared_problem targetSelf targetBinary)
>     if ("${targetSelf}" STREQUAL "${targetBinary}")
>         return()
>     endif()
>     # NOTE: Dirty hack! until to find other way
>     get_filename_component(pdbpath ${${targetBinary}_PCH_BINARY_FILE} PATH)
>     get_target_property(targetCompileFlags ${targetSelf} COMPILE_FLAGS)
>     if (targetCompileFlags)
>         set(origCompileFlags ${targetCompileFlags})
>     endif()
>     set_target_properties(${targetSelf} PROPERTIES
>         COMPILE_FLAGS "${origCompileFlags}
> /Fd\"${pdbpath}/${targetBinary}.pdb\""
>     )
>     string(REGEX REPLACE " /Fd<TARGET_PDB>" "" temp
> "${CMAKE_${${targetBinary}_PCH_LANGUAGE}_COMPILE_OBJECT}")
>     set(CMAKE_${${targetBinary}_PCH_LANGUAGE}_COMPILE_OBJECT ${temp}
> PARENT_SCOPE)
> endfunction()
>

2012/9/9 Loaden <loaden at gmail.com>

> Hi, all!
> I was googled about how to change the PDB file name. it seems the PDB name
> still hardcode in cmTarget.cxx?
> There exist any way to change the PDB filename for now?
> I don't want to adding /Fd"XXX.pdb" for compile, and /PDB:"XXX.pdb" for
> link.
> It's will given overwriting warning because in cl.cmake
>
> SET(CMAKE_CXX_COMPILE_OBJECT
>>     "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}
>> <FLAGS> <DEFINES> /TP /Fo<OBJECT> /Fd<TARGET_PDB> -c
>> <SOURCE>${CMAKE_END_TEMP_FILE}")
>>
> What should I do?
> Any comments?
> Thanks!
>
> --
> Best Regards
> Yuchen
>
>


-- 
Best Regards
Yuchen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120922/f36e52d5/attachment-0001.htm>


More information about the CMake mailing list