Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust CMAKE_PREFIX_PATH environment variable for COMPILE_ONLY tests #17

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Modules/CetTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,19 @@ test ${test} must be defined already to be specified as a fixture for ${CET_TARG
ENVIRONMENT_MODIFICATION "${CET_TEST_ENV_MODIFICATION}")
endif()
endif()
if (CET_COMPILE_ONLY)
_transitive_binary_directories(${CETMODULES_CURRENT_PROJECT_NAME})
list(JOIN TRANSITIVE_BINARY_DIRS ":" DIRS_FOR_PREFIX_PATH)
set(TEST_CMAKE_PREFIX_PATH "CMAKE_PREFIX_PATH=path_list_prepend:${DIRS_FOR_PREFIX_PATH}")
get_test_property(${target} ENVIRONMENT_MODIFICATION CET_TEST_ENV_TMP)
if (CET_TEST_ENV_TMP)
set_tests_properties(${target} PROPERTIES
ENVIRONMENT_MODIFICATION "${TEST_CMAKE_PREFIX_PATH};${CET_TEST_ENV_TMP}")
else()
set_tests_properties(${target} PROPERTIES
ENVIRONMENT_MODIFICATION "${TEST_CMAKE_PREFIX_PATH}")
endif()
endif()
if (CET_REF)
get_test_property(${target} REQUIRED_FILES REQUIRED_FILES_TMP)
if (REQUIRED_FILES_TMP)
Expand Down Expand Up @@ -1087,3 +1100,15 @@ function(_update_defined_test_groups)
FORCE
)
endfunction()

function(_transitive_binary_directories PKG)
set(TRANSITIVE_BINARY_DIRS_TMP ${${PKG}_BINARY_DIR})
foreach(DEP IN LISTS CETMODULES_FIND_DEPS_PNAMES_PROJECT_${PKG})
if (${DEP}_IN_TREE)
_transitive_binary_directories(${DEP})
list(APPEND TRANSITIVE_BINARY_DIRS_TMP ${TRANSITIVE_BINARY_DIRS})
endif()
endforeach()
list(REMOVE_DUPLICATES TRANSITIVE_BINARY_DIRS_TMP)
set(TRANSITIVE_BINARY_DIRS ${TRANSITIVE_BINARY_DIRS_TMP} PARENT_SCOPE)
endfunction()