Skip to content

Commit

Permalink
Merge pull request #17 from FNALssi/cmake-prefix-path-adjustment
Browse files Browse the repository at this point in the history
Adjust CMAKE_PREFIX_PATH environment variable for COMPILE_ONLY tests
  • Loading branch information
knoepfel authored Jan 12, 2024
2 parents 5611af8 + e5e6d3f commit b82d46f
Showing 1 changed file with 25 additions and 0 deletions.
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()

0 comments on commit b82d46f

Please sign in to comment.