Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

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. -pedantic-errors
  18. -Wshadow
  19. -Wold-style-cast
  20. )
  21. set(CMAKE_CXX_STANDARD 17)
  22. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  23. set(CMAKE_CXX_EXTENSIONS OFF)
  24. include("${CMAKE_BINARY_DIR}/conan_paths.cmake" OPTIONAL)
  25. add_library(ScopeGuard INTERFACE)
  26. target_include_directories(ScopeGuard INTERFACE
  27. $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
  28. $<INSTALL_INTERFACE:include>
  29. )
  30. if( ENABLE_COMPAT_HEADER )
  31. configure_file(cmake/scope.in generated/scope COPYONLY)
  32. target_include_directories(ScopeGuard INTERFACE
  33. $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/generated>
  34. $<INSTALL_INTERFACE:include>
  35. )
  36. endif()
  37. if( UNITTEST )
  38. enable_testing()
  39. add_subdirectory("test")
  40. endif()
  41. include(Install)