From 5eae413e9ca1936dc94b643929a30d7660ab9593 Mon Sep 17 00:00:00 2001 From: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> Date: Fri, 6 Nov 2020 03:16:47 +0100 Subject: [PATCH] [vcpkg] copy tools pdb if they exist. (#14396) --- .../cmake/vcpkg_clean_executables_in_bin.cmake | 4 +++- scripts/cmake/vcpkg_copy_tools.cmake | 15 +++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/scripts/cmake/vcpkg_clean_executables_in_bin.cmake b/scripts/cmake/vcpkg_clean_executables_in_bin.cmake index da8594dafdd..b479bd3d0de 100644 --- a/scripts/cmake/vcpkg_clean_executables_in_bin.cmake +++ b/scripts/cmake/vcpkg_clean_executables_in_bin.cmake @@ -26,10 +26,12 @@ function(vcpkg_clean_executables_in_bin) message(FATAL_ERROR "FILE_NAMES must be specified.") endif() - foreach(file_name ${_vct_FILE_NAMES}) + foreach(file_name IN LISTS _vct_FILE_NAMES) file(REMOVE "${CURRENT_PACKAGES_DIR}/bin/${file_name}${VCPKG_TARGET_EXECUTABLE_SUFFIX}" "${CURRENT_PACKAGES_DIR}/debug/bin/${file_name}${VCPKG_TARGET_EXECUTABLE_SUFFIX}" + "${CURRENT_PACKAGES_DIR}/bin/${file_name}.pdb" + "${CURRENT_PACKAGES_DIR}/debug/bin/${file_name}.pdb" ) endforeach() diff --git a/scripts/cmake/vcpkg_copy_tools.cmake b/scripts/cmake/vcpkg_copy_tools.cmake index 147a426960b..37cfabd3bd7 100644 --- a/scripts/cmake/vcpkg_copy_tools.cmake +++ b/scripts/cmake/vcpkg_copy_tools.cmake @@ -34,24 +34,27 @@ function(vcpkg_copy_tools) endif() if(NOT DEFINED _vct_SEARCH_DIR) - set(_vct_SEARCH_DIR ${CURRENT_PACKAGES_DIR}/bin) + set(_vct_SEARCH_DIR "${CURRENT_PACKAGES_DIR}/bin") elseif(NOT IS_DIRECTORY ${_vct_SEARCH_DIR}) message(FATAL_ERROR "SEARCH_DIR ${_vct_SEARCH_DIR} is supposed to be a directory.") endif() - foreach(tool_name ${_vct_TOOL_NAMES}) + foreach(tool_name IN LISTS _vct_TOOL_NAMES) set(tool_path "${_vct_SEARCH_DIR}/${tool_name}${VCPKG_TARGET_EXECUTABLE_SUFFIX}") - - if(EXISTS ${tool_path}) - file(COPY ${tool_path} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT}) + set(tool_pdb "${_vct_SEARCH_DIR}/${tool_name}.pdb") + if(EXISTS "${tool_path}") + file(COPY "${tool_path}" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}") else() message(FATAL_ERROR "Couldn't find this tool: ${tool_path}.") endif() + if(EXISTS "${tool_pdb}") + file(COPY "${tool_pdb}" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}") + endif() endforeach() if(_vct_AUTO_CLEAN) vcpkg_clean_executables_in_bin(FILE_NAMES ${_vct_TOOL_NAMES}) endif() - vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT}) + vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}") endfunction()