Skip to content

Commit 383efd6

Browse files
committed
Added target_compile_definitions for XEUS_SEARCH_PATH
1 parent ba37f4f commit 383efd6

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,8 @@ macro(xeus_cpp_create_target target_name linkage output_name)
377377
target_link_libraries(${target_name} PRIVATE ${CMAKE_THREAD_LIBS_INIT})
378378
endif()
379379

380+
target_compile_definitions(${target_name} PRIVATE "XEUS_SEARCH_PATH=\"$<JOIN:$<TARGET_PROPERTY:${target_name},INCLUDE_DIRECTORIES>,:>\"")
381+
380382
endmacro()
381383

382384
# xeus-cpp-headers

src/xinterpreter.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,19 @@ void* createInterpreter(const Args &ExtraArgs = {}) {
4646
ClangArgs.push_back(CxxInclude.c_str());
4747
}
4848
#endif
49+
50+
#ifdef XEUS_SEARCH_PATH
51+
std::string search_path = XEUS_SEARCH_PATH;
52+
std::istringstream iss(search_path);
53+
std::string path;
54+
while (std::getline(iss, path, ':')) {
55+
if (!path.empty()) {
56+
ClangArgs.push_back("-I");
57+
ClangArgs.push_back(path.c_str());
58+
}
59+
}
60+
#endif
61+
4962
ClangArgs.insert(ClangArgs.end(), ExtraArgs.begin(), ExtraArgs.end());
5063
// FIXME: We should process the kernel input options and conditionally pass
5164
// the gpu args here.

0 commit comments

Comments
 (0)