Fix pdb file generation on Windows for CMake versions after 3.1.0.

Pdb file support was changed in CMake 2.8.12, support was added in CMake 3.1.0 to work around the problems created by the change introduced in CMake 2.8.12.
pull/5210/head
Ashley Stacey 10 years ago
parent 0e4bd80b80
commit d8d78b4a98
  1. 2
      3rdparty/libjasper/CMakeLists.txt
  2. 2
      3rdparty/libjpeg/CMakeLists.txt
  3. 2
      3rdparty/libpng/CMakeLists.txt
  4. 2
      3rdparty/libtiff/CMakeLists.txt
  5. 2
      3rdparty/libwebp/CMakeLists.txt
  6. 2
      3rdparty/openexr/CMakeLists.txt
  7. 2
      3rdparty/tbb/CMakeLists.txt
  8. 2
      3rdparty/zlib/CMakeLists.txt
  9. 3
      cmake/OpenCVModule.cmake
  10. 10
      cmake/OpenCVUtils.cmake

@ -39,6 +39,8 @@ set_target_properties(${JASPER_LIBRARY}
PROPERTIES
OUTPUT_NAME ${JASPER_LIBRARY}
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
COMPILE_PDB_NAME ${JASPER_LIBRARY}
COMPILE_PDB_NAME_DEBUG "${JASPER_LIBRARY}${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
)

@ -45,6 +45,8 @@ ocv_warnings_disable(CMAKE_C_FLAGS /wd4013 /wd4244 /wd4267) # vs2005
set_target_properties(${JPEG_LIBRARY}
PROPERTIES OUTPUT_NAME ${JPEG_LIBRARY}
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
COMPILE_PDB_NAME ${JPEG_LIBRARY}
COMPILE_PDB_NAME_DEBUG "${JPEG_LIBRARY}${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
)

@ -43,6 +43,8 @@ ocv_warnings_disable(CMAKE_C_FLAGS -Wcast-align)
set_target_properties(${PNG_LIBRARY}
PROPERTIES OUTPUT_NAME ${PNG_LIBRARY}
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
COMPILE_PDB_NAME ${PNG_LIBRARY}
COMPILE_PDB_NAME_DEBUG "${PNG_LIBRARY}${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
)

@ -107,6 +107,8 @@ set_target_properties(${TIFF_LIBRARY}
PROPERTIES
OUTPUT_NAME "${TIFF_LIBRARY}"
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
COMPILE_PDB_NAME ${TIFF_LIBRARY}
COMPILE_PDB_NAME_DEBUG "${TIFF_LIBRARY}${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
)

@ -46,6 +46,8 @@ ocv_warnings_disable(CMAKE_C_FLAGS /wd4244 /wd4267) # vs2005
set_target_properties(${WEBP_LIBRARY}
PROPERTIES OUTPUT_NAME ${WEBP_LIBRARY}
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
COMPILE_PDB_NAME ${WEBP_LIBRARY}
COMPILE_PDB_NAME_DEBUG "${WEBP_LIBRARY}${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
)

@ -56,6 +56,8 @@ set_target_properties(IlmImf
PROPERTIES
OUTPUT_NAME "IlmImf"
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
COMPILE_PDB_NAME "IlmImf"
COMPILE_PDB_NAME_DEBUG "IlmImf${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
)

@ -223,6 +223,8 @@ endif()
set_target_properties(tbb
PROPERTIES OUTPUT_NAME tbb
DEBUG_POSTFIX "${tbb_debug_postfix}"
COMPILE_PDB_NAME tbb
COMPILE_PDB_NAME_DEBUG "tbb${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
)

@ -87,6 +87,8 @@ ocv_warnings_disable(CMAKE_C_FLAGS -Wshorten-64-to-32 -Wattributes -Wstrict-prot
set_target_properties(${ZLIB_LIBRARY} PROPERTIES
OUTPUT_NAME ${ZLIB_LIBRARY}
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
COMPILE_PDB_NAME ${ZLIB_LIBRARY}
COMPILE_PDB_NAME_DEBUG "${ZLIB_LIBRARY}${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
)

@ -769,7 +769,10 @@ macro(_ocv_create_module)
set_target_properties(${the_module} PROPERTIES
OUTPUT_NAME "${the_module}${OPENCV_DLLVERSION}"
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
COMPILE_PDB_NAME "${the_module}${OPENCV_DLLVERSION}"
COMPILE_PDB_NAME_DEBUG "${the_module}${OPENCV_DLLVERSION}${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
COMPILE_PDB_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
INSTALL_NAME_DIR lib

@ -565,20 +565,22 @@ function(ocv_install_target)
# message(STATUS "Process ${__target} dst=${__dst}...")
if(DEFINED __dst)
if(CMAKE_VERSION VERSION_LESS 2.8.12)
# If CMake version is >=3.1.0 or <2.8.12.
if(NOT CMAKE_VERSION VERSION_LESS 3.1.0 OR CMAKE_VERSION VERSION_LESS 2.8.12)
get_target_property(fname ${__target} LOCATION_DEBUG)
if(fname MATCHES "\\.lib$")
string(REGEX REPLACE "\\.lib$" ".pdb" fname "${fname}")
install(FILES ${fname} DESTINATION ${__dst} CONFIGURATIONS Debug)
install(FILES "${fname}" DESTINATION "${__dst}" CONFIGURATIONS Debug)
endif()
get_target_property(fname ${__target} LOCATION_RELEASE)
if(fname MATCHES "\\.lib$")
string(REGEX REPLACE "\\.lib$" ".pdb" fname "${fname}")
install(FILES ${fname} DESTINATION ${__dst} CONFIGURATIONS Release)
install(FILES "${fname}" DESTINATION "${__dst}" CONFIGURATIONS Release)
endif()
else()
# CMake 2.8.12 brokes PDB support in STATIC libraries for MSVS
# CMake 2.8.12 broke PDB support for STATIC libraries from MSVS, fix was introduced in CMake 3.1.0.
message(WARNING "PDB's are not supported from this version of CMake, use CMake version later then 3.1.0 or before 2.8.12.")
endif()
endif()
endif()

Loading…
Cancel
Save