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.

CMakeLists.txt 1.5KB

7 jaren geleden
5 jaren geleden
7 jaren geleden
7 jaren geleden
7 jaren geleden
7 jaren geleden
7 jaren geleden
7 jaren geleden
7 jaren geleden
7 jaren geleden
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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)