Make ctest work from build directory.

This commit is contained in:
tastytea 2021-06-03 15:53:43 +02:00
parent 85a00bb23c
commit bc34a3a515
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
4 changed files with 7 additions and 8 deletions

View File

@ -32,13 +32,13 @@ steps:
- cmake -G "Unix Makefiles" -DWITH_TESTS=YES ..
- make VERBOSE=1
- make install DESTDIR=install
- cd tests && ctest -V
- ctest -V
- cd ../../
- rm -rf build && mkdir -p build && cd build
- CXX="clang++" cmake -G "Unix Makefiles" -DWITH_TESTS=YES ..
- make VERBOSE=1
- make install DESTDIR=install
- cd tests && ctest -V
- ctest -V
volumes:
- name: debian-package-cache
path: /var/cache/apt/archives
@ -73,13 +73,13 @@ steps:
- cmake -G "Unix Makefiles" -DWITH_TESTS=YES ..
- make VERBOSE=1
- make install DESTDIR=install
- cd tests && ctest -V
- ctest -V
- cd ../../
- rm -rf build && mkdir -p build && cd build
- CXX="clang++" cmake -G "Unix Makefiles" -DWITH_TESTS=YES ..
- make VERBOSE=1
- make install DESTDIR=install
- cd tests && ctest -V
- ctest -V
volumes:
- name: debian-package-cache
path: /var/cache/apt/archives

View File

@ -46,6 +46,7 @@ find_package(nlohmann_json REQUIRED CONFIG)
add_subdirectory(src)
if(WITH_TESTS)
include(CTest)
add_subdirectory(tests)
endif()

View File

@ -132,8 +132,8 @@ cmake -S . -B build
cmake --build build --parallel $(nproc --ignore=1)
--------------------------------------------------------------------------------
To install, run `sudo cmake --install build`. To run the tests, run `cd
build/tests && ctest`.
To install, run `sudo cmake --install build`. To run the tests, run `ctest
--test-dir build`.
[TIP]
If you are using Debian or Ubuntu, or a distribution that is derived from these,

View File

@ -1,5 +1,3 @@
include(CTest)
file(GLOB sources_tests CONFIGURE_DEPENDS test_*.cpp)
file(COPY "test.zip" DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY "test.epub2" DESTINATION ${CMAKE_CURRENT_BINARY_DIR})