No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

58 líneas
1.4KB

  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. add_library(ScopeGuard INTERFACE)
  24. target_include_directories(ScopeGuard INTERFACE
  25. $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
  26. $<INSTALL_INTERFACE:include>
  27. )
  28. if( ENABLE_COMPAT_HEADER )
  29. configure_file(cmake/scope.in generated/scope COPYONLY)
  30. target_include_directories(ScopeGuard INTERFACE
  31. $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/generated>
  32. $<INSTALL_INTERFACE:include>
  33. )
  34. endif()
  35. if( UNITTEST )
  36. enable_testing()
  37. add_subdirectory("test")
  38. endif()
  39. include(Install)