2019-10-15 14:00:06 +02:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
2019-10-16 15:44:13 +02:00
|
|
|
|
|
|
|
if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
|
|
|
|
message(FATAL_ERROR "In-source builds are disabled.
|
|
|
|
Please create a subfolder called build and use `cmake ..` inside it.
|
|
|
|
NOTE: cmake will now create CMakeCache.txt and CMakeFiles/*.
|
|
|
|
You must delete them, or cmake will refuse to work.")
|
|
|
|
endif()
|
|
|
|
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "bin" "doc" "CMakeFiles" "lib" "include")
|
|
|
|
|
2019-10-15 14:00:06 +02:00
|
|
|
project(TextRenderer)
|
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
|
|
|
|
|
|
|
file(GLOB_RECURSE SOURCES src/*.cpp)
|
|
|
|
file(GLOB_RECURSE HEADERS src/*.h)
|
2019-10-16 15:44:13 +02:00
|
|
|
file(GLOB_RECURSE TESTS test/*.cpp)
|
2019-10-15 14:00:06 +02:00
|
|
|
include_directories(src)
|
2019-10-16 15:44:13 +02:00
|
|
|
include_directories(test)
|
2019-10-15 14:00:06 +02:00
|
|
|
|
2019-10-16 15:44:13 +02:00
|
|
|
set(LIB_PATH "${CMAKE_SOURCE_DIR}/../library")
|
2019-10-15 14:00:06 +02:00
|
|
|
|
|
|
|
include_directories(${LIB_PATH}/include)
|
2019-10-16 15:44:13 +02:00
|
|
|
add_executable(TextRenderer ${SOURCES} ${HEADERS} main/main.cpp)
|
2019-10-15 14:00:06 +02:00
|
|
|
|
|
|
|
target_link_libraries(TextRenderer ${LIB_PATH}/lib/liblibrary.a)
|
|
|
|
|
2019-10-16 15:44:13 +02:00
|
|
|
|
|
|
|
enable_testing()
|
|
|
|
find_package(Catch2 REQUIRED)
|
|
|
|
add_executable(UnitTests ${SOURCES} ${HEADERS} ${TESTS})
|
|
|
|
target_link_libraries(UnitTests Catch2::Catch2)
|
|
|
|
|
|
|
|
include(CTest)
|
|
|
|
include(Catch)
|
|
|
|
catch_discover_tests(UnitTests)
|