Skip to content

Commit a280da3

Browse files
libsyclinterface/CMakeLists.txt should use CMAKE_CURRENT_SOURCE_DIR (#744)
It should use CMAKE_CURRENT_SOURCE_DIR rather than CMAKE_SOURCE_DIR to work correctly if included as subdirectory from upper level.
1 parent 0e59572 commit a280da3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

libsyclinterface/CMakeLists.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ project(
66
)
77

88
# Load our CMake modules to search for DPCPP and Level Zero
9-
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
9+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/")
1010
find_package(Git REQUIRED)
1111

1212
option(DPCTL_DPCPP_HOME_DIR
@@ -69,8 +69,8 @@ if(DPCTL_ENABLE_LO_PROGRAM_CREATION)
6969
endif()
7070

7171
configure_file(
72-
${CMAKE_SOURCE_DIR}/include/Config/dpctl_config.h.in
73-
${CMAKE_SOURCE_DIR}/include/Config/dpctl_config.h
72+
${CMAKE_CURRENT_SOURCE_DIR}/include/Config/dpctl_config.h.in
73+
${CMAKE_CURRENT_SOURCE_DIR}/include/Config/dpctl_config.h
7474
)
7575

7676
# Set the C++ standard to C++17
@@ -158,8 +158,8 @@ add_library(DPCTLSyclInterface
158158

159159
target_include_directories(DPCTLSyclInterface
160160
PRIVATE
161-
${CMAKE_SOURCE_DIR}/include/
162-
${CMAKE_SOURCE_DIR}/helper/include/
161+
${CMAKE_CURRENT_SOURCE_DIR}/include/
162+
${CMAKE_CURRENT_SOURCE_DIR}/helper/include/
163163
${IntelSycl_SYCL_INCLUDE_DIR}
164164
)
165165

@@ -193,19 +193,19 @@ install(TARGETS
193193
)
194194

195195
# Install all headers
196-
file(GLOB HEADERS "${CMAKE_SOURCE_DIR}/include/*.h")
196+
file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h")
197197
foreach(HEADER ${HEADERS})
198198
install(FILES "${HEADER}" DESTINATION include)
199199
endforeach()
200200

201201
# Install all headers in include/Support
202-
file(GLOB HEADERS "${CMAKE_SOURCE_DIR}/include/Support/*.h")
202+
file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/include/Support/*.h")
203203
foreach(HEADER ${HEADERS})
204204
install(FILES "${HEADER}" DESTINATION include/Support)
205205
endforeach()
206206

207207
# Install all headers in include/Config
208-
file(GLOB HEADERS "${CMAKE_SOURCE_DIR}/include/Config/*.h")
208+
file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/include/Config/*.h")
209209
foreach(HEADER ${HEADERS})
210210
install(FILES "${HEADER}" DESTINATION include/Config)
211211
endforeach()

0 commit comments

Comments
 (0)