mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-24 06:19:00 +08:00
7d2449c346
* [docs] Delete embedded documentation in favor of docs/ Drive-by for the helper ports: 1. "documentation": "https://vcpkg.io/en/docs/README.html" 2. "license": "MIT" 3. Use `include_guard(GLOBAL)` in all script files 4. Make sure any persistent variables are saved to the cache * [docs] Restore empty regenerate.ps1 to satisfy Azure Pipelines * [docs] PR comments
50 lines
1.6 KiB
CMake
50 lines
1.6 KiB
CMake
function(vcpkg_copy_pdbs)
|
|
cmake_parse_arguments(PARSE_ARGV 0 "arg" "" "" "BUILD_PATHS")
|
|
|
|
if(DEFINED arg_UNPARSED_ARGUMENTS)
|
|
message(WARNING "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
|
|
endif()
|
|
|
|
if(NOT DEFINED arg_BUILD_PATHS)
|
|
set(arg_BUILD_PATHS
|
|
"${CURRENT_PACKAGES_DIR}/bin/*.dll"
|
|
"${CURRENT_PACKAGES_DIR}/debug/bin/*.dll"
|
|
)
|
|
endif()
|
|
|
|
set(dlls_without_matching_pdbs "")
|
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic" AND VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
|
file(GLOB_RECURSE dlls ${arg_BUILD_PATHS})
|
|
|
|
set(vslang_backup "$ENV{VSLANG}")
|
|
set(ENV{VSLANG} 1033)
|
|
|
|
foreach(dll IN LISTS dlls)
|
|
execute_process(COMMAND dumpbin /PDBPATH "${dll}"
|
|
COMMAND findstr PDB
|
|
OUTPUT_VARIABLE pdb_line
|
|
ERROR_QUIET
|
|
RESULT_VARIABLE error_code
|
|
)
|
|
|
|
if(error_code EQUAL "0" AND pdb_line MATCHES "PDB file found at.*'(.*)'")
|
|
set(pdb_path "${CMAKE_MATCH_1}")
|
|
cmake_path(GET dll PARENT_PATH dll_dir)
|
|
file(COPY "${pdb_path}" DESTINATION "${dll_dir}")
|
|
else()
|
|
list(APPEND dlls_without_matching_pdbs "${dll}")
|
|
endif()
|
|
endforeach()
|
|
|
|
set(ENV{VSLANG} "${vslang_backup}")
|
|
|
|
if(NOT dlls_without_matching_pdbs STREQUAL "")
|
|
list(JOIN dlls_without_matching_pdbs "\n " message)
|
|
message(WARNING "Could not find a matching pdb file for:
|
|
${message}\n")
|
|
endif()
|
|
endif()
|
|
|
|
endfunction()
|