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.

64 lines
1.6KB

  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. -pedantic-errors
  17. -Werror
  18. -Wshadow
  19. -Wold-style-cast
  20. -Wnull-dereference
  21. -Wnon-virtual-dtor
  22. -Woverloaded-virtual
  23. )
  24. set(CMAKE_CXX_STANDARD 17)
  25. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  26. set(CMAKE_CXX_EXTENSIONS OFF)
  27. include("${CMAKE_BINARY_DIR}/conan_paths.cmake" OPTIONAL)
  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)