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.

CMakeLists.txt 1.6KB

4 lat temu
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. cmake_minimum_required(VERSION 3.11)
  2. project(ScopeGuard VERSION 0.3.5)
  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)