diff --git a/cmake/modules/hunter_pkgconfig_export_target.cmake b/cmake/modules/hunter_pkgconfig_export_target.cmake index c470bc00ab..b7584a1608 100644 --- a/cmake/modules/hunter_pkgconfig_export_target.cmake +++ b/cmake/modules/hunter_pkgconfig_export_target.cmake @@ -21,6 +21,17 @@ function(hunter_pkgconfig_export_target PKG_CONFIG_MODULE PKG_GENERATE_SHARED) if(TARGET "${target_name}") return() endif() + + if(${PKG_CONFIG_MODULE}_FOUND) + file(READ "${CMAKE_BINARY_DIR}/_3rdParty/Hunter/install-root-dir" HUNTER_INSTALL_ROOT_DIR) + list(APPEND _copy_of_${PKG_CONFIG_MODULE}_LIBRARY_DIRS "${PKG_CONFIG_MODULE}_LIBRARY_DIRS") + list(FILTER _copy_of_${PKG_CONFIG_MODULE}_LIBRARY_DIRS EXCLUDE REGEX "${HUNTER_INSTALL_ROOT_DIR}") + list(LENGTH _copy_of_${PKG_CONFIG_MODULE}_LIBRARY_DIRS _list_length) + if(_list_length GREATER 0) + message(SEND_ERROR "CMakeCache entries for ${PKG_CONFIG_MODULE}_LIBRARY_DIRS points to ${${PKG_CONFIG_MODULE}_LIBRARY_DIRS} but the current hunter install root dir is ${HUNTER_INSTALL_ROOT_DIR}\nYou should verify and change/remove all wrong cache entries or delete your CMakeCache.txt in your build folder!") + endif() + endif() + pkg_check_modules(${PKG_CONFIG_MODULE} ${PKG_CONFIG_MODULE}) if(NOT ${PKG_CONFIG_MODULE}_FOUND) hunter_internal_error( diff --git a/cmake/projects/x11/hunter.cmake b/cmake/projects/x11/hunter.cmake index 0bb5735f9b..fe1e74a73f 100644 --- a/cmake/projects/x11/hunter.cmake +++ b/cmake/projects/x11/hunter.cmake @@ -53,7 +53,7 @@ hunter_cmake_args( hunter_cacheable(x11) hunter_download( PACKAGE_NAME x11 - PACKAGE_INTERNAL_DEPS_ID "7" + PACKAGE_INTERNAL_DEPS_ID "8" PACKAGE_UNRELOCATABLE_TEXT_FILES "lib/libX11-xcb.la" "lib/libX11.la" diff --git a/cmake/projects/x264/hunter.cmake b/cmake/projects/x264/hunter.cmake index bba098573a..6bb28d072a 100644 --- a/cmake/projects/x264/hunter.cmake +++ b/cmake/projects/x264/hunter.cmake @@ -36,6 +36,6 @@ hunter_cmake_args(x264 CMAKE_ARGS PKGCONFIG_EXPORT_TARGETS=x264) hunter_cacheable(x264) hunter_download( PACKAGE_NAME x264 - PACKAGE_INTERNAL_DEPS_ID "3" + PACKAGE_INTERNAL_DEPS_ID "4" PACKAGE_UNRELOCATABLE_TEXT_FILES "lib/pkgconfig/x264.pc" ) diff --git a/cmake/projects/xcb/hunter.cmake b/cmake/projects/xcb/hunter.cmake index 7b1a194f32..4640bad6e4 100644 --- a/cmake/projects/xcb/hunter.cmake +++ b/cmake/projects/xcb/hunter.cmake @@ -63,6 +63,6 @@ hunter_pick_scheme(DEFAULT xcb) hunter_cacheable(xcb) hunter_download( PACKAGE_NAME xcb - PACKAGE_INTERNAL_DEPS_ID "6" + PACKAGE_INTERNAL_DEPS_ID "7" PACKAGE_UNRELOCATABLE_TEXT_FILES "${_xcb_text_files}" )