Skip to content

Commit 4c486b6

Browse files
committed
Verfiy if cmake version is 3.11 or higher for FetchContent
1 parent e14b27d commit 4c486b6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.11...3.19)
1+
cmake_minimum_required(VERSION 3.8...3.19)
22

33
project(taocpp-config VERSION 1.0.0 LANGUAGES CXX)
44

@@ -37,13 +37,17 @@ if(NOT taocpp-json_FOUND)
3737
set(TAOCPP_JSON_INSTALL_CMAKE_DIR ${CMAKE_INSTALL_DATAROOTDIR}/json/cmake CACHE STRING "Override taoJSON cmake install directory")
3838
add_subdirectory(external/json)
3939
else()
40-
include(FetchContent)
41-
FetchContent_Declare(
40+
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.11)
41+
include(FetchContent)
42+
FetchContent_Declare(
4243
taocpp-json
4344
GIT_REPOSITORY https://github.com/taocpp/json.git
4445
GIT_TAG master
4546
)
46-
FetchContent_MakeAvailable(taocpp-json)
47+
FetchContent_MakeAvailable(taocpp-json)
48+
else()
49+
message(FATAL_ERROR "taoJSON headers are not found!\nInstall taoJSON OR\ncheckout the taoJSON project manually into external/json OR\nuse cmake 3.11 or above")
50+
endif()
4751
endif()
4852
if(TAOCPP_CONFIG_INSTALL)
4953
# install and export target

0 commit comments

Comments
 (0)