examples/ctest/CMakeLists.txt
raw| 1 | cmake_minimum_required(VERSION 3.5) |
| 2 | project(ctestexample C) |
| 3 | |
| 4 | include(GNUInstallDirs) |
| 5 | include(CTest) |
| 6 | |
| 7 | add_executable(ctestexample example.c) |
| 8 | install(TARGETS ctestexample |
| 9 | RUNTIME |
| 10 | DESTINATION "${CMAKE_INSTALL_BINDIR}" |
| 11 | ) |
| 12 | |
| 13 | add_test( |
| 14 | NAME PrintsHello |
| 15 | COMMAND |
| 16 | "${CMAKE_COMMAND}" |
| 17 | -DCTESTEXAMPLE_COMMAND:PATH=$<TARGET_FILE:ctestexample> |
| 18 | -P "${CMAKE_SOURCE_DIR}/test_hello.cmake" |
| 19 | ) |