From 0d6ab660b1e897465a2222a4bfb829a25c547d94 Mon Sep 17 00:00:00 2001 From: Mathis Logemann <13556116+mathisloge@users.noreply.github.com> Date: Thu, 19 Mar 2026 19:51:16 +1100 Subject: [PATCH] Move top level project detection above project call --- CMakeLists.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d8376ace..9893a8361 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,6 +53,15 @@ endif() file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/execution.bs" STD_EXECUTION_BS_REVISION_LINE REGEX "Revision: [0-9]+") string(REGEX REPLACE "Revision: ([0-9]+)" "\\1" STD_EXECUTION_BS_REVISION ${STD_EXECUTION_BS_REVISION_LINE}) +# Determine if STDEXEC is built as a subproject (using add_subdirectory) or if it is the main project. +if (NOT DEFINED STDEXEC_MAIN_PROJECT) + set(STDEXEC_MAIN_PROJECT OFF) + # Checking project name is more reliable than checking source directories. + if (NOT DEFINED PROJECT_NAME) + set(STDEXEC_MAIN_PROJECT ON) + endif () +endif () + project(STDEXEC VERSION "0.${STD_EXECUTION_BS_REVISION}.0" LANGUAGES CXX) include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/CompilerHelpers.cmake) @@ -82,15 +91,6 @@ rapids_cmake_build_type(Release) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules") -# Determine if STDEXEC is built as a subproject (using add_subdirectory) or if it is the main project. -if (NOT DEFINED STDEXEC_MAIN_PROJECT) - set(STDEXEC_MAIN_PROJECT OFF) - # Checking project name is more reliable than checking source directories. - if (NOT DEFINED PROJECT_NAME) - set(STDEXEC_MAIN_PROJECT ON) - endif () -endif () - # Disable the tests by default unless it is the top level project and build testing was specified. if (STDEXEC_MAIN_PROJECT AND BUILD_TESTING) set(STDEXEC_BUILD_TESTS_DEFAULT ON)