diff --git a/.clang-format b/.clang-format index d6d46fb41..f3eac28a6 100644 --- a/.clang-format +++ b/.clang-format @@ -44,4 +44,3 @@ SpaceAfterControlStatementKeyword: true SpaceBeforeAssignmentOperators: true ContinuationIndentWidth: 4 ... - diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..f999431de --- /dev/null +++ b/.editorconfig @@ -0,0 +1,7 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/.github/dependabot.yml b/.github/dependabot.yml index dc2380610..2390d8c80 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,4 +8,3 @@ updates: github-actions: patterns: - "*" - diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 67b5e0c98..fdd4d5573 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,7 +42,7 @@ jobs: ${{format(matrix.generator != 'Default Generator' && '-G "{0}"' || '', matrix.generator)}} CMAKE_INSTALL_PREFIX: "${{ github.workspace }}/install-prefix" CMAKE_BUILD_TYPE: Debug - CMAKE_CXX_FLAGS_DEBUG: ${{ matrix.googletest == 'build' && '-g -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC' || '-g' }} + CMAKE_CXX_FLAGS_DEBUG: ${{ matrix.googletest == 'build' && '-g -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC' || '-g' }} runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/whitespace.yml b/.github/workflows/whitespace.yml new file mode 100644 index 000000000..dae063da1 --- /dev/null +++ b/.github/workflows/whitespace.yml @@ -0,0 +1,20 @@ +name: Whitespace + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + workflow_dispatch: + +permissions: read-all + +jobs: + whitespace: + name: Whitespace + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + + - name: Check whitespace + run: python3 util/check-whitespace.py diff --git a/CMakeLists.txt b/CMakeLists.txt index 03d9cdb44..336e7a30c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,7 @@ cmake_dependent_option(YAML_MSVC_SHARED_RT "CMAKE_SYSTEM_NAME MATCHES Windows" OFF) set(YAML_CPP_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/yaml-cpp" CACHE STRING "Path to install the CMake package to") - + if (YAML_CPP_FORMAT_SOURCE) find_program(YAML_CPP_CLANG_FORMAT_EXE NAMES clang-format) endif() diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 80b22fa3c..2031bdbe0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,6 +21,15 @@ Please verify the tests pass by configuring CMake with `-D YAML_CPP_BUILD_TESTS= If you are adding functionality, add tests accordingly. Note that the "spec tests" are reserved for examples directly from the YAML spec, so if you have new examples, put them in other test files. +# Whitespace + +Maintained text files must not contain trailing spaces or tabs. Each line +must end with an LF character, and non-empty files must have exactly one final +LF. The vendored GoogleTest sources are excluded from this check. + +You may run `python3 util/check-whitespace.py` to check whitespace before +submitting a pull request. + # Pull request process Every pull request undergoes a code review. Unfortunately, github's code review process isn't great, but we'll manage. During the code review, if you make changes, add new commits to the pull request for each change. Once the code review is complete, rebase against the master branch and squash into a single commit. diff --git a/README.md b/README.md index f8a92d7c7..0aa1b48d4 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ target_link_libraries(YOUR_LIBRARY PUBLIC yaml-cpp::yaml-cpp) # The library or e **The old API will stop receiving bugfixes in 2026.** The 0.3.x versions provide the old API, and 0.5.x and above all provide the new API. -# API Documentation +# API Documentation The autogenerated API reference is hosted on [CodeDocs](https://codedocs.xyz/jbeder/yaml-cpp/index.html) diff --git a/docs/Breaking-Changes.md b/docs/Breaking-Changes.md index 959adea22..1a1b4afb2 100644 --- a/docs/Breaking-Changes.md +++ b/docs/Breaking-Changes.md @@ -49,4 +49,4 @@ _none_ ## 0.2.5 ## -This wiki was started with v0.2.5. \ No newline at end of file +This wiki was started with v0.2.5. diff --git a/docs/How-To-Emit-YAML.md b/docs/How-To-Emit-YAML.md index 6e6f9f58e..f3ea67e47 100644 --- a/docs/How-To-Emit-YAML.md +++ b/docs/How-To-Emit-YAML.md @@ -13,7 +13,7 @@ int main() { YAML::Emitter out; out << "Hello, World!"; - + std::cout << "Here's the output YAML:\n" << out.c_str(); // prints "Hello, World!" return 0; } diff --git a/docs/How-To-Parse-A-Document-(Old-API).md b/docs/How-To-Parse-A-Document-(Old-API).md index 82fac718a..394548a1d 100644 --- a/docs/How-To-Parse-A-Document-(Old-API).md +++ b/docs/How-To-Parse-A-Document-(Old-API).md @@ -262,4 +262,4 @@ This is intended behavior. If you want to copy a node, use the `Clone` function: std::auto_ptr pCopy = myOtherNode.Clone(); ``` -The intent is that if you'd like to keep a `YAML::Node` around for longer than the document will stay in scope, you can clone it and store it as long as you like. \ No newline at end of file +The intent is that if you'd like to keep a `YAML::Node` around for longer than the document will stay in scope, you can clone it and store it as long as you like. diff --git a/docs/Strings.md b/docs/Strings.md index f2328a1b6..267b957e7 100644 --- a/docs/Strings.md +++ b/docs/Strings.md @@ -15,4 +15,4 @@ For convenience, Richard Weeks has kindly provided a google gadget that converts ``` -``` \ No newline at end of file +``` diff --git a/docs/Tutorial.md b/docs/Tutorial.md index ec1c7cb31..5ebd42815 100644 --- a/docs/Tutorial.md +++ b/docs/Tutorial.md @@ -224,7 +224,7 @@ public: node["a"] = a; return node; } - + int a; }; @@ -252,7 +252,7 @@ public: // Implementation of convert::{encode,decode} for all classes derived from or being A namespace YAML { - template + template struct convert::value>::type> { static Node encode(const T &rhs) { Node node = rhs.emit(); @@ -274,4 +274,4 @@ B b = node.as(); b.a = 12; b.b = 42; node = b; -``` \ No newline at end of file +``` diff --git a/docs/_config.yml b/docs/_config.yml index c74188174..f980e760b 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1 +1 @@ -theme: jekyll-theme-slate \ No newline at end of file +theme: jekyll-theme-slate diff --git a/include/yaml-cpp/node/detail/iterator.h b/include/yaml-cpp/node/detail/iterator.h index 4feeacdbc..24866c2d8 100644 --- a/include/yaml-cpp/node/detail/iterator.h +++ b/include/yaml-cpp/node/detail/iterator.h @@ -78,7 +78,7 @@ class iterator_base { ++(*this); return iterator_pre; } - + iterator_base& operator--() { --m_iterator; return *this; diff --git a/include/yaml-cpp/node/detail/reverse_iterator.h b/include/yaml-cpp/node/detail/reverse_iterator.h index 24e5c0827..b8c87ae3c 100644 --- a/include/yaml-cpp/node/detail/reverse_iterator.h +++ b/include/yaml-cpp/node/detail/reverse_iterator.h @@ -39,7 +39,7 @@ class reverse_iterator_base { public: using iterator_type = Iter; - using iterator_category = typename std::iterator_traits::iterator_category; + using iterator_category = typename std::iterator_traits::iterator_category; using value_type = typename std::iterator_traits::value_type; using difference_type = typename std::iterator_traits::difference_type; using pointer = typename std::iterator_traits::pointer; @@ -53,7 +53,7 @@ class reverse_iterator_base { typename std::enable_if::value, enabler>::type = enabler()) : current(_other.current) {} - + reverse_iterator_base& operator++() { --current; return *this; @@ -64,7 +64,7 @@ class reverse_iterator_base { ++(*this); return iterator_pre; } - + reverse_iterator_base& operator--() { ++current; return *this; diff --git a/src/contrib/yaml-cpp.natvis b/src/contrib/yaml-cpp.natvis index d5c222be5..cfc3dcc03 100644 --- a/src/contrib/yaml-cpp.natvis +++ b/src/contrib/yaml-cpp.natvis @@ -1,32 +1,32 @@ - - - - - {{invalid}} - {{pNode==nullptr}} - {{ {*m_pNode} }} - - m_pNode->m_pRef._Ptr->m_pData._Ptr->m_scalar - m_pNode->m_pRef._Ptr->m_pData._Ptr->m_sequence - m_pNode->m_pRef._Ptr->m_pData._Ptr->m_map - m_pNode->m_pRef._Ptr->m_pData._Ptr - - - - - {{node:pRef==nullptr}} - {{node:pRef->pData==nullptr}} - {{undefined}} - {{{m_pRef._Ptr->m_pData._Ptr->m_scalar}}} - {{ Map {m_pRef._Ptr->m_pData._Ptr->m_map}}} - {{ Seq {m_pRef._Ptr->m_pData._Ptr->m_sequence}}} - {{{m_pRef._Ptr->m_pData._Ptr->m_type}}} - - m_pRef._Ptr->m_pData._Ptr->m_scalar - m_pRef._Ptr->m_pData._Ptr->m_sequence - m_pRef._Ptr->m_pData._Ptr->m_map - m_pRef._Ptr->m_pData._Ptr - - - - + + + + + {{invalid}} + {{pNode==nullptr}} + {{ {*m_pNode} }} + + m_pNode->m_pRef._Ptr->m_pData._Ptr->m_scalar + m_pNode->m_pRef._Ptr->m_pData._Ptr->m_sequence + m_pNode->m_pRef._Ptr->m_pData._Ptr->m_map + m_pNode->m_pRef._Ptr->m_pData._Ptr + + + + + {{node:pRef==nullptr}} + {{node:pRef->pData==nullptr}} + {{undefined}} + {{{m_pRef._Ptr->m_pData._Ptr->m_scalar}}} + {{ Map {m_pRef._Ptr->m_pData._Ptr->m_map}}} + {{ Seq {m_pRef._Ptr->m_pData._Ptr->m_sequence}}} + {{{m_pRef._Ptr->m_pData._Ptr->m_type}}} + + m_pRef._Ptr->m_pData._Ptr->m_scalar + m_pRef._Ptr->m_pData._Ptr->m_sequence + m_pRef._Ptr->m_pData._Ptr->m_map + m_pRef._Ptr->m_pData._Ptr + + + + diff --git a/src/contrib/yaml-cpp.natvis.md b/src/contrib/yaml-cpp.natvis.md index f1d68a86c..2a0a3003d 100644 --- a/src/contrib/yaml-cpp.natvis.md +++ b/src/contrib/yaml-cpp.natvis.md @@ -1,9 +1,8 @@ -# MSVC debugger visualizer for YAML::Node - -## How to use -Add yaml-cpp.natvis to your Visual C++ project like any other source file. It will be included in the debug information, and improve debugger display on YAML::Node and contained types. - -## Compatibility and Troubleshooting - -This has been tested for MSVC 2017. It is expected to be compatible with VS 2015 and VS 2019. If you have any problems, you can open an issue here: https://github.com/peterchen-cp/yaml-cpp-natvis - +# MSVC debugger visualizer for YAML::Node + +## How to use +Add yaml-cpp.natvis to your Visual C++ project like any other source file. It will be included in the debug information, and improve debugger display on YAML::Node and contained types. + +## Compatibility and Troubleshooting + +This has been tested for MSVC 2017. It is expected to be compatible with VS 2015 and VS 2019. If you have any problems, you can open an issue here: https://github.com/peterchen-cp/yaml-cpp-natvis diff --git a/src/emitter.cpp b/src/emitter.cpp index e57ee4684..bcae0bcd8 100644 --- a/src/emitter.cpp +++ b/src/emitter.cpp @@ -983,13 +983,13 @@ Emitter& Emitter::Write(const Binary& binary) { if (!good()) return *this; - const StringFormat::value strFormat = + const StringFormat::value strFormat = Utils::ComputeBinaryFormat(binary, m_pState->GetStringFormat(), m_pState->CurGroupFlowType()); - if (strFormat == StringFormat::Literal) + if (strFormat == StringFormat::Literal) m_pState->SetMapKeyFormat(YAML::LongKey, FmtScope::Local); - + PrepareNode(EmitterNodeType::Scalar); switch (strFormat) { @@ -1004,8 +1004,8 @@ Emitter& Emitter::Write(const Binary& binary) { Utils::WriteBinary(m_stream, binary); break; case StringFormat::Literal: - Utils::WriteLiteralBinary(m_stream, binary, - m_pState->CurIndent() + m_pState->GetIndent(), + Utils::WriteLiteralBinary(m_stream, binary, + m_pState->CurIndent() + m_pState->GetIndent(), m_pState->GetWrap()); break; } diff --git a/src/emitterutils.cpp b/src/emitterutils.cpp index 29fcb93f6..55e1d1e46 100644 --- a/src/emitterutils.cpp +++ b/src/emitterutils.cpp @@ -305,7 +305,7 @@ StringFormat::value ComputeBinaryFormat(const Binary &bin, switch (strFormat) { case Auto: if (bin.size() > 0u) { - return StringFormat::Plain; + return StringFormat::Plain; } return StringFormat::DoubleQuoted; case SingleQuoted: diff --git a/src/scanner.cpp b/src/scanner.cpp index f71e72964..6800a8abd 100644 --- a/src/scanner.cpp +++ b/src/scanner.cpp @@ -181,7 +181,7 @@ void Scanner::ScanNextToken() { // special scalars if (InBlockContext() && (INPUT.peek() == Keys::LiteralScalar || INPUT.peek() == Keys::FoldedScalar)) { - // if we begin parsing a literal scalar with an unverified potential + // if we begin parsing a literal scalar with an unverified potential // simple key pushed, that may be a tag to the literal scalar, and // should be removed to avoid wrong indentation limit // eg: diff --git a/test/create-emitter-tests.py b/test/create-emitter-tests.py index 7295544f1..eb753791e 100644 --- a/test/create-emitter-tests.py +++ b/test/create-emitter-tests.py @@ -133,7 +133,7 @@ def expand(template): for car in expand(template[:1]): for cdr in expand(template[1:]): yield car + cdr - + def gen_events(): for template in gen_templates(): @@ -153,7 +153,7 @@ class Writer(object): def __init__(self, out): self.out = out self.indent = 0 - + def writeln(self, s): self.out.write('%s%s\n' % (' ' * self.indent, s)) @@ -166,14 +166,14 @@ def __init__(self, writer, name, indent): def __enter__(self): self.writer.writeln('%s {' % self.name) self.writer.indent += self.indent - + def __exit__(self, type, value, traceback): self.writer.indent -= self.indent self.writer.writeln('}') def create_emitter_tests(out): out = Writer(out) - + includes = [ 'handler_test.h', 'yaml-cpp/yaml.h', diff --git a/test/integration/emitter_test.cpp b/test/integration/emitter_test.cpp index ddf0a4068..b429d2318 100644 --- a/test/integration/emitter_test.cpp +++ b/test/integration/emitter_test.cpp @@ -1010,7 +1010,7 @@ TEST_F(EmitterTest, Unicode) { TEST_F(EmitterTest, DoubleQuotedUnicode) { out << DoubleQuoted << "\x24 \xC2\xA2 \xE2\x82\xAC \xF0\xA4\xAD\xA2"; - ExpectEmit("\"\x24 \xC2\xA2 \xE2\x82\xAC \xF0\xA4\xAD\xA2\""); + ExpectEmit("\"\x24 \xC2\xA2 \xE2\x82\xAC \xF0\xA4\xAD\xA2\""); } TEST_F(EmitterTest, EscapedJsonString) { @@ -1029,7 +1029,7 @@ TEST_F(EmitterTest, EscapedJsonString) { } TEST_F(EmitterTest, EscapedCharacters) { - out << BeginSeq + out << BeginSeq << '\x00' << '\x0C' << '\x0D' @@ -1606,7 +1606,7 @@ TEST_F(EmitterTest, NaN) { "bar: .nan"); } -TEST_F(EmitterTest, ComplexFlowSeqEmbeddingAMapWithNewLine) { +TEST_F(EmitterTest, ComplexFlowSeqEmbeddingAMapWithNewLine) { out << YAML::BeginMap; out << YAML::Key << "NodeA" << YAML::Value << YAML::BeginMap; diff --git a/test/integration/error_messages_test.cpp b/test/integration/error_messages_test.cpp index 64ab6b9e5..16d51c710 100644 --- a/test/integration/error_messages_test.cpp +++ b/test/integration/error_messages_test.cpp @@ -23,7 +23,7 @@ TEST(ErrorMessageTest, BadSubscriptErrorMessage) { // Test that printable key is part of error message EXPECT_THROW_EXCEPTION(YAML::BadSubscript, doc["first"]["second"]["fourth"], "operator[] call on a scalar (key: \"fourth\")"); - + EXPECT_THROW_EXCEPTION(YAML::BadSubscript, doc["first"]["second"][37], "operator[] call on a scalar (key: \"37\")"); @@ -47,15 +47,15 @@ TEST(ErrorMessageTest, Ex9_1_InvalidNodeErrorMessage) { // Test that printable key is part of error message EXPECT_THROW_EXCEPTION(YAML::InvalidNode, doc["first"]["fourth"].as(), "invalid node; first invalid key: \"fourth\""); - + EXPECT_THROW_EXCEPTION(YAML::InvalidNode, doc["first"][37].as(), "invalid node; first invalid key: \"37\""); - + // Non-printable key is not included in error message EXPECT_THROW_EXCEPTION(YAML::InvalidNode, doc["first"][std::vector()].as(), "invalid node; this may result from using a map " "iterator as a sequence iterator, or vice-versa"); } -} +} } diff --git a/test/node/node_test.cpp b/test/node/node_test.cpp index 75ac3db00..f3e718a46 100644 --- a/test/node/node_test.cpp +++ b/test/node/node_test.cpp @@ -427,14 +427,14 @@ TEST(NodeTest, ReverseIteratorOnConstUndefinedNode) { } EXPECT_EQ(0, count); } - + TEST(NodeTest, InteratorOnSequence) { Node node; node[0] = "a"; node[1] = "b"; node[2] = "c"; EXPECT_TRUE(node.IsSequence()); - + std::size_t count = 0; for (iterator it = node.begin(); it != node.end(); ++it) { @@ -443,14 +443,14 @@ TEST(NodeTest, InteratorOnSequence) { } EXPECT_EQ(3, count); } - + TEST(NodeTest, InteratorOnSequenceBackward) { Node node; node[0] = "a"; node[1] = "b"; node[2] = "c"; EXPECT_TRUE(node.IsSequence()); - + std::size_t count = 0; for (iterator it = node.end(); it != node.begin(); --it) { @@ -459,14 +459,14 @@ TEST(NodeTest, InteratorOnSequenceBackward) { } EXPECT_EQ(3, count); } - + TEST(NodeTest, ReverseInteratorOnSequence) { Node node; node[0] = "a"; node[1] = "b"; node[2] = "c"; EXPECT_TRUE(node.IsSequence()); - + std::size_t count = 0; for (reverse_iterator it = node.rbegin(); it != node.rend(); ++it) { @@ -475,14 +475,14 @@ TEST(NodeTest, ReverseInteratorOnSequence) { } EXPECT_EQ(3, count); } - + TEST(NodeTest, ConstInteratorOnSequence) { Node node; node[0] = "a"; node[1] = "b"; node[2] = "c"; EXPECT_TRUE(node.IsSequence()); - + std::size_t count = 0; for (const_iterator it = node.begin(); it != node.end(); ++it) { @@ -491,14 +491,14 @@ TEST(NodeTest, ConstInteratorOnSequence) { } EXPECT_EQ(3, count); } - + TEST(NodeTest, ConstReverseInteratorOnSequence) { Node node; node[0] = "a"; node[1] = "b"; node[2] = "c"; EXPECT_TRUE(node.IsSequence()); - + std::size_t count = 0; for (const_reverse_iterator it = node.rbegin(); it != node.rend(); ++it) { diff --git a/util/check-whitespace.py b/util/check-whitespace.py new file mode 100644 index 000000000..d8daf7358 --- /dev/null +++ b/util/check-whitespace.py @@ -0,0 +1,149 @@ +#!/usr/bin/env python3 +"""Check LF whitespace invariants for maintained, tracked text files.""" + +from __future__ import annotations + +import argparse +import logging +import re +import subprocess +from dataclasses import dataclass +from pathlib import Path + + +LOGGER = logging.getLogger(__name__) +EXCLUDED_PREFIXES = ("test/googletest-1.16.0/",) +TRAILING_WHITESPACE = re.compile(rb"[ \t]+(?=\r?\n|\r|$)") + + +@dataclass(frozen=True) +class Violation: + path: str + line: int | str + message: str + + +def parse_arguments() -> argparse.Namespace: + parser = argparse.ArgumentParser( + description="Check whitespace in tracked maintained text files." + ) + parser.add_argument( + "--root", + type=Path, + help="repository root (defaults to the root containing this script)", + ) + return parser.parse_args() + + +def repository_root(argument: Path | None) -> Path: + if argument is not None: + return argument.resolve() + return Path(__file__).resolve().parents[1] + + +def tracked_paths(root: Path) -> tuple[str, ...]: + result = subprocess.run( + ("git", "-C", root, "ls-files", "-z"), + check=True, + stdout=subprocess.PIPE, + ) + return tuple( + path.decode("utf-8") + for path in result.stdout.split(b"\0") + if path + ) + + +def is_excluded(path: str) -> bool: + return any( + path == prefix.rstrip("/") or path.startswith(prefix) + for prefix in EXCLUDED_PREFIXES + ) + + +def is_binary(content: bytes) -> bool: + return b"\0" in content + + +def line_number(content: bytes, position: int) -> int: + return content.count(b"\n", 0, position) + 1 + + +def check_content(path: str, content: bytes) -> tuple[Violation, ...]: + violations: list[Violation] = [] + + for match in TRAILING_WHITESPACE.finditer(content): + violations.append( + Violation( + path, + line_number(content, match.start()), + "trailing whitespace", + ) + ) + + if b"\r" in content: + violations.append( + Violation( + path, + "EOL", + "carriage return found; use LF line endings", + ) + ) + + if content: + if not content.endswith(b"\n"): + violations.append(Violation(path, "EOF", "missing final newline")) + elif content[:-1].endswith(b"\n"): + violations.append( + Violation(path, "EOF", "multiple final newlines") + ) + + return tuple(violations) + + +def check_file(root: Path, path: str) -> tuple[Violation, ...]: + if is_excluded(path): + return () + + file_path = root / path + if not file_path.is_file(): + return () + + content = file_path.read_bytes() + if is_binary(content): + return () + return check_content(path, content) + + +def main() -> int: + arguments = parse_arguments() + root = repository_root(arguments.root) + violations: list[Violation] = [] + + try: + paths = tracked_paths(root) + except (OSError, subprocess.CalledProcessError) as error: + LOGGER.error("unable to list tracked files in %s: %s", root, error) + return 2 + + for path in paths: + violations.extend(check_file(root, path)) + + for violation in violations: + LOGGER.error( + "%s:%s: %s", + violation.path, + violation.line, + violation.message, + ) + + if violations: + LOGGER.error("%d whitespace violation(s) found", len(violations)) + return 1 + LOGGER.info("Whitespace check passed") + return 0 + + +if __name__ == "__main__": + logging.basicConfig(format="%(message)s", level=logging.INFO) + raise SystemExit(main()) diff --git a/yaml-cpp-config.cmake.in b/yaml-cpp-config.cmake.in index 260ae00e0..cbbc773ea 100644 --- a/yaml-cpp-config.cmake.in +++ b/yaml-cpp-config.cmake.in @@ -21,10 +21,10 @@ set(YAML_CPP_LIBRARIES "@EXPORT_TARGETS@") # Protect against multiple inclusion, which would fail when already imported targets are added once more. if(NOT TARGET yaml-cpp) - add_library(yaml-cpp INTERFACE IMPORTED) - target_link_libraries(yaml-cpp INTERFACE yaml-cpp::yaml-cpp) + add_library(yaml-cpp INTERFACE IMPORTED) + target_link_libraries(yaml-cpp INTERFACE yaml-cpp::yaml-cpp) if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.17) - set_target_properties(yaml-cpp PROPERTIES + set_target_properties(yaml-cpp PROPERTIES DEPRECATION "The target yaml-cpp is deprecated and will be removed in version 0.10.0. Use the yaml-cpp::yaml-cpp target instead." ) endif()