2016-04-08 01:16:21 +08:00
|
|
|
cmake_minimum_required(VERSION 3.2)
|
2016-04-17 01:41:25 +08:00
|
|
|
project(json11 VERSION 1.0.0 LANGUAGES CXX)
|
2015-08-20 05:53:28 +08:00
|
|
|
|
|
|
|
enable_testing()
|
|
|
|
|
2016-07-05 22:37:44 +08:00
|
|
|
option(JSON11_BUILD_TESTS "Build unit tests" ON)
|
|
|
|
|
2016-04-08 01:16:21 +08:00
|
|
|
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)
|
2016-04-17 01:41:25 +08:00
|
|
|
configure_file("json11.pc.in" "json11.pc" @ONLY)
|
2015-08-20 05:53:28 +08:00
|
|
|
|
2016-07-05 22:37:44 +08:00
|
|
|
if (JSON11_BUILD_TESTS)
|
|
|
|
add_executable(json11_test test.cpp)
|
|
|
|
target_link_libraries(json11_test json11)
|
|
|
|
endif()
|
2016-04-17 01:41:25 +08:00
|
|
|
|
|
|
|
install(TARGETS json11 DESTINATION lib)
|
|
|
|
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/json11.hpp" DESTINATION include)
|
2016-05-05 09:43:43 +08:00
|
|
|
install(FILES "${CMAKE_BINARY_DIR}/json11.pc" DESTINATION lib/pkgconfig)
|