Compare to CMAKE_CURRENT_SOURCE_DIR for main project check

pull/2514/head
Martin Stump 2020-12-13 20:34:51 +01:00
parent 790508887e
commit ea759d0360
No known key found for this signature in database
GPG Key ID: 0C0026DF78FB33D2
1 changed files with 2 additions and 1 deletions

View File

@ -8,9 +8,10 @@ project(nlohmann_json VERSION 3.9.1 LANGUAGES CXX)
##
## MAIN_PROJECT CHECK
## determine if nlohmann_json is built as a subproject (using add_subdirectory) or if it is the main project
##
set(MAIN_PROJECT OFF)
if (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(MAIN_PROJECT ON)
endif()