Skip to content
This repository was archived by the owner on Mar 26, 2020. It is now read-only.

Commit e19ef2b

Browse files
author
akira-miasato
authored
Add compatibility with older 2.8 version of CMake
Some legacy systems (Ubuntu 14.04, RHEL7.2) have older versions of CMake.
1 parent a147e63 commit e19ef2b

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

CMakeLists.txt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1-
cmake_minimum_required(VERSION 3.2)
2-
project(json11 VERSION 1.0.0 LANGUAGES CXX)
1+
cmake_minimum_required(VERSION 2.8)
2+
if (CMAKE_VERSION VERSION_LESS "3")
3+
project(json11 CXX)
4+
else()
5+
project(json11 VERSION 1.0.0 LANGUAGES CXX)
6+
endif()
37

48
enable_testing()
59

610
option(JSON11_BUILD_TESTS "Build unit tests" OFF)
711
option(JSON11_ENABLE_DR1467_CANARY "Enable canary test for DR 1467" OFF)
812

9-
set(CMAKE_CXX_STANDARD 11)
10-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
13+
if(CMAKE_VERSION VERSION_LESS "3")
14+
add_definitions(-std=c++11)
15+
else()
16+
set(CMAKE_CXX_STANDARD 11)
17+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
18+
endif()
19+
1120
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
1221
set(CMAKE_INSTALL_PREFIX /usr)
1322
endif()

0 commit comments

Comments
 (0)