2022-07-08 06:05:52 +08:00
|
|
|
cmake_policy(PUSH)
|
|
|
|
cmake_policy(SET CMP0012 NEW)
|
|
|
|
cmake_policy(SET CMP0054 NEW)
|
2020-08-22 06:44:23 +08:00
|
|
|
|
2022-07-08 06:05:52 +08:00
|
|
|
list(REMOVE_ITEM ARGS "NO_MODULE" "CONFIG" "MODULE")
|
|
|
|
list(APPEND ARGS "CONFIG")
|
|
|
|
# The current port version should satisfy GDAL 3.0 ... 3.5
|
|
|
|
list(GET ARGS 1 vcpkg_gdal_maybe_version)
|
|
|
|
if(vcpkg_gdal_maybe_version MATCHES "(^3\$|^3[.][0-5])")
|
|
|
|
list(REMOVE_AT ARGS "1")
|
2021-07-24 01:38:02 +08:00
|
|
|
endif()
|
2022-07-08 06:05:52 +08:00
|
|
|
unset(vcpkg_gdal_maybe_version)
|
|
|
|
_find_package(${ARGS} CONFIG)
|
2021-07-24 01:38:02 +08:00
|
|
|
if(GDAL_FOUND)
|
2022-07-08 06:05:52 +08:00
|
|
|
get_filename_component(vcpkg_gdal_prefix "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)
|
|
|
|
set(GDAL_INCLUDE_DIR "${vcpkg_gdal_prefix}/include" CACHE INTERNAL "")
|
|
|
|
set(GDAL_INCLUDE_DIRS "${GDAL_INCLUDE_DIR}")
|
|
|
|
set(GDAL_LIBRARY GDAL::GDAL CACHE INTERNAL "")
|
|
|
|
set(GDAL_LIBRARIES "${GDAL_LIBRARY}")
|
|
|
|
unset(vcpkg_gdal_prefix)
|
2021-07-24 01:38:02 +08:00
|
|
|
endif()
|
2022-07-08 06:05:52 +08:00
|
|
|
|
|
|
|
cmake_policy(POP)
|