You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 7 години
преди 7 години
преди 7 години
преди 7 години
преди 7 години
преди 7 години
преди 7 години
преди 7 години
преди 7 години
преди 7 години
преди 7 години
преди 7 години
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. cmake_minimum_required(VERSION 3.2)
  2. project(ScopeGuard VERSION 0.1.2)
  3. message(STATUS "~~~ ${PROJECT_NAME} v${PROJECT_VERSION} ~~~")
  4. set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
  5. option(UNITTEST "Build Unit Tests" ON)
  6. option(COVERAGE "Enable Coverage" OFF)
  7. message(STATUS "Coverage : ${COVERAGE}")
  8. option(ENABLE_COMPAT_HEADER "Enable compatible header 'scope'" OFF)
  9. message(STATUS "Compatible Header : ${ENABLE_COMPAT_HEADER}")
  10. if( CMAKE_BUILD_TYPE )
  11. message(STATUS "Build Type : ${CMAKE_BUILD_TYPE}")
  12. else()
  13. message(STATUS "Build Type : None")
  14. endif()
  15. if( COVERAGE )
  16. include(Coverage)
  17. endif()
  18. add_compile_options(-Wall
  19. -Wextra
  20. -pedantic
  21. -Werror
  22. -Wshadow
  23. -Wold-style-cast
  24. )
  25. set(CMAKE_CXX_STANDARD 14)
  26. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  27. set(CMAKE_CXX_EXTENSIONS OFF)
  28. add_library(ScopeGuard INTERFACE)
  29. target_include_directories(ScopeGuard INTERFACE
  30. $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
  31. $<INSTALL_INTERFACE:include>
  32. )
  33. if( ENABLE_COMPAT_HEADER )
  34. configure_file(cmake/scope.in generated/scope COPYONLY)
  35. target_include_directories(ScopeGuard INTERFACE
  36. $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/generated>
  37. $<INSTALL_INTERFACE:include>
  38. )
  39. endif()
  40. if( UNITTEST )
  41. enable_testing()
  42. add_subdirectory("test")
  43. endif()
  44. include(Install)