Skip to content

Commit 49efd65

Browse files
committed
Fix fetching the mp11 library and dependencies.
- Avoid FetchContent_MakeAvailable, as we just want to download sources, and not to import mp11's cmake files into build. - Fix dependencies to make sure mp11 preprocessed headers are produced when making higher-level targets Signed-off-by: Konstantin S Bobrovsky <[email protected]>
1 parent 197019c commit 49efd65

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

sycl/CMakeLists.txt

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,15 @@ if (NOT DEFINED BOOST_MP11_SOURCE_DIR)
142142
GIT_REPOSITORY ${BOOST_MP11_GIT_REPO}
143143
GIT_TAG ${BOOST_MP11_GIT_TAG}
144144
)
145-
FetchContent_MakeAvailable(boost_mp11)
146145
FetchContent_GetProperties(boost_mp11)
146+
147+
# Avoid FetchContent_MakeAvailable, as we just want to download sources,
148+
# and not to import mp11's cmake files into build.
149+
if(NOT boost_mp11_POPULATED)
150+
FetchContent_Populate(boost_mp11)
151+
set(boost_mp11_POPULATED TRUE)
152+
endif(NOT boost_mp11_POPULATED)
153+
147154
set(BOOST_MP11_SOURCE_DIR ${boost_mp11_SOURCE_DIR})
148155
message(STATUS "BOOST_MP11_SOURCE_DIR not set, downloading boost/mp11 headers from ${BOOST_MP11_GIT_REPO}")
149156
set(BOOST_MP11_SRC_PATH ${BOOST_MP11_GIT_REPO})
@@ -161,11 +168,15 @@ set(BOOST_MP11_DESTINATION_DIR ${SYCL_INCLUDE_BUILD_DIR}/sycl/detail/boost)
161168
string(REPLACE "${BOOST_MP11_SOURCE_DIR}/include/boost" "${BOOST_MP11_DESTINATION_DIR}"
162169
OUT_HEADERS_BOOST_MP11 "${HEADERS_BOOST_MP11}")
163170

171+
# The target which produces preprocessed boost/mp11 headers
172+
add_custom_target(boost_mp11-headers
173+
DEPENDS ${OUT_HEADERS_BOOST_MP11})
174+
164175
# Run preprocessing on each header, output result into
165176
# ${BOOST_MP11_DESTINATION_DIR}
166177
add_custom_command(
167178
OUTPUT ${OUT_HEADERS_BOOST_MP11}
168-
DEPENDS boost_mp11
179+
DEPENDS ${HEADERS_BOOST_MP11}
169180
COMMAND ${CMAKE_COMMAND}
170181
-DIN=${BOOST_MP11_SOURCE_DIR}/include/boost
171182
-DOUT=${BOOST_MP11_DESTINATION_DIR}
@@ -174,10 +185,6 @@ add_custom_command(
174185
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/pp_boost_mp11_headers.cmake
175186
COMMENT "Preprocessing boost/mp11 headers ${BOOST_MP11_SOURCE_DIR}/include/boost -> ${BOOST_MP11_DESTINATION_DIR}...")
176187

177-
# The target which produces preprocessed boost/mp11 headers
178-
add_custom_target(boost_mp11-headers
179-
DEPENDS ${OUT_HEADERS_BOOST_MP11})
180-
181188
# -------------- end boost/mp11 headers import and preprocessing
182189

183190
option(SYCL_BUILD_PI_CUDA
@@ -209,7 +216,8 @@ string(REPLACE "${sycl_inc_dir}/CL" "${SYCL_INCLUDE_BUILD_DIR}/sycl/CL"
209216
# Copy SYCL headers from sources to build directory
210217
add_custom_target(sycl-headers
211218
DEPENDS ${OUT_HEADERS_IN_SYCL_DIR}
212-
${OUT_HEADERS_IN_CL_DIR})
219+
${OUT_HEADERS_IN_CL_DIR}
220+
boost_mp11-headers)
213221

214222
add_custom_command(
215223
OUTPUT ${OUT_HEADERS_IN_SYCL_DIR}

0 commit comments

Comments
 (0)