Skip to content

Commit d7f5341

Browse files
committed
make building cmake tests optional and put pfunit dir as a cli option
1 parent 0843dbe commit d7f5341

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@ enable_testing()
2525
#--------------------------------------#
2626
# test-drive #
2727
#--------------------------------------#
28-
add_subdirectory("testing/test-drive")
28+
if (BUILD_TESTS MATCHES "ON")
29+
add_subdirectory("testing/test-drive")
30+
endif()
2931

3032
#--------------------------------------#
3133
# pFUnit #
3234
#--------------------------------------#
33-
add_subdirectory("testing/pFUnit")
35+
if (BUILD_TESTS MATCHES "ON")
36+
add_subdirectory("testing/pFUnit")
37+
endif()

build.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#!/bin/bash
22

33

4-
PFUNIT_INSTALLED_PATH="" # Path to pFUnit/installed directory
54

65
clean_build=false
76
build_cmake=false
87
build_fpm=false
8+
build_tests=true
9+
PFUNIT_INSTALLED_PATH="" # Path to pFUnit/installed directory
910
run_tests=false
1011

1112
help() {
@@ -15,6 +16,8 @@ help() {
1516
echo " -m Build via cmake."
1617
echo " -f Build via fpm."
1718
echo " -b Build with all build tools."
19+
echo " -s Skip building cmake tests"
20+
echo " -p Path to pFUnit/installed directory."
1821
echo " -t Run tests."
1922
exit 0
2023
}
@@ -27,7 +30,7 @@ then
2730
fi
2831

2932
# parse input arguments
30-
while getopts "hcmfbt" opt
33+
while getopts "hcmfbtp:s" opt
3134
do
3235
case ${opt} in
3336
h ) help;;
@@ -37,6 +40,8 @@ do
3740
b )
3841
build_cmake=true
3942
build_fpm=true;;
43+
s ) build_tests=false;;
44+
p ) PFUNIT_INSTALLED_PATH="${OPTARG}";;
4045
t ) run_tests=true;;
4146
\? ) echo "Invalid option: $OPTARG" >&2; exit 1;;
4247
esac
@@ -67,7 +72,14 @@ fi
6772
if [ "$build_cmake" == "true" ]
6873
then
6974
echo "Building using cmake"
70-
cmake -DCMAKE_PREFIX_PATH="$PFUNIT_INSTALLED_PATH" -B build-cmake
75+
if [ "$build_tests" == "true" ]
76+
then
77+
echo "Building tests"
78+
cmake -DCMAKE_PREFIX_PATH="$PFUNIT_INSTALLED_PATH" -DBUILD_TESTS=ON -B build-cmake
79+
else
80+
echo "Skipping tests"
81+
cmake -DBUILD_TESTS=OFF -B build-cmake
82+
fi
7183
cmake --build build-cmake
7284
fi
7385

0 commit comments

Comments
 (0)