Skip to content

Commit ea759d0

Browse files
committed
Compare to CMAKE_CURRENT_SOURCE_DIR for main project check
1 parent 7905088 commit ea759d0

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ project(nlohmann_json VERSION 3.9.1 LANGUAGES CXX)
88

99
##
1010
## MAIN_PROJECT CHECK
11+
## determine if nlohmann_json is built as a subproject (using add_subdirectory) or if it is the main project
1112
##
1213
set(MAIN_PROJECT OFF)
13-
if (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
14+
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
1415
set(MAIN_PROJECT ON)
1516
endif()
1617

0 commit comments

Comments
 (0)