From 5e664c99d887133f5e06a902b2b61ea67413e7f4 Mon Sep 17 00:00:00 2001 From: kirisetsz Date: Fri, 8 Apr 2016 01:16:21 +0800 Subject: [PATCH] Update CMakeLists to 3.x style --- CMakeLists.txt | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ba8edd5..397104a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,21 +1,14 @@ -project(json11) +project(json11 CXX) -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.2) enable_testing() -add_definitions( - -std=c++11 - -fno-rtti - -fno-exceptions - -Wall - -Wextra - -Werror) +add_library(json11 json11.cpp) +target_include_directories(json11 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_compile_options(json11 + PUBLIC -std=c++11 + PRIVATE -fno-rtti -fno-exceptions -Wall -Wextra -Werror) -set(json11_SRCS json11.cpp) - -add_library(json11 STATIC ${json11_SRCS}) - -add_test(json11_test json11_test) - -add_executable(json11_test ${json11_SRCS} test.cpp) +add_executable(json11_test test.cpp) +target_link_libraries(json11_test json11)