Using conan package for doctest: https://conan.io/center/doctest?tab=useit
Create the *.cpp
files inside a source
directory as specified by CMakeLists.txt
.
# for Linux/macOS
cmake -S . -B build/debug -DCMAKE_BUILD_TYPE=Debug # -DENABLE_TESTING=OFF
cmake --build build/debug
# for Windows and Visual Studio 2017
cmake -S . -B build/debug -G "Visual Studio 15 2017" -DCMAKE_BUILD_TYPE=Debug # -DENABLE_TESTING=OFF
cmake --build build/debug --config Debug
Running things:
./build/debug/main
./build/debug/main_tests
./build/debug/main_tests -tc="01*"
./build/debug/main_tests -tc="01*" -sc="01*"
./build/debug/main_tests -tc="01*" -sc="01*" -s
(cd ./build/debug && ctest --verbose)
make test -C ./build/debug ARGS='--verbose'
cmake --build ./build/debug --target test -- ARGS="--verbose"
Explicitly calling conan for build (CMakeLists.txt call already calls it if it was not called once):
# for Linux/macOS
conan install . --install-folder build/debug --build=missing -pr:b default -s build_type=Debug
cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=build/debug/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug # -DENABLE_TESTING=OFF
cmake --build build
# for Windows and Visual Studio 2017
conan install . --output-folder build/debug --build=missing -pr:b default -s build_type=Debug
cmake -S . -B build/debug -G "Visual Studio 15 2017" -DCMAKE_TOOLCHAIN_FILE=build/debug/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug # -DENABLE_TESTING=OFF
cmake --build build/debug --config Debug