Skip to content

Commit c8766f0

Browse files
committed
Pass STANDALONE_CMAKE_OPTIONS to standalone examples
Signed-off-by: Lukasz Dorau <[email protected]>
1 parent d270b52 commit c8766f0

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

test/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,13 +551,17 @@ if(LINUX
551551
endif()
552552

553553
if(EXAMPLES AND NOT UMF_DISABLE_HWLOC)
554+
set(STANDALONE_CMAKE_OPTIONS
555+
"-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
556+
)
554557
add_test(
555558
NAME umf-standalone_examples
556559
COMMAND
557560
${UMF_CMAKE_SOURCE_DIR}/test/test_examples.sh
558561
${UMF_CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}
559562
${CMAKE_CURRENT_BINARY_DIR}/umf_standalone_examples/install-dir
560-
"${CMAKE_INSTALL_PREFIX}" ${EXAMPLES}
563+
"${CMAKE_INSTALL_PREFIX}" "${STANDALONE_CMAKE_OPTIONS}"
564+
${EXAMPLES}
561565
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
562566
endif()
563567
endif()

test/test_examples.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ SOURCE_DIR=$1
99
BUILD_DIR=$2
1010
INSTALL_DIR=$3
1111
CMAKE_INSTALL_PREFIX=$4
12+
STANDALONE_CMAKE_OPTIONS=$5
1213

1314
echo "Running: $0 $*"
1415

1516
function print_usage() {
1617
echo "$(basename $0) - test all examples standalone"
17-
echo "Usage: $(basename $0) <source_dir> <build_dir> <install_dir> <CMAKE_INSTALL_PREFIX> <list-of-examples-to-run>"
18+
echo "Usage: $(basename $0) <source_dir> <build_dir> <install_dir> <CMAKE_INSTALL_PREFIX> <standalone_cmake_options> <list-of-examples-to-run>"
1819
}
1920

20-
if [ "$5" = "" ]; then
21+
if [ "$6" = "" ]; then
2122
print_usage
2223
echo -e "Error: too few arguments\n"
2324
exit 1
@@ -39,8 +40,9 @@ echo "SOURCE_DIR=$SOURCE_DIR"
3940
echo "BUILD_DIR=$BUILD_DIR"
4041
echo "CMAKE_INSTALL_PREFIX=$CMAKE_INSTALL_PREFIX"
4142
echo "INSTALL_DIR=$INSTALL_DIR"
43+
echo "STANDALONE_CMAKE_OPTIONS=$STANDALONE_CMAKE_OPTIONS"
4244

43-
shift 4
45+
shift 5
4446
EXAMPLES="$*"
4547
echo "Examples to run: $EXAMPLES"
4648
echo
@@ -70,7 +72,7 @@ for ex in $EXAMPLES; do
7072
rm -rf $BLD_DIR
7173
mkdir -p $BLD_DIR
7274
cd $BLD_DIR
73-
CMAKE_PREFIX_PATH="${INSTALL_DIR}/${CMAKE_INSTALL_PREFIX}" cmake $SRC_DIR
75+
CMAKE_PREFIX_PATH="${INSTALL_DIR}/${CMAKE_INSTALL_PREFIX}" cmake $SRC_DIR $STANDALONE_CMAKE_OPTIONS
7476
make -j$(nproc)
7577
ctest --output-on-failure
7678
set +x

0 commit comments

Comments
 (0)