diff --git a/nifti2/CMakeLists.txt b/nifti2/CMakeLists.txt index 6028291d..758df0b9 100644 --- a/nifti2/CMakeLists.txt +++ b/nifti2/CMakeLists.txt @@ -184,7 +184,7 @@ if(NIFTI_BUILD_TESTING AND NIFTI_BUILD_APPLICATIONS) if(TEST_INSTALL) add_test( NAME install_linking - COMMAND sh ${NIFTI_TEST_SCRIPT_DIR}/install_linking_test.sh ${CMAKE_MAKE_PROGRAM} + COMMAND sh ${NIFTI_TEST_SCRIPT_DIR}/install_linking_test.sh ${CMAKE_MAKE_PROGRAM} ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${PROJECT_BINARY_DIR} ) endif() endif() diff --git a/nifti2/nifti_regress_test/cmake_testscripts/install_linking_test.sh b/nifti2/nifti_regress_test/cmake_testscripts/install_linking_test.sh index dccf0fe9..89dcaeaf 100755 --- a/nifti2/nifti_regress_test/cmake_testscripts/install_linking_test.sh +++ b/nifti2/nifti_regress_test/cmake_testscripts/install_linking_test.sh @@ -10,6 +10,18 @@ else export BUILD_TOOL=$1 fi +# Where the project source lives. This used to be hard-coded as +# ../../nifti_clib relative to the build directory, which only resolved +# when the build tree happened to be a sibling of a source tree named +# exactly "nifti_clib" -- so the test failed for an in-tree build, for a +# build directory named anything else, and on CI. +if [ $# -lt 2 ] +then + echo Missing source directory + exit 1 +fi +SRC_DIR=$2 + # Set variables for local install export DESTDIR=installed export PATH="$PWD/$DESTDIR/usr/local/bin:$PATH" @@ -28,7 +40,7 @@ cd downstream_example cmake \ -G 'Unix Makefiles' \ -DCMAKE_MODULE_PATH=../installed/usr/local/share \ - ../../nifti_clib/real_easy/minimal_example_of_downstream_usage + "${SRC_DIR}/real_easy/minimal_example_of_downstream_usage" make echo Success