Am 22.04.24 um 14:12 schrieb Even Rouault via gdal-dev:
Hi,
I've prepared a beta1 of GDAL 3.9.0 to get feedback from early testers.
I did a test build in vcpkg, and I see downstream problems with static
linkage. It now raises:
CMake Error at /mnt/vss/_work/1/s/scripts/buildsystems/vcpkg.cmake:859
(_find_package):
_find_package given CONFIGS option followed by invalid file name "3.8".
The names given must be file names without a path and with a ".cmake"
extension.
Call Stack (most recent call first):
/mnt/vcpkg-ci/downloads/tools/cmake-3.29.2-linux/cmake-3.29.2-linux-x86_64/share/cmake-3.29/Modules/CMakeFindDependencyMacro.cmake:76
(find_package)
/mnt/vcpkg-ci/installed/x64-linux/share/gdal/GDALConfig.cmake:37
(find_dependency)
/mnt/vcpkg-ci/installed/x64-linux/share/gdal/vcpkg-cmake-wrapper.cmake:13
(_find_package)
/mnt/vss/_work/1/s/scripts/buildsystems/vcpkg.cmake:813 (include)
CMakeLists.txt:36 (find_package)
(Don't get distracted by vcpkg: _find_package is CMake's regular
find_package.)
IIUC the generated CMake config is wrong when dependency versions are
used together with config names, as in:
find_dependency(GEOS NAMES GEOS CONFIGS geos-config.cmake 3.8)
find_dependency(NetCDF NAMES netCDF CONFIGS netCDFConfig.cmake 4.7)
AFAICT the version number must be the 2nd argument. Maybe VERSION wasn't
used often enough before, or/and it is a new CMake feature.
A tentative patch is attached, end-to-end tests pending.
Kai
diff --git a/cmake/helpers/CheckDependentLibraries.cmake b/cmake/helpers/CheckDependentLibraries.cmake
index 6eeb5d8..5d19b47 100644
--- a/cmake/helpers/CheckDependentLibraries.cmake
+++ b/cmake/helpers/CheckDependentLibraries.cmake
@@ -142,7 +142,7 @@ macro (gdal_check_package name purpose)
gdal_check_package_target(${name} ${GDAL_CHECK_PACKAGE_${name}_TARGETS} REQUIRED)
if (${name}_FOUND)
get_filename_component(_find_dependency_args "${${name}_CONFIG}" NAME)
- string(REPLACE ";" " " _find_dependency_args "${name} NAMES ${GDAL_CHECK_PACKAGE_${name}_NAMES} CONFIGS ${_find_dependency_args} ${_find_package_args}")
+ string(REPLACE ";" " " _find_dependency_args "${name} ${_find_package_args} NAMES ${GDAL_CHECK_PACKAGE_${name}_NAMES} CONFIGS ${_find_dependency_args}")
endif ()
endif ()
if (NOT ${name}_FOUND)
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev