From 21e207abe50bcb77451e94b9ed6f2d9b09a3f708 Mon Sep 17 00:00:00 2001 From: An Tao Date: Mon, 20 Mar 2023 19:02:13 +0800 Subject: [PATCH] Add a cmake option to use yaml-cpp or not (#1538) --- CMakeLists.txt | 19 ++++++++++++------- trantor | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 13134a98..b196fd97 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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" diff --git a/trantor b/trantor index b7ae847d..b5709ef4 160000 --- a/trantor +++ b/trantor @@ -1 +1 @@ -Subproject commit b7ae847d5a7adba0e03b3aa232fc91c8f66c3be3 +Subproject commit b5709ef4d43fa18b6d23090bbc54975fd1974c3d