diff --git a/.drone.yml b/.drone.yml index c572a06..651f62e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 0162c46..e24de87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,7 @@ find_package(nlohmann_json REQUIRED CONFIG) add_subdirectory(src) if(WITH_TESTS) + include(CTest) add_subdirectory(tests) endif() diff --git a/README.adoc b/README.adoc index c42613c..2e6a72f 100644 --- a/README.adoc +++ b/README.adoc @@ -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, diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1ca00f1..2e2baaa 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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})