init project
This commit is contained in:
commit
821ea7eed0
16 changed files with 950 additions and 0 deletions
46
CMakeLists.txt
Normal file
46
CMakeLists.txt
Normal file
|
@ -0,0 +1,46 @@
|
|||
# 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 https://gitlab.com/Onyad/tmuxub
|
||||
GIT_TAG origin/main
|
||||
)
|
||||
FetchContent_MakeAvailable(tmuxub)
|
Loading…
Add table
Add a link
Reference in a new issue