Add a cmake option to use yaml-cpp or not (#1538)

This commit is contained in:
An Tao 2023-03-20 19:02:13 +08:00 committed by GitHub
parent c63b021e7d
commit 21e207abe5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 8 deletions

View File

@ -19,6 +19,7 @@ option(COZ_PROFILING "Use coz for profiling" OFF)
option(BUILD_SHARED_LIBS "Build drogon as a shared lib" OFF)
option(BUILD_DOC "Build Doxygen documentation" OFF)
option(BUILD_BROTLI "Build Brotli" ON)
option(BUILD_YAML_CONFIG "Build yaml config" ON)
option(USE_SUBMODULE "Use trantor as a submodule" ON)
include(CMakeDependentOption)
@ -211,14 +212,18 @@ target_link_libraries(${PROJECT_NAME} PUBLIC Jsoncpp_lib)
list(APPEND INCLUDE_DIRS_FOR_DYNAMIC_VIEW ${JSONCPP_INCLUDE_DIRS})
# yamlcpp
find_package(yaml-cpp QUIET)
if(yaml-cpp_FOUND)
message(STATUS "yaml-cpp found")
target_link_libraries(${PROJECT_NAME} PUBLIC ${YAML_CPP_LIBRARIES})
target_compile_definitions(${PROJECT_NAME} PUBLIC HAS_YAML_CPP)
if(BUILD_YAML_CONFIG)
find_package(yaml-cpp QUIET)
if(yaml-cpp_FOUND)
message(STATUS "yaml-cpp found")
target_link_libraries(${PROJECT_NAME} PUBLIC ${YAML_CPP_LIBRARIES})
target_compile_definitions(${PROJECT_NAME} PUBLIC HAS_YAML_CPP)
else()
message(STATUS "yaml-cpp not used")
endif(yaml-cpp_FOUND)
else()
message(STATUS "yaml-cpp not used")
endif()
message(STATUS "yaml-cpp not used")
endif(BUILD_YAML_CONFIG)
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD"
AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD"

@ -1 +1 @@
Subproject commit b7ae847d5a7adba0e03b3aa232fc91c8f66c3be3
Subproject commit b5709ef4d43fa18b6d23090bbc54975fd1974c3d