CMakeLists.txt 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. cmake_minimum_required(VERSION 3.13)
  2. include(./ext/c4core/cmake/c4Project.cmake)
  3. project(ryml
  4. DESCRIPTION "Rapid YAML parsing and emitting"
  5. HOMEPAGE_URL "https://github.com/biojppm/rapidyaml"
  6. LANGUAGES CXX)
  7. include(./compat.cmake)
  8. c4_project(VERSION 0.4.0 STANDALONE
  9. AUTHOR "Joao Paulo Magalhaes <dev@jpmag.me>")
  10. #-------------------------------------------------------
  11. option(RYML_WITH_TAB_TOKENS "Enable parsing of tabs after ':' and '-'. This is costly and disabled by default." OFF)
  12. option(RYML_DEFAULT_CALLBACKS "Enable ryml's default implementation of callbacks: allocate(), free(), error()" ON)
  13. option(RYML_BUILD_TOOLS "build tools" OFF)
  14. option(RYML_BUILD_API "Enable API generation (python, etc)" OFF)
  15. option(RYML_DBG "Enable (very verbose) ryml debug prints." OFF)
  16. #-------------------------------------------------------
  17. c4_require_subproject(c4core INCORPORATE
  18. SUBDIRECTORY ${RYML_EXT_DIR}/c4core)
  19. c4_add_library(ryml
  20. SOURCES
  21. ryml.hpp
  22. ryml_std.hpp
  23. c4/yml/detail/checks.hpp
  24. c4/yml/detail/parser_dbg.hpp
  25. c4/yml/detail/print.hpp
  26. c4/yml/detail/stack.hpp
  27. c4/yml/common.hpp
  28. c4/yml/common.cpp
  29. c4/yml/emit.def.hpp
  30. c4/yml/emit.hpp
  31. c4/yml/export.hpp
  32. c4/yml/node.hpp
  33. c4/yml/node.cpp
  34. c4/yml/parse.hpp
  35. c4/yml/parse.cpp
  36. c4/yml/preprocess.hpp
  37. c4/yml/preprocess.cpp
  38. c4/yml/std/map.hpp
  39. c4/yml/std/std.hpp
  40. c4/yml/std/string.hpp
  41. c4/yml/std/vector.hpp
  42. c4/yml/tree.hpp
  43. c4/yml/tree.cpp
  44. c4/yml/writer.hpp
  45. c4/yml/yml.hpp
  46. ryml.natvis
  47. SOURCE_ROOT ${RYML_SRC_DIR}
  48. INC_DIRS
  49. $<BUILD_INTERFACE:${RYML_SRC_DIR}>
  50. $<INSTALL_INTERFACE:include>
  51. LIBS c4core
  52. INCORPORATE c4core
  53. )
  54. if(RYML_WITH_TAB_TOKENS)
  55. target_compile_definitions(ryml PUBLIC RYML_WITH_TAB_TOKENS)
  56. endif()
  57. if(NOT RYML_DEFAULT_CALLBACKS)
  58. target_compile_definitions(ryml PRIVATE RYML_NO_DEFAULT_CALLBACKS)
  59. endif()
  60. if(RYML_DBG)
  61. target_compile_definitions(ryml PRIVATE RYML_DBG)
  62. endif()
  63. #-------------------------------------------------------
  64. c4_install_target(ryml)
  65. c4_install_exports(DEPENDENCIES c4core)
  66. c4_pack_project()
  67. #-------------------------------------------------------
  68. # developer targets
  69. # extern libraries, used only for testing/benchmarking
  70. if(RYML_BUILD_TESTS OR RYML_BUILD_BENCHMARKS OR RYML_BUILD_TOOLS)
  71. include(ext/testbm.cmake)
  72. endif()
  73. if(RYML_BUILD_TOOLS)
  74. add_subdirectory(tools)
  75. endif()
  76. c4_add_dev_targets()
  77. add_custom_target(ryml-uninstall
  78. "${CMAKE_COMMAND}" -P "${PROJECT_SOURCE_DIR}/cmake/uninstall.cmake"
  79. )