Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

61 lines
1.5KB

  1. cmake_minimum_required(VERSION 3.11)
  2. project(ScopeGuard VERSION 0.3.4)
  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(ENABLE_COMPAT_HEADER "Enable compatible header 'scope'" OFF)
  7. message(STATUS "Compatible Header : ${ENABLE_COMPAT_HEADER}")
  8. if( CMAKE_BUILD_TYPE )
  9. message(STATUS "Build Type : ${CMAKE_BUILD_TYPE}")
  10. else()
  11. message(STATUS "Build Type : None")
  12. endif()
  13. add_compile_options(-Wall
  14. -Wextra
  15. -pedantic
  16. -Werror
  17. -Wshadow
  18. -Wold-style-cast
  19. )
  20. set(CMAKE_CXX_STANDARD 17)
  21. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  22. set(CMAKE_CXX_EXTENSIONS OFF)
  23. include("${CMAKE_BINARY_DIR}/conan_paths.cmake" OPTIONAL)
  24. add_library(ScopeGuard INTERFACE)
  25. target_include_directories(ScopeGuard INTERFACE
  26. $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
  27. $<INSTALL_INTERFACE:include>
  28. )
  29. if( ENABLE_COMPAT_HEADER )
  30. configure_file(cmake/scope.in generated/scope COPYONLY)
  31. target_include_directories(ScopeGuard INTERFACE
  32. $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/generated>
  33. $<INSTALL_INTERFACE:include>
  34. )
  35. endif()
  36. if( UNITTEST )
  37. enable_testing()
  38. add_subdirectory("test")
  39. endif()
  40. include(Install)