From 3eac8d5694cfd1049f613cc5c638097976244768 Mon Sep 17 00:00:00 2001 From: Mike Taves Date: Thu, 20 Feb 2020 12:37:37 +1300 Subject: 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 --- CMakeLists.txt | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'CMakeLists.txt') 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() ################################################################################ -- cgit v1.2.3