diff --git a/CMakeLists.txt b/CMakeLists.txt index d1ae64e2f56..198727dc5d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,17 +25,18 @@ endif() # Support adding CCCL to a parent project via add_subdirectory. if (NOT CCCL_TOPLEVEL_PROJECT) include(cmake/CCCLAddSubdir.cmake) - return() endif() # We require a higher cmake version for dev builds -cmake_minimum_required(VERSION 3.21) +if (CCCL_TOPLEVEL_PROJECT) + cmake_minimum_required(VERSION 3.21) +endif() -option(CCCL_ENABLE_LIBCUDACXX "Enable the libcu++ developer build." ON) -option(CCCL_ENABLE_CUB "Enable the CUB developer build." ON) -option(CCCL_ENABLE_THRUST "Enable the Thrust developer build." ON) -option(CCCL_ENABLE_TESTING "Enable CUDA C++ Core Library tests." ON) -option(CCCL_ENABLE_EXAMPLES "Enable CUDA C++ Core Library examples." ON) +option(CCCL_ENABLE_LIBCUDACXX "Enable the libcu++ developer build." ${CCCL_TOPLEVEL_PROJECT}) +option(CCCL_ENABLE_CUB "Enable the CUB developer build." ${CCCL_TOPLEVEL_PROJECT}) +option(CCCL_ENABLE_THRUST "Enable the Thrust developer build." ${CCCL_TOPLEVEL_PROJECT}) +option(CCCL_ENABLE_TESTING "Enable CUDA C++ Core Library tests." ${CCCL_TOPLEVEL_PROJECT}) +option(CCCL_ENABLE_EXAMPLES "Enable CUDA C++ Core Library examples." ${CCCL_TOPLEVEL_PROJECT}) option(CCCL_ENABLE_BENCHMARKS "Enable CUDA C++ Core Library benchmarks." OFF) option(CCCL_ENABLE_UNSTABLE "Enable targets and developer build options for unstable projects." OFF) @@ -44,27 +45,28 @@ if (CCCL_ENABLE_UNSTABLE) option(CCCL_ENABLE_CUDAX "Enable the CUDA Experimental developer build." ON) endif() - include(CTest) enable_testing() -include(cmake/CCCLUtilities.cmake) # include this first -include(cmake/CCCLClangdCompileInfo.cmake) +if (CCCL_TOPLEVEL_PROJECT) + include(cmake/CCCLUtilities.cmake) # include this first + include(cmake/CCCLClangdCompileInfo.cmake) +endif() if (CCCL_ENABLE_LIBCUDACXX) - set(LIBCUDACXX_TOPLEVEL_PROJECT ON) + set(LIBCUDACXX_TOPLEVEL_PROJECT ${CCCL_TOPLEVEL_PROJECT}) endif() if (CCCL_ENABLE_CUB) - set(CUB_TOPLEVEL_PROJECT ON) + set(CUB_TOPLEVEL_PROJECT ${CCCL_TOPLEVEL_PROJECT}) endif() if (CCCL_ENABLE_THRUST) - set(THRUST_TOPLEVEL_PROJECT ON) + set(THRUST_TOPLEVEL_PROJECT ${CCCL_TOPLEVEL_PROJECT}) endif() if (CCCL_ENABLE_CUDAX) - set(cudax_TOPLEVEL_PROJECT ON) + set(cudax_TOPLEVEL_PROJECT ${CCCL_TOPLEVEL_PROJECT}) endif() add_subdirectory(libcudacxx)