mirror of
https://github.com/ToruNiina/toml11.git
synced 2024-11-26 22:30:06 +00:00
36 lines
1.3 KiB
CMake
36 lines
1.3 KiB
CMake
cmake_minimum_required(VERSION 2.8)
|
|
enable_testing()
|
|
project(toml11)
|
|
|
|
include(CheckCXXCompilerFlag)
|
|
if("${CMAKE_VERSION}" VERSION_GREATER 3.1)
|
|
set(CMAKE_CXX_STANDARD 11)
|
|
set(CXX_STANDARD_REQUIRED ON)
|
|
else()
|
|
# Manually check for C++11 compiler flag.
|
|
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
|
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
|
|
CHECK_CXX_COMPILER_FLAG("-std=gnu++11" COMPILER_SUPPORTS_GNU11)
|
|
CHECK_CXX_COMPILER_FLAG("-std=gnu++0x" COMPILER_SUPPORTS_GNU0X)
|
|
if(COMPILER_SUPPORTS_CXX11)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
|
elseif(COMPILER_SUPPORTS_CXXOX)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
|
elseif(COMPILER_SUPPORTS_GNU11)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
|
|
elseif(COMPILER_SUPPORTS_GNU0X)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
|
|
else()
|
|
if(MSVC)
|
|
if(MSVC_VERSION LESS 1900)
|
|
message(SEND_ERROR "MSVC < 14.0 is not supported. Please update your compiler or use mingw")
|
|
endif()
|
|
else()
|
|
message(SEND_ERROR "The ${CMAKE_CXX_COMPILER} compiler lacks C++11 support. Use another compiler.")
|
|
endif()
|
|
endif()
|
|
endif()
|
|
|
|
include_directories(${PROJECT_SOURCE_DIR})
|
|
add_subdirectory(tests)
|