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.

CMakeLists.txt 1.4KB

6 år sedan
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. cmake_minimum_required(VERSION 3.11)
  2. project(ScopeGuard VERSION 0.3.3)
  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)