On 11/03/2011 10:02 PM, Stephen Torri wrote:
> Searching the net for how to install PDB files with CMake comes up with no 
> real solution. I can see from the mailing list archives that this issue had 
> been brought up before. What is am acceptable way to install PDB files when 
> compiling on Windows?
> 
> Stephen

The problem is that PDB files are usually generated next to their binary
in a configuration-specific directory which can not be accessed smoothly
by INSTALL(FILES ...). However, you can use a POST_BUILD custom command
in conjunction with generator expressions to copy the PDB files to a
well-known location where INSTALL(FILES ...) will find them, e.g.:

ADD_EXECUTABLE(main ...)
ADD_CUSTOM_COMMAND(TARGET main POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy_if_different
        $<TARGET_FILE_DIR:main>/main.pdb
        ${CMAKE_BINARY_DIR}/main.pdb)
INSTALL(FILES ${CMAKE_BINARY_DIR}/main.pdb DESTINATION ...)

Possibly, you might need to use a convenient CMake script or the
like instead of copy_if_different to account for missing PDB
files in non-debug configurations.

While this should work quite well, it would be nice if INSTALL()
has an idea of generator expressions, too, so it can find non-
target files residing in configuration-specific locations.
Perhaps, that's worth a feature request?

Regards,

Michael
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to