vcpkg/ports/proj4/fix-proj4-targets-cmake.patch
Kai Pastor a4f322c567
[proj4] Update to 8.1.1, revise features and dependencies (#20443)
* Update to 8.1.1, cleanup patches

* Patch and use pc file installation from upstream

* Simplify dependency fixup

* Remove obsolete VCPKG_BUILD_SHARED_LIBS

* Revise feature and dependency interface

* Update versions

* Use all libs from proj.pc for gdal

* Set CMP0012 for dependency control

* Update versions

* Update versions

* Fix missing user32.lib when using libcrypto

* Update versions

* Fix missing user32.lib when using libcrypto

* Update versions
2021-12-09 18:18:18 -08:00

67 lines
2.2 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7d736d129..2be8f8be9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -129,7 +129,22 @@ if(NOT EXE_SQLITE3)
message(SEND_ERROR "sqlite3 binary not found!")
endif()
-find_package(Sqlite3 REQUIRED)
+find_package(unofficial-sqlite3 CONFIG REQUIRED)
+if(unofficial-sqlite3_FOUND)
+ set(SQLITE3_FOUND true)
+ get_target_property(SQLITE3_INCLUDE_DIR unofficial::sqlite3::sqlite3 INTERFACE_INCLUDE_DIRECTORIES)
+ set(SQLITE3_LIBRARY unofficial::sqlite3::sqlite3)
+ # Extract version information from the header file
+ if(SQLITE3_INCLUDE_DIR)
+ file(STRINGS ${SQLITE3_INCLUDE_DIR}/sqlite3.h _ver_line
+ REGEX "^#define SQLITE_VERSION *\"[0-9]+\\.[0-9]+\\.[0-9]+\""
+ LIMIT_COUNT 1)
+ string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+"
+ SQLITE3_VERSION "${_ver_line}")
+ unset(_ver_line)
+ endif()
+endif()
+
if(NOT SQLITE3_FOUND)
message(SEND_ERROR "sqlite3 dependency not found!")
endif()
@@ -151,6 +165,7 @@ if(ENABLE_TIFF)
find_package(TIFF REQUIRED)
if(TIFF_FOUND)
set(TIFF_ENABLED TRUE)
+ set(TIFF_LIBRARY TIFF::TIFF)
else()
message(SEND_ERROR
"libtiff dependency not found! Use ENABLE_TIFF=OFF to force it off")
@@ -171,6 +188,7 @@ if(ENABLE_CURL)
find_package(CURL REQUIRED)
if(CURL_FOUND)
set(CURL_ENABLED TRUE)
+ set(CURL_LIBRARY CURL::libcurl)
else()
message(SEND_ERROR "curl dependency not found!")
endif()
diff --git a/cmake/project-config.cmake.in b/cmake/project-config.cmake.in
index 23f997abd..8baef00f0 100644
--- a/cmake/project-config.cmake.in
+++ b/cmake/project-config.cmake.in
@@ -7,6 +7,17 @@
# @PROJECT_VARIANT_NAME@_LIBRARY_DIRS = /usr/local/lib
# @PROJECT_VARIANT_NAME@_BINARY_DIRS = /usr/local/bin
# @PROJECT_VARIANT_NAME@_VERSION = 4.9.1 (for example)
+cmake_policy(PUSH)
+cmake_policy(SET CMP0012 NEW)
+include(CMakeFindDependencyMacro)
+find_dependency(unofficial-sqlite3 CONFIG)
+if("@ENABLE_TIFF@")
+ find_dependency(TIFF)
+endif()
+if("@ENABLE_CURL@")
+ find_dependency(CURL CONFIG)
+endif()
+cmake_policy(POP)
# Tell the user project where to find our headers and libraries
get_filename_component (_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)