identiconpp is a library to generate identicons for C++.
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.

58 lines
1.5KB

  1. # Support version 3.6 and above, but use policy settings up to 3.14.
  2. # 3.6 is needed because of IMPORTED_TARGET in pkg_check_modules().
  3. cmake_minimum_required(VERSION 3.6...3.14)
  4. # Ranges are supported from 3.12, set policy to current for < 3.12.
  5. if(${CMAKE_VERSION} VERSION_LESS 3.12)
  6. cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
  7. endif()
  8. project(identiconpp
  9. VERSION 0.7.1
  10. LANGUAGES CXX)
  11. # DESCRIPTION was introduced in version 3.9.
  12. if(NOT (${CMAKE_VERSION} VERSION_LESS 3.9))
  13. set(PROJECT_DESCRIPTION
  14. "Library to generate identicons for C++.")
  15. endif()
  16. option(WITH_TESTS "Enable Tests" NO)
  17. option(BUILD_SHARED_LIBS "Build shared libraries." YES)
  18. set(CMAKE_CXX_STANDARD 14)
  19. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  20. set(CMAKE_CXX_EXTENSIONS OFF)
  21. set(DEBUG_CXXFLAGS
  22. "-Wall"
  23. "-Wextra"
  24. "-Wpedantic"
  25. "-ftrapv"
  26. "-fsanitize=undefined"
  27. "-g"
  28. "-Og"
  29. "-fno-omit-frame-pointer")
  30. set(DEBUG_LDFLAGS
  31. "-fsanitize=undefined")
  32. add_compile_options("$<$<CONFIG:Debug>:${DEBUG_CXXFLAGS}>")
  33. # add_link_options was introduced in version 3.13.
  34. if(${CMAKE_VERSION} VERSION_LESS 3.13)
  35. set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${DEBUG_LDFLAGS}")
  36. else()
  37. add_link_options("$<$<CONFIG:Debug>:${DEBUG_LDFLAGS}>")
  38. endif()
  39. if(CMAKE_BUILD_TYPE STREQUAL "Debug")
  40. add_definitions(-DDEBUG=1)
  41. endif()
  42. add_subdirectory(src)
  43. add_subdirectory(include)
  44. add_subdirectory(cmake)
  45. add_subdirectory(pkg-config)
  46. if(WITH_TESTS)
  47. add_subdirectory(tests)
  48. endif()
  49. include(packages.CMakeLists.txt)