Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cmake_minimum_required(VERSION 3.4)
- set(CMAKE_CXX_STANDARD 17)
- set(CMAKE_CXX_STANDARD_REQUIRED ON)
- option(BUILD_COVERAGE "Build coverage" OFF)
- set(
- HUNTER_CACHE_SERVERS
- "https://github.com/bmstu-iu8-cpp-sem-3/hunter-cache"
- CACHE STRING "Default cache server"
- )
- include("tools/gate/cmake/HunterGate.cmake")
- huntergate(
- URL "https://github.com/ruslo/hunter/archive/v0.23.34.tar.gz"
- SHA1 "70287b1ffa810ee4e952052a9adff9b4856d0d54"
- )
- # TODO: rename project and delete this comment
- project(07)
- string(APPEND CMAKE_CXX_FLAGS " -pedantic -Werror -Wall -Wextra")
- string(APPEND CMAKE_CXX_FLAGS " -Wno-unused-command-line-argument")
- string(APPEND CMAKE_CXX_FLAGS " -Wshadow -Wnon-virtual-dtor")
- hunter_add_package(GTest)
- hunter_add_package(Boost COMPONENTS regex system filesystem thread)
- ### Find dependencies ###
- find_package(GTest CONFIG REQUIRED) # GTest::main
- find_package(Boost 1.40.0 CONFIG REQUIRED regex system filesystem thread)
- IF(Boost_FOUND)
- INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
- LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
- ENDIF(Boost_FOUND)
- SET(USED_LIBS ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${Boost_REGEX_LIBRARY})
- # TODO: change 07 word to project name and delete this comment
- add_library(07 STATIC
- # enum your files and delete this comment
- ${CMAKE_CURRENT_SOURCE_DIR}/sources/source.cpp
- )
- add_executable(tests
- # TODO: enum your files and delete this comment
- ${CMAKE_CURRENT_SOURCE_DIR}/tests/test.cpp
- )
- add_executable(main
- # TODO: enum your files and delete this comment
- ${CMAKE_CURRENT_SOURCE_DIR}/sources/source.cpp
- )
- # TODO: change 07 word to project name and delete this comment
- target_include_directories(07
- PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
- )
- target_include_directories(tests
- PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
- )
- # TODO: change 07 word to project name and delete this comment
- target_link_libraries(tests GTest::main 07)
- target_link_libraries(main PUBLIC ${USED_LIBS})
- enable_testing()
- add_test(NAME unit_tests COMMAND tests)
- if(BUILD_COVERAGE)
- set(ENABLE_COVERAGE ON CACHE BOOL "Enable coverage build." FORCE)
- list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
- find_package(codecov)
- # TODO: change 07 word to project name and delete this comment
- add_coverage(07)
- add_coverage(tests)
- list(APPEND LCOV_REMOVE_PATTERNS "'${PROJECT_SOURCE_DIR}/tests/*'")
- coverage_evaluate()
- endif()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement