aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorMike Taves <mwtoews@gmail.com>2020-02-20 12:37:37 +1300
committerKristian Evers <kristianevers@gmail.com>2020-02-21 11:23:15 +0100
commit3eac8d5694cfd1049f613cc5c638097976244768 (patch)
tree58d7a7e56840d4c90338c58d53d698ec8409a383 /CMakeLists.txt
parent86530f3146ec091c26652e60067088dc3e067fae (diff)
downloadPROJ-3eac8d5694cfd1049f613cc5c638097976244768.tar.gz
PROJ-3eac8d5694cfd1049f613cc5c638097976244768.zip
Switch build configuration logic from DISABLE_TIFF to ENABLE_TIFF
* Autotools interface should be the same, but different ./configure --help * For CMake, the option should be -DENABLE_TIFF=NO (default is YES) * Use TIFF_ENABLED and CURL_ENABLED variables, based on option and outcome * Reword some messages and add hints * Move -DTIFF_ENABLED and -DCURL_ENABLED from global add_definitions() to target_compile_definitions(), which is recommended practice * Minor spelling and style consistency around SQLITE_VERSION check
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt33
1 files changed, 20 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b04c933e..be3303dc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -127,26 +127,31 @@ if(NOT SQLITE3_FOUND)
message(SEND_ERROR "sqlite3 dependency not found!")
endif()
-# Would build and run with older versons, but with horrible performance
+# Would build and run with older versions, but with horrible performance
# See https://github.com/OSGeo/PROJ/issues/1718
-IF("${SQLITE3_VERSION}" VERSION_LESS "3.11")
+if("${SQLITE3_VERSION}" VERSION_LESS "3.11")
message(SEND_ERROR "sqlite3 >= 3.11 required!")
-ENDIF()
+endif()
################################################################################
# Check for libtiff
################################################################################
-option(DISABLE_TIFF "Disable TIFF support" OFF)
-mark_as_advanced(DISABLE_TIFF)
-if(DISABLE_TIFF)
- message(WARNING "TIFF support has been disabled and will result in the inability to read some grids")
-else()
+option(ENABLE_TIFF "Enable TIFF support to read some grids" ON)
+mark_as_advanced(ENABLE_TIFF)
+set(TIFF_ENABLED FALSE)
+if(ENABLE_TIFF)
find_package(TIFF REQUIRED)
- if(NOT TIFF_FOUND)
- message(SEND_ERROR "libtiff dependency not found!")
+ if(TIFF_FOUND)
+ set(TIFF_ENABLED TRUE)
+ else()
+ message(SEND_ERROR
+ "libtiff dependency not found! Use ENABLE_TIFF=OFF to force it off")
endif()
- add_definitions(-DTIFF_ENABLED)
+else()
+ message(WARNING
+ "TIFF support is not enabled and will result in the inability to read "
+ "some grids")
endif()
################################################################################
@@ -154,12 +159,14 @@ endif()
################################################################################
option(ENABLE_CURL "Enable Curl support" ON)
+set(CURL_ENABLED FALSE)
if(ENABLE_CURL)
find_package(CURL REQUIRED)
- if(NOT CURL_FOUND)
+ if(CURL_FOUND)
+ set(CURL_ENABLED TRUE)
+ else()
message(SEND_ERROR "curl dependency not found!")
endif()
- add_definitions(-DCURL_ENABLED)
endif()
################################################################################