library/CMakeLists.txt

42 lines
1.3 KiB
CMake
Raw Normal View History

2019-10-21 17:19:26 +02:00
cmake_minimum_required(VERSION 3.7.2)
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 13:57:41 +02:00
project(library)
set(CMAKE_CXX_STANDARD 14)
2019-10-21 17:19:26 +02:00
# enable clang_tidy
set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=*")
set(CMAKE_CXX_CLANG_TIDY clang-tidy;-header-filter=.;-checks=*;)
2019-10-15 13:57:41 +02:00
file(GLOB_RECURSE SOURCES src/*.cpp)
file(GLOB_RECURSE HEADERS src/*.hpp)
file(GLOB_RECURSE TESTS test/*.cpp)
2019-10-15 13:57:41 +02:00
include_directories(src)
include_directories(test)
add_library(library ${SOURCES} ${HEADERS} src/FontType.cpp)
2019-10-15 13:57:41 +02:00
file(COPY "${CMAKE_SOURCE_DIR}/src/"
DESTINATION "${CMAKE_SOURCE_DIR}/include"
2019-10-15 13:57:41 +02:00
FILES_MATCHING
2019-11-13 13:44:23 +01:00
PATTERN *.hpp
2019-10-15 13:57:41 +02:00
)
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/lib)
enable_testing()
find_package(Catch2 REQUIRED)
add_executable(UnitTests test/test_main.cpp ${SOURCES} ${HEADERS} ${TESTS})
target_link_libraries(UnitTests Catch2::Catch2)
include(CTest)
include(Catch)
catch_discover_tests(UnitTests)