Skip to content

Commit b8327e2

Browse files
Explicitly set CCCL_TOPLEVEL_PROJECT to OFF when needed (#7016)
1 parent 7d389d4 commit b8327e2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@ endif()
99

1010
# Determine whether CCCL is the top-level project or included into
1111
# another project via add_subdirectory()
12-
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_LIST_DIR}")
13-
set(CCCL_TOPLEVEL_PROJECT ON)
12+
13+
if (NOT DEFINED CCCL_TOPLEVEL_PROJECT)
14+
# DO NOT REMOVE THE FOLLOWING LINE
15+
set(CCCL_TOPLEVEL_PROJECT OFF)
16+
# REQUIRED FOR CCCL TO WORK VIA CPM WITH INSTALL RULES
17+
18+
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_LIST_DIR}")
19+
set(CCCL_TOPLEVEL_PROJECT ON)
20+
endif()
1421
endif()
1522

1623
# Enable CXX so CMake can configure install paths

0 commit comments

Comments
 (0)