cl3/CMakeLists.txt
Timofey Khoruzhii 644b555da9
Some checks failed
Clang-format Check / clang-format-check (push) Successful in 16s
Tests Check / test-check (push) Failing after 13s
fix CI
2023-05-09 01:49:06 +03:00

54 lines
1.6 KiB
CMake

# Set the minimum required version of CMake
cmake_minimum_required(VERSION 3.10)
project(Cl3 VERSION 1.0)
# Set the C++ standard to C++20
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Enable "compile_commands.json" output for use with various tools
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Add the Catch2 library
find_package(Catch2 REQUIRED)
find_package(yaml-cpp REQUIRED)
find_package(Lua 5.1 REQUIRED)
# Add all source files to a single target
file(GLOB_RECURSE SOURCES "src/*.cpp")
list(FILTER SOURCES EXCLUDE REGEX ".*main.cpp$")
add_executable(cl ${SOURCES} src/main.cpp)
target_include_directories(cl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include ${LUA_INCLUDE_DIR})
target_link_libraries(cl PRIVATE yaml-cpp tmuxub ${LUA_LIBRARIES})
target_compile_options(cl PRIVATE -g)
# Add all test files to a single target
file(GLOB_RECURSE TEST_SOURCES "tests/*.cpp")
add_executable(test_cl ${TEST_SOURCES} ${SOURCES})
target_link_libraries(test_cl PRIVATE Catch2::Catch2WithMain yaml-cpp ${LUA_LIBRARIES})
target_include_directories(test_cl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include ${CATCH_INCLUDE_DIRS} ${LUA_INCLUDE_DIR})
# Enable testing
enable_testing()
# Add the tests to the test suite
include(Catch)
catch_discover_tests(test_cl)
add_test(NAME TestCl COMMAND test_cl)
include(FetchContent)
FetchContent_Declare(
tmuxub
GIT_REPOSITORY http://git.timk.fun/onyad/tmuxub.git
GIT_TAG origin/main
)
FetchContent_MakeAvailable(tmuxub)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG origin/devel
)
FetchContent_MakeAvailable(Catch2)