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
|
#!/bin/sh
set -e
cp tests/*.cpp "$AUTOPKGTEST_TMP"
cd "$AUTOPKGTEST_TMP"
cat > CMakeLists.txt << EOF
cmake_minimum_required(VERSION 3.14)
project(tl-optional-autopkgtest)
find_package(tl-optional REQUIRED)
find_package(Catch2 REQUIRED)
enable_testing()
file(GLOB test-sources CONFIGURE_DEPENDS *.cpp)
foreach (source IN LISTS test-sources)
get_filename_component(name "\${source}" NAME_WE)
set(test "\${PROJECT_NAME}-test-\${name}")
add_executable(\${test}
"\${source}")
target_link_libraries(\${test}
PRIVATE
Catch2::Catch2WithMain tl::optional)
add_test(NAME \${PROJECT_NAME}::\${name} COMMAND \${test})
endforeach()
EOF
mkdir _build
cd _build
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build . --verbose
ctest --output-on-failure
|