Add option to disable unit tests

mutable-v2
Bruno Coelho 2016-07-05 15:37:44 +01:00
parent 913269c7a4
commit 3704671508
1 changed files with 6 additions and 2 deletions

View File

@ -3,6 +3,8 @@ project(json11 VERSION 1.0.0 LANGUAGES CXX)
enable_testing() enable_testing()
option(JSON11_BUILD_TESTS "Build unit tests" ON)
add_library(json11 json11.cpp) add_library(json11 json11.cpp)
target_include_directories(json11 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(json11 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_options(json11 target_compile_options(json11
@ -10,8 +12,10 @@ target_compile_options(json11
PRIVATE -fno-rtti -fno-exceptions -Wall -Wextra -Werror) PRIVATE -fno-rtti -fno-exceptions -Wall -Wextra -Werror)
configure_file("json11.pc.in" "json11.pc" @ONLY) configure_file("json11.pc.in" "json11.pc" @ONLY)
add_executable(json11_test test.cpp) if (JSON11_BUILD_TESTS)
target_link_libraries(json11_test json11) add_executable(json11_test test.cpp)
target_link_libraries(json11_test json11)
endif()
install(TARGETS json11 DESTINATION lib) install(TARGETS json11 DESTINATION lib)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/json11.hpp" DESTINATION include) install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/json11.hpp" DESTINATION include)