Disable tests if used as subproject

This commit is contained in:
SandoreX 2018-11-26 12:23:57 +01:00
parent ef90d62ddf
commit 2841afa2bc

View File

@ -40,6 +40,10 @@ else()
message(STATUS "Using the single-header code from ${NLOHMANN_JSON_INCLUDE_BUILD_DIR}")
endif()
if(NOT "${PROJECT_NAME}" STREQUAL "${CMAKE_PROJECT_NAME}")
set(SUBPROJECT ON)
endif()
##
## TARGET
## create target and add include path
@ -73,7 +77,7 @@ endif()
##
include(CTest) #adds option BUILD_TESTING (default ON)
if(BUILD_TESTING AND JSON_BuildTests)
if(BUILD_TESTING AND JSON_BuildTests AND NOT SUBPROJECT)
enable_testing()
add_subdirectory(test)
endif()