includes CTest module resp. BUILD_TESTING option

This commit is contained in:
Matthias Möller 2017-12-20 17:54:45 +01:00
parent 88ddb12afc
commit d1cda6888e

View file

@ -9,7 +9,7 @@ project(nlohmann_json VERSION 3.0.0 LANGUAGES CXX)
## ##
## OPTIONS ## OPTIONS
## ##
option(JSON_BuildTests "Build the unit tests" ON) option(JSON_BuildTests "Build the unit tests when BUILD_TESTING is enabled." ON)
## ##
## CONFIGURATION ## CONFIGURATION
@ -54,7 +54,9 @@ endif()
## TESTS ## TESTS
## create and configure the unit test target ## create and configure the unit test target
## ##
if(JSON_BuildTests) include(CTest) #adds option BUILD_TESTING (default ON)
if(BUILD_TESTING AND JSON_BuildTests)
enable_testing() enable_testing()
include_directories(${NLOHMANN_JSON_SOURCE_DIR}) include_directories(${NLOHMANN_JSON_SOURCE_DIR})
add_subdirectory(test) add_subdirectory(test)