File tree Expand file tree Collapse file tree 4 files changed +38
-3
lines changed Expand file tree Collapse file tree 4 files changed +38
-3
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,8 @@ message(STATUS "Building xeus-cpp v${${PROJECT_NAME}_VERSION}")
5050# Build options
5151# =============
5252
53+ # Note: XEUS_SEARCH_PATH is now handled at runtime through environment variables
54+
5355option (XEUS_CPP_BUILD_STATIC "Build xeus-cpp static library" ON )
5456option (XEUS_CPP_BUILD_SHARED "Split xcpp build into executable and library" ON )
5557option (XEUS_CPP_BUILD_EXECUTABLE "Build the xcpp executable" ON )
@@ -404,7 +406,21 @@ endif()
404406# =====
405407
406408if (XEUS_CPP_BUILD_TESTS)
409+ enable_testing ()
407410 add_subdirectory (test )
411+
412+ # Find doctest package
413+ find_package (doctest REQUIRED)
414+
415+ # Test for non-standard include paths
416+ add_executable (test_include_paths test /test_include_paths.cpp)
417+ target_link_libraries (test_include_paths PRIVATE doctest::doctest)
418+ target_include_directories (test_include_paths PRIVATE
419+ ${CMAKE_SOURCE_DIR} /test /custom_includes
420+ ${DOCTEST_INCLUDE_DIR}
421+ )
422+ target_compile_definitions (test_include_paths PRIVATE DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN)
423+ add_test (NAME test_include_paths COMMAND test_include_paths)
408424endif ()
409425
410426# Installation
Original file line number Diff line number Diff line change @@ -360,10 +360,13 @@ __get_cxx_version ()
360360 // Add the standard include path
361361 Cpp::AddIncludePath ((xeus::prefix_path () + " /include/" ).c_str ());
362362
363- // Add non-standard include paths from XEUS_SEARCH_PATH
364- const char * non_standard_paths = XEUS_SEARCH_PATH;
363+ // Get include paths from environment variable
364+ const char * non_standard_paths = std::getenv (" XEUS_SEARCH_PATH" );
365+ if (!non_standard_paths) {
366+ non_standard_paths = " " ;
367+ }
365368
366- if (non_standard_paths && std::strlen (non_standard_paths) > 0 )
369+ if (std::strlen (non_standard_paths) > 0 )
367370 {
368371 // Split the paths by colon ':' and add each one
369372 std::istringstream stream (non_standard_paths);
Original file line number Diff line number Diff line change 1+ #ifndef TEST_HEADER_HPP
2+ #define TEST_HEADER_HPP
3+
4+ namespace test_ns {
5+ constexpr int test_value = 42 ;
6+ }
7+
8+ #endif
Original file line number Diff line number Diff line change 1+ #include < doctest/doctest.h>
2+ #include < string>
3+ #include " test_header.hpp"
4+
5+ TEST_CASE (" Test non-standard include paths" )
6+ {
7+ CHECK (test_ns::test_value == 42 );
8+ }
You can’t perform that action at this time.
0 commit comments