[vcpkg-fixup-cmake-targets] Remove stray absolute references inside top-level cmake files.

This commit is contained in:
Robert Schumacher 2018-03-11 23:04:52 -07:00
parent 4338ae25a1
commit 6d74825741
1 changed files with 9 additions and 0 deletions

View File

@ -158,4 +158,13 @@ function(vcpkg_fixup_cmake_targets)
if(NOT REMAINING_FILES)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
endif()
# Patch out any remaining absolute references
file(TO_CMAKE_PATH "${CURRENT_PACKAGES_DIR}" CMAKE_CURRENT_PACKAGES_DIR)
file(GLOB CMAKE_FILES ${RELEASE_SHARE}/*.cmake)
foreach(CMAKE_FILE IN LISTS CMAKE_FILES)
file(READ ${CMAKE_FILE} _contents)
string(REPLACE "${CMAKE_CURRENT_PACKAGES_DIR}" "\${CMAKE_CURRENT_LIST_DIR}/../.." _contents "${_contents}")
file(WRITE ${CMAKE_FILE} "${_contents}")
endforeach()
endfunction()