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

Commit ed35a09

Browse files
authored
Merge pull request #107 from akira-miasato/master
Add compatibility with older 2.8 version of CMake
2 parents a147e63 + b3c769d commit ed35a09

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

CMakeLists.txt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
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+
cmake_policy(SET CMP0048 NEW)
6+
project(json11 VERSION 1.0.0 LANGUAGES CXX)
7+
endif()
38

49
enable_testing()
510

611
option(JSON11_BUILD_TESTS "Build unit tests" OFF)
712
option(JSON11_ENABLE_DR1467_CANARY "Enable canary test for DR 1467" OFF)
813

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

0 commit comments

Comments
 (0)