Skip to content

Commit 733064b

Browse files
author
David Eles
committed
Fix build issues during import.
When stdexec is used as a 3rd-party dependency for example with fetch content it is downloaded into the cmake build folder under the _deps. A setup like that will results a build directory structure like build/_deps/stdexec-src /stdexec-build in this context the CMAKE_BINARY_DIR is the build folder and the CMAKE_CURRENT_BINARY_DIR is the build/_deps/stdexec-build. Issue #1: Right now the build will place two files into the 'main' build folder: - execution.bs - RAPIDS.cmake It might causes problems when the main cmake project uses RAPIDS with a different version. Issue NVIDIA#2: There is no such a file stdexec_version_config.hpp under the main build tree. And it will cause a configuration error.
1 parent 2e87822 commit 733064b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

CMakeLists.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ endif()
1818
# - Download and initialize RAPIDS CMake helpers -----------------------------
1919

2020
# Fetch rapids-cmake
21-
if(NOT EXISTS ${CMAKE_BINARY_DIR}/RAPIDS.cmake)
21+
if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/RAPIDS.cmake)
2222
file(DOWNLOAD https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-24.02/RAPIDS.cmake
23-
${CMAKE_BINARY_DIR}/RAPIDS.cmake)
23+
${CMAKE_CURRENT_BINARY_DIR}/RAPIDS.cmake)
2424
endif()
2525
# Initialize rapids-cmake
26-
include(${CMAKE_BINARY_DIR}/RAPIDS.cmake)
26+
include(${CMAKE_CURRENT_BINARY_DIR}/RAPIDS.cmake)
2727
# utilities for generating export set package metadata
2828
include(rapids-export)
2929
# utilities for finding packages
@@ -37,11 +37,11 @@ include(rapids-cpm)
3737
# - Project definition -------------------------------------------------------
3838

3939
# Define the project and set the version and languages
40-
if(NOT EXISTS ${CMAKE_BINARY_DIR}/execution.bs)
40+
if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/execution.bs)
4141
file(DOWNLOAD "https://raw.githubusercontent.com/cplusplus/sender-receiver/main/execution.bs"
42-
${CMAKE_BINARY_DIR}/execution.bs)
42+
${CMAKE_CURRENT_BINARY_DIR}/execution.bs)
4343
endif()
44-
file(STRINGS "${CMAKE_BINARY_DIR}/execution.bs" STD_EXECUTION_BS_REVISION_LINE REGEX "Revision: [0-9]+")
44+
file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/execution.bs" STD_EXECUTION_BS_REVISION_LINE REGEX "Revision: [0-9]+")
4545
string(REGEX REPLACE "Revision: ([0-9]+)" "\\1" STD_EXECUTION_BS_REVISION ${STD_EXECUTION_BS_REVISION_LINE})
4646

4747
# nvc++ isn't supported by (s)ccache yet, so unset these before the `project()`
@@ -164,9 +164,9 @@ PUBLIC
164164
# stdexec_version_config.hpp is generated by rapids' script
165165
FILE_SET version_config
166166
TYPE HEADERS
167-
BASE_DIRS ${CMAKE_BINARY_DIR}/include
167+
BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/include
168168
FILES
169-
${CMAKE_BINARY_DIR}/include/stdexec_version_config.hpp
169+
${CMAKE_CURRENT_BINARY_DIR}/include/stdexec_version_config.hpp
170170
)
171171
list(APPEND stdexec_export_targets stdexec)
172172

0 commit comments

Comments
 (0)