Advertisement
Guest User

Untitled

a guest
Dec 11th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 2.44 KB | None | 0 0
  1. cmake_minimum_required(VERSION 3.4)
  2.  
  3. set(CMAKE_CXX_STANDARD 17)
  4. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  5.  
  6. option(BUILD_COVERAGE "Build coverage" OFF)
  7.  
  8. set(
  9.   HUNTER_CACHE_SERVERS
  10.   "https://github.com/bmstu-iu8-cpp-sem-3/hunter-cache"
  11.   CACHE STRING "Default cache server"
  12. )
  13.  
  14. include("tools/gate/cmake/HunterGate.cmake")
  15.  
  16. huntergate(
  17.   URL "https://github.com/ruslo/hunter/archive/v0.23.34.tar.gz"
  18.   SHA1 "70287b1ffa810ee4e952052a9adff9b4856d0d54"
  19. )
  20.  
  21. # TODO: rename project and delete this comment
  22. project(07)
  23. string(APPEND CMAKE_CXX_FLAGS " -pedantic -Werror -Wall -Wextra")
  24. string(APPEND CMAKE_CXX_FLAGS " -Wno-unused-command-line-argument")
  25. string(APPEND CMAKE_CXX_FLAGS " -Wshadow -Wnon-virtual-dtor")
  26.  
  27. hunter_add_package(GTest)
  28. hunter_add_package(Boost COMPONENTS regex system filesystem thread)
  29.  
  30. ### Find dependencies ###
  31. find_package(GTest CONFIG REQUIRED) # GTest::main
  32. find_package(Boost 1.40.0 CONFIG REQUIRED regex system filesystem thread)
  33.  
  34. IF(Boost_FOUND)
  35.   INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
  36.   LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
  37. ENDIF(Boost_FOUND)
  38.  
  39. SET(USED_LIBS ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${Boost_REGEX_LIBRARY})
  40.  
  41. # TODO: change 07 word to project name and delete this comment
  42. add_library(07 STATIC
  43.   # enum your files and delete this comment
  44.   ${CMAKE_CURRENT_SOURCE_DIR}/sources/source.cpp
  45. )
  46. add_executable(tests
  47.   # TODO: enum your files and delete this comment
  48.   ${CMAKE_CURRENT_SOURCE_DIR}/tests/test.cpp
  49. )
  50. add_executable(main
  51.         # TODO: enum your files and delete this comment
  52.         ${CMAKE_CURRENT_SOURCE_DIR}/sources/source.cpp
  53.         )
  54. # TODO: change 07 word to project name and delete this comment
  55. target_include_directories(07
  56.   PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
  57. )
  58. target_include_directories(tests
  59.   PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
  60. )
  61. # TODO: change 07 word to project name and delete this comment
  62. target_link_libraries(tests GTest::main 07)
  63. target_link_libraries(main PUBLIC ${USED_LIBS})
  64.  
  65. enable_testing()
  66. add_test(NAME unit_tests COMMAND tests)
  67.  
  68. if(BUILD_COVERAGE)
  69.   set(ENABLE_COVERAGE ON CACHE BOOL "Enable coverage build." FORCE)
  70.   list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
  71.   find_package(codecov)
  72.   # TODO: change 07 word to project name and delete this comment
  73.   add_coverage(07)
  74.   add_coverage(tests)
  75.   list(APPEND LCOV_REMOVE_PATTERNS "'${PROJECT_SOURCE_DIR}/tests/*'")
  76.   coverage_evaluate()
  77. endif()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement