From b06bd501445b027ac498bcb46dea0aa0461adc8e Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Wed, 14 Dec 2016 14:49:19 +0300 Subject: [PATCH] cmake: update PDB support condition Unfortunately there is no stable support for installation of PDB files in CMake. This patch is just eliminate problems with modern versions. --- cmake/OpenCVUtils.cmake | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cmake/OpenCVUtils.cmake b/cmake/OpenCVUtils.cmake index b266a62372..55a7acdaaf 100644 --- a/cmake/OpenCVUtils.cmake +++ b/cmake/OpenCVUtils.cmake @@ -607,8 +607,11 @@ function(ocv_install_target) set(${__package}_TARGETS "${${__package}_TARGETS}" CACHE INTERNAL "List of ${__package} targets") endif() - if(INSTALL_CREATE_DISTRIB) - if(MSVC AND NOT BUILD_SHARED_LIBS) + if(MSVS) + if(NOT INSTALL_IGNORE_PDB AND + (INSTALL_PDB OR + (INSTALL_CREATE_DISTRIB AND NOT BUILD_SHARED_LIBS) + )) set(__target "${ARGV0}") set(isArchive 0) @@ -636,13 +639,13 @@ function(ocv_install_target) 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 OPTIONAL) 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 OPTIONAL) endif() else() # CMake 2.8.12 broke PDB support for STATIC libraries from MSVS, fix was introduced in CMake 3.1.0.