1251961eeSMark NunbergIF(POLICY CMP0026)
2251961eeSMark Nunberg    CMAKE_POLICY(SET CMP0026 OLD)
3251961eeSMark NunbergENDIF()
42d93db6eSMark NunbergMACRO(TRANSFORM_TARGET tname output_pdb output_exp)
52d93db6eSMark Nunberg    # Base extension name
62d93db6eSMark Nunberg    GET_FILENAME_COMPONENT(_base "${tname}" NAME_WE)
72d93db6eSMark Nunberg    GET_FILENAME_COMPONENT(_type "${tname}" EXT)
82d93db6eSMark Nunberg
92d93db6eSMark Nunberg    # Path, e.g. 'Debug'
102d93db6eSMark Nunberg    GET_FILENAME_COMPONENT(_bindir "${tname}" PATH)
112d93db6eSMark Nunberg    GET_FILENAME_COMPONENT(_config "${_bindir}" NAME)
122d93db6eSMark Nunberg
132d93db6eSMark Nunberg    # e.g. the build directory itself
142d93db6eSMark Nunberg    IF(CMAKE_BUILD_TYPE)
152d93db6eSMark Nunberg        GET_FILENAME_COMPONENT(_basedir "${_bindir}/../" ABSOLUTE)
162d93db6eSMark Nunberg        SET(_config "")
172d93db6eSMark Nunberg    ELSE()
182d93db6eSMark Nunberg        GET_FILENAME_COMPONENT(_basedir "${_bindir}/../../" ABSOLUTE)
192d93db6eSMark Nunberg    ENDIF()
202d93db6eSMark Nunberg
212d93db6eSMark Nunberg    SET(${output_pdb} "${_basedir}/bin/${_config}/${_base}.pdb")
222d93db6eSMark Nunberg    IF( ".dll" STREQUAL "${_type}")
232d93db6eSMark Nunberg        SET(${output_exp} "${_basedir}/lib/${_config}/${_base}.exp")
242d93db6eSMark Nunberg    ENDIF()
252d93db6eSMark NunbergENDMACRO()
262d93db6eSMark Nunberg
272d93db6eSMark NunbergMACRO(INSTALL_PDBS target)
28d727401cSMark Nunberg    IF(MSVC)
29d727401cSMark Nunberg        GET_TARGET_PROPERTY(_BIN_DEBUG ${target} LOCATION_DEBUG)
30d727401cSMark Nunberg        GET_TARGET_PROPERTY(_BIN_RDB ${target} LOCATION_RelWithDebInfo)
31d727401cSMark Nunberg        TRANSFORM_TARGET(${_BIN_DEBUG} _DEBUG_PDB _DEBUG_EXP)
32d727401cSMark Nunberg        TRANSFORM_TARGET(${_BIN_RDB} _RDB_PDB _RDB_EXP)
33e7b4c8a1SMark Nunberg        INSTALL(FILES ${_DEBUG_PDB} DESTINATION bin CONFIGURATIONS DEBUG)
34e7b4c8a1SMark Nunberg        INSTALL(FILES ${_RDB_PDB} DESTINATION bin CONFIGURATIONS RelWithDebInfo)
35e7b4c8a1SMark Nunberg        IF(_DEBUG_EXP)
36e7b4c8a1SMark Nunberg            INSTALL(FILES ${_DEBUG_EXP} DESTINATION lib CONFIGURATIONS DEBUG)
37e7b4c8a1SMark Nunberg        ENDIF()
38e7b4c8a1SMark Nunberg        IF(_RDB_EXP)
39e7b4c8a1SMark Nunberg            INSTALL(FILES ${_RDB_EXP} DESTINATION lib CONFIGURATIONS RelWithDebInfo)
40e7b4c8a1SMark Nunberg        ENDIF()
41d727401cSMark Nunberg    ENDIF(MSVC)
422d93db6eSMark NunbergENDMACRO()
43