aboutsummaryrefslogtreecommitdiff
path: root/test/postinstall/test_cmake.sh
blob: 15525593e19ec040f2fc953f1b889ba2d3507f7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh -e

# Post-install tests with CMake
#
# First required argument is the installed prefix, which
# is used to set CMAKE_PREFIX_PATH
# Second argument is either shared (default) or static
cd $(dirname $0)
. ./common.sh
main_setup $1 $2

echo "Running post-install tests with CMake (${BUILD_MODE})"


cmake_make_ctest(){
  rm -rf build
  mkdir build
  cd build

  cmake -DCMAKE_PREFIX_PATH=${prefix} -DUSE_PROJ_NAME=$1 ..
  VERBOSE=1 make
  ctest --output-on-failure

  cd ..
  rm -rf build
}

echo "Testing C app"
cd c_app
cmake_make_ctest PROJ
cmake_make_ctest PROJ4
cd ..

echo "Testing C++ app"
cd cpp_app
cmake_make_ctest PROJ
cmake_make_ctest PROJ4
cd ..

echo "Finished running post-install tests CMake (${BUILD_MODE})"