This commit is contained in:
Olivier Le Doeuff 2022-03-02 16:47:05 +08:00 committed by GitHub
commit baec99b25f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,6 +30,9 @@ cmake_dependent_option(YAML_CPP_INSTALL
cmake_dependent_option(YAML_MSVC_SHARED_RT cmake_dependent_option(YAML_MSVC_SHARED_RT
"MSVC: Build yaml-cpp with shared runtime libs (/MD)" ON "MSVC: Build yaml-cpp with shared runtime libs (/MD)" ON
"MSVC" OFF) "MSVC" OFF)
cmake_dependent_option(YAML_CPP_ENABLE_FORMAT
"Enable format target" ON
"CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
if (YAML_BUILD_SHARED_LIBS) if (YAML_BUILD_SHARED_LIBS)
set(yaml-cpp-type SHARED) set(yaml-cpp-type SHARED)
@ -171,7 +174,7 @@ if(YAML_CPP_BUILD_TOOLS)
add_subdirectory(util) add_subdirectory(util)
endif() endif()
if (YAML_CPP_CLANG_FORMAT_EXE) if (YAML_CPP_ENABLE_FORMAT AND YAML_CPP_CLANG_FORMAT_EXE)
add_custom_target(format add_custom_target(format
COMMAND clang-format --style=file -i $<TARGET_PROPERTY:yaml-cpp,SOURCES> COMMAND clang-format --style=file -i $<TARGET_PROPERTY:yaml-cpp,SOURCES>
COMMAND_EXPAND_LISTS COMMAND_EXPAND_LISTS