aboutsummaryrefslogtreecommitdiff
path: root/scripts/cmake/vcpkg_fixup_pkgconfig.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/cmake/vcpkg_fixup_pkgconfig.cmake')
-rw-r--r--scripts/cmake/vcpkg_fixup_pkgconfig.cmake16
1 files changed, 10 insertions, 6 deletions
diff --git a/scripts/cmake/vcpkg_fixup_pkgconfig.cmake b/scripts/cmake/vcpkg_fixup_pkgconfig.cmake
index 3e44ec172..2cc2dd04a 100644
--- a/scripts/cmake/vcpkg_fixup_pkgconfig.cmake
+++ b/scripts/cmake/vcpkg_fixup_pkgconfig.cmake
@@ -37,6 +37,8 @@
##
## ## Examples
## Just call vcpkg_fixup_pkgconfig() after any install step which installs *.pc files.
+
+include(vcpkg_escape_regex_control_characters)
function(vcpkg_fixup_pkgconfig_check_files pkg_cfg_cmd _file _config _system_libs _ignore_flags)
# Setup pkg-config paths
set(_VCPKG_INSTALLED_PKGCONF "${CURRENT_INSTALLED_DIR}")
@@ -134,6 +136,7 @@ function(vcpkg_fixup_pkgconfig_check_files pkg_cfg_cmd _file _config _system_lib
foreach(_search_path IN LISTS _pkg_lib_paths_output)
debug_message("REMOVING:'${_search_path}'")
debug_message("FROM:'${_pkg_libs_output}'")
+ vcpkg_escape_regex_control_characters(_search_path "${_search_path}")
string(REGEX REPLACE "(^[\t ]*|[\t ]+|;[\t ]*)-L${_search_path}([\t ]+|[\t ]*$)" ";" _pkg_libs_output "${_pkg_libs_output}") # Remove search paths from libs
endforeach()
debug_message("LIBS AFTER -L<path> REMOVAL:'${_pkg_libs_output}'")
@@ -254,14 +257,15 @@ function(vcpkg_fixup_pkgconfig)
message(FATAL_ERROR "vcpkg_fixup_pkgconfig was passed extra arguments: ${_vfct_UNPARSED_ARGUMENTS}")
endif()
+ vcpkg_escape_regex_control_characters(_vfpkg_ESCAPED_CURRENT_PACKAGES_DIR "${CURRENT_PACKAGES_DIR}")
if(NOT _vfpkg_RELEASE_FILES)
file(GLOB_RECURSE _vfpkg_RELEASE_FILES "${CURRENT_PACKAGES_DIR}/**/*.pc")
- list(FILTER _vfpkg_RELEASE_FILES EXCLUDE REGEX "${CURRENT_PACKAGES_DIR}/debug/")
+ list(FILTER _vfpkg_RELEASE_FILES EXCLUDE REGEX "${_vfpkg_ESCAPED_CURRENT_PACKAGES_DIR}/debug/")
endif()
if(NOT _vfpkg_DEBUG_FILES)
file(GLOB_RECURSE _vfpkg_DEBUG_FILES "${CURRENT_PACKAGES_DIR}/debug/**/*.pc")
- list(FILTER _vfpkg_DEBUG_FILES INCLUDE REGEX "${CURRENT_PACKAGES_DIR}/debug/")
+ list(FILTER _vfpkg_DEBUG_FILES INCLUDE REGEX "${_vfpkg_ESCAPED_CURRENT_PACKAGES_DIR}/debug/")
endif()
vcpkg_find_acquire_program(PKGCONFIG)
@@ -283,8 +287,8 @@ function(vcpkg_fixup_pkgconfig)
string(REPLACE "${CURRENT_INSTALLED_DIR}" "\${prefix}" _contents "${_contents}")
string(REPLACE "${_VCPKG_PACKAGES_DIR}" "\${prefix}" _contents "${_contents}")
string(REPLACE "${_VCPKG_INSTALLED_DIR}" "\${prefix}" _contents "${_contents}")
- string(REGEX REPLACE "^prefix=(\")?(\\\\)?\\\${prefix}(\")?" "prefix=\${pcfiledir}/${RELATIVE_PC_PATH}" _contents "${_contents}") # make pc file relocatable
- string(REGEX REPLACE "[\n]prefix=(\")?(\\\\)?\\\${prefix}(\")?" "\nprefix=\${pcfiledir}/${RELATIVE_PC_PATH}" _contents "${_contents}") # make pc file relocatable
+ string(REGEX REPLACE "^prefix[ \t]*=[ \t]*(\")?(\\\\)?\\\${prefix}(\")?" "prefix=\${pcfiledir}/${RELATIVE_PC_PATH}" _contents "${_contents}") # make pc file relocatable
+ string(REGEX REPLACE "[\n]prefix[ \t]*=[ \t]*(\")?(\\\\)?\\\${prefix}(\")?" "\nprefix=\${pcfiledir}/${RELATIVE_PC_PATH}" _contents "${_contents}") # make pc file relocatable
file(WRITE "${_file}" "${_contents}")
unset(PKG_LIB_SEARCH_PATH)
endforeach()
@@ -313,8 +317,8 @@ function(vcpkg_fixup_pkgconfig)
string(REPLACE "debug/share" "../share" _contents "${_contents}")
string(REPLACE "\${prefix}/share" "\${prefix}/../share" _contents "${_contents}")
string(REPLACE "debug/lib" "lib" _contents "${_contents}") # the prefix will contain the debug keyword
- string(REGEX REPLACE "^prefix=(\")?(\\\\)?\\\${prefix}(/debug)?(\")?" "prefix=\${pcfiledir}/${RELATIVE_PC_PATH}" _contents "${_contents}") # make pc file relocatable
- string(REGEX REPLACE "[\n]prefix=(\")?(\\\\)?\\\${prefix}(/debug)?(\")?" "\nprefix=\${pcfiledir}/${RELATIVE_PC_PATH}" _contents "${_contents}") # make pc file relocatable
+ string(REGEX REPLACE "^prefix[ \t]*=[ \t]*(\")?(\\\\)?\\\${prefix}(/debug)?(\")?" "prefix=\${pcfiledir}/${RELATIVE_PC_PATH}" _contents "${_contents}") # make pc file relocatable
+ string(REGEX REPLACE "[\n]prefix[ \t]*=[ \t]*(\")?(\\\\)?\\\${prefix}(/debug)?(\")?" "\nprefix=\${pcfiledir}/${RELATIVE_PC_PATH}" _contents "${_contents}") # make pc file relocatable
string(REPLACE "\${prefix}/debug" "\${prefix}" _contents "${_contents}") # replace remaining debug paths if they exist.
file(WRITE "${_file}" "${_contents}")
unset(PKG_LIB_SEARCH_PATH)