diff options
| author | Victor Romero <romerosanchezv@gmail.com> | 2019-02-28 23:53:42 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-28 23:53:42 -0800 |
| commit | 8641dfd9dd6d3bf190515822060872a56ee37906 (patch) | |
| tree | 1334dd5e7c0b2b5eb89452010b730cfbcf25ff85 /scripts/cmake/vcpkg_fixup_cmake_targets.cmake | |
| parent | 1afa2b0f7ba4079ff1bb1dd7724733b0cfc583d2 (diff) | |
| download | vcpkg-8641dfd9dd6d3bf190515822060872a56ee37906.tar.gz vcpkg-8641dfd9dd6d3bf190515822060872a56ee37906.zip | |
Modify `vcpkg_fixup_cmake_targets()` (#5459)
* some libraries export <PackageName>LibraryDepends.cmake
instead of <PackageName>Targets.cmake.
Those file also need the fix of #1044
should close #4753
* prefered the general solution #4622.
hopefully solved the issue within #4150
replaced the regex with something more readable
(also ident is lost)
should close:
#4753
#4633
#4150
and maybe more
* Hash vcpkg_fixup_cmake_targets.cmake
* [boost] Fix use of find_package(Boost) with cache variables
[socket-io-client] Fix install
* reversed change back to use regex replace
* [glbinding] Fix _IMPORT_PREFIX depth in *-export.cmake files
* [tinyspline] Ignore warnings treated as errors
* [libevent, liblemon, libpng, smpeg2, zlib] Fix apply patches
* [libsodium] Fix apply patches
* [folly] Link correct libraries in debug and release
* [vtk] Remove unset of _IMPORT_PREFIX
* [tinyspline] Do not treat warnings as errors
* [smpeg2] Fix double* to int comparison
* [nvtt] Define value for HAVE_UNISTD_H in MacOS
* [libui] Fix MacOS X build
* [zlib] Fix download URL
* [qhull] Update to v7.2.1
* [podofo] Set value for HAVE_UNISTD_H in MacOS
* [mongo-cxx-driver,ogre,podofo,qhull] Bump CONTROL version
* [mongo-c-driver] Set _IMPORT_PREFIX
* [tmxparser] Bump CONTROL version
* [qhull,vxl] Bump CONTROL version
Diffstat (limited to 'scripts/cmake/vcpkg_fixup_cmake_targets.cmake')
| -rw-r--r-- | scripts/cmake/vcpkg_fixup_cmake_targets.cmake | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake index ea9923df3..982f414b6 100644 --- a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake +++ b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake @@ -6,6 +6,9 @@ # # Transform all references matching /bin/*.exe to /tools/<port>/*.exe # +# Fix ${_IMPORT_PREFIX} in auto generated targets to be one folder deeper. +# Replace ${CURRENT_INSTALLED_DIR} with ${_IMPORT_PREFIX} in configs/targets. +# # :: # vcpkg_fixup_cmake_targets([CONFIG_PATH <config_path>]) # @@ -126,32 +129,22 @@ function(vcpkg_fixup_cmake_targets) endforeach() endif() - file(GLOB_RECURSE MAIN_TARGETS "${RELEASE_SHARE}/*[Tt]argets.cmake") - foreach(MAIN_TARGET IN LISTS MAIN_TARGETS) - file(READ ${MAIN_TARGET} _contents) + #Fix ${_IMPORT_PREFIX} in cmake generated targets and configs; + #Since those can be renamed we have to check in every *.cmake + file(GLOB_RECURSE MAIN_CMAKES "${RELEASE_SHARE}/*.cmake") + foreach(MAIN_CMAKE IN LISTS MAIN_CMAKES) + file(READ ${MAIN_CMAKE} _contents) string(REGEX REPLACE "get_filename_component\\(_IMPORT_PREFIX \"\\\${CMAKE_CURRENT_LIST_FILE}\" PATH\\)(\nget_filename_component\\(_IMPORT_PREFIX \"\\\${_IMPORT_PREFIX}\" PATH\\))*" "get_filename_component(_IMPORT_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)\nget_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)\nget_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)" - _contents "${_contents}") - string(REPLACE "${CURRENT_INSTALLED_DIR}" "_INVALID_ROOT_" _contents "${_contents}") - string(REGEX REPLACE "_INVALID_ROOT_/[^\";>]*" "" _contents "${_contents}") - string(REGEX REPLACE ";;+" ";" _contents "${_contents}") - string(REGEX REPLACE "\";\"" "\"\"" _contents "${_contents}") - file(WRITE ${MAIN_TARGET} "${_contents}") - endforeach() - - file(GLOB_RECURSE MAIN_CONFIGS "${RELEASE_SHARE}/*[Cc]onfig.cmake") - foreach(MAIN_CONFIG IN LISTS MAIN_CONFIGS) - file(READ ${MAIN_CONFIG} _contents) - string(REGEX REPLACE - "get_filename_component\\(_IMPORT_PREFIX \"\\\${CMAKE_CURRENT_LIST_FILE}\" PATH\\)(\nget_filename_component\\(_IMPORT_PREFIX \"\\\${_IMPORT_PREFIX}\" PATH\\))*" - "get_filename_component(_IMPORT_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)\nget_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)\nget_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)" - _contents "${_contents}") - string(REGEX REPLACE + _contents "${_contents}") # see #1044 for details why this replacement is necessary. See #4782 why it must be a regex. + string(REGEX REPLACE "get_filename_component\\(PACKAGE_PREFIX_DIR \"\\\${CMAKE_CURRENT_LIST_DIR}/\\.\\./(\\.\\./)*\" ABSOLUTE\\)" "get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/../../\" ABSOLUTE)" _contents "${_contents}") - file(WRITE ${MAIN_CONFIG} "${_contents}") + #Fix wrongly absolute paths to install dir with the correct dir using ${_IMPORT_PREFIX} + string(REPLACE "${CURRENT_INSTALLED_DIR}" [[${_IMPORT_PREFIX}]] _contents "${_contents}") + file(WRITE ${MAIN_CMAKE} "${_contents}") endforeach() # Remove /debug/<target_path>/ if it's empty. |
