Create target "format" by default only if yaml-cpp is main cmake project
This commit is contained in:
parent
db6deedcd3
commit
995da3f864
@ -30,6 +30,9 @@ cmake_dependent_option(YAML_CPP_INSTALL
|
||||
cmake_dependent_option(YAML_MSVC_SHARED_RT
|
||||
"MSVC: Build yaml-cpp with shared runtime libs (/MD)" ON
|
||||
"MSVC" OFF)
|
||||
cmake_dependent_option(YAML_CPP_ENABLE_FORMAT
|
||||
"Enable format target" ON
|
||||
"CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
|
||||
|
||||
set(yaml-cpp-type STATIC)
|
||||
set(yaml-cpp-label-postfix "static")
|
||||
@ -165,7 +168,7 @@ if(YAML_CPP_BUILD_TOOLS)
|
||||
add_subdirectory(util)
|
||||
endif()
|
||||
|
||||
if (YAML_CPP_CLANG_FORMAT_EXE)
|
||||
if (YAML_CPP_ENABLE_FORMAT AND YAML_CPP_CLANG_FORMAT_EXE)
|
||||
add_custom_target(format
|
||||
COMMAND clang-format --style=file -i $<TARGET_PROPERTY:yaml-cpp,SOURCES>
|
||||
COMMAND_EXPAND_LISTS
|
||||
|
||||
Loading…
Reference in New Issue
Block a user