There is no need to use the embedded gtest code copy in Linux systems, if they already provide the googletest framework system-wide.
Search for it, and fallback to the embedded one if the system one is not detected.
This patch has been also contributed by Simon Quigley <tsimonq2@debian.org>
* CMake: Add option to set the package install dir.
* CMake: Fix generated config.
- `YAML_CPP_SHARED_LIBS_BUILT` should not be set with a `PATH_VAR` as it
would always evaluate to true.
- `YAML_CPP_LIBRARIES` should used the exported target name including
the namespace, but `check_required_components` shouldn't.
- Use `CMAKE_CURRENT_LIST_DIR` to find the target file, instead of a
`PATH_VAR`. Package managers such as vcpkg move CMake configs after
installing.
* CI: Test the generated CMake package.
* CMake: Create add a deprecated yaml-cpp target.
This target is meant to provide compatibility with versions prior to
0.8.0.
* CMake: mark the yaml-cpp target as IMPORTED.
---------
Co-authored-by: Jesse Beder <jbeder+github@gmail.com>
add_custom_target uninstall causes a clash with the same target in rtmidi (https://github.com/thestk/rtmidi).
"add_custom_target cannot create target "uninstall" because another target with the same name already exists. The existing target is a custom target created in source directory"
Adds new option YAML_CPP_DISABLE_UNINSTALL
fixes#1151
---------
Co-authored-by: Megamouse <studienricky89@googlemail.de>
Co-authored-by: Jesse Beder <jbeder+github@gmail.com>
* Test(CMake) set NAME and COMMAND in add_test
* (CMake) add enable_testing()
* (CMake) move cmake_dependent_option up, before using them
* (CMake) use YAML_CPP_MAIN_PROJECT in cmake_dependent_option
* (CMake) log values regarding tests
* (CMake) always find CTest, but don't enable tests
* (CMAKE)(temp) fix logging
* (actions) set YAML_CPP_BUILD_TESTS for tests
* (actions) provide YAML_CPP_BUILD_TESTS to ctest
* (actions) set -DYAML_CPP_BUILD_TESTS at build
* (actions) don't fail false
* (actions) build tests in Test step
* (actions) run tests verbose
* (CMake) remove temp logging
* (actions) split building from running tests
* (actions) ctest Debug
* (actions) ctest Debug
* Remove enable_testing
This pull request adds two new exported variables to the CMake config:
YAML_CPP_LIBRARY_DIR - points to the directory containing the built library files
YAML_CPP_SHARED_LIBS_BUILT - boolean value, lets users know whether shared libraries were built or not
The option `YAML_CPP_BUILD_TESTS` currently enables or disables building of tests; but unconditionally the CMake file includes CTest; this PR makes that conditional on the option.
Also, there is no option for enabling formatting, but it does check whether it can find the `clang-format` executable; this PR adds an option (default to true) that skips even looking for the executable if disabled.
After configuring the file `yaml-cpp-config.cmake.in`, the result ends up with
empty variables. (see also the discussion in #774).
Rework this file and the call to `configure_package_config_file` according the
cmake documentation
(https://cmake.org/cmake/help/v3.22/module/CMakePackageConfigHelpers.html?highlight=configure_package_config#command:configure_package_config_file)
to overcome this issue and allow a simple `find_package` after install.
As there was some discussion about the place where to install the
`yaml-cpp-config.cmake` file, e.g. #1055, factor out the install location into
an extra variable to make it easier changing this location in the future.
Also untabify CMakeLists.txt in some places to align with the other code parts in this file.
* Export YAML::detail::node::m_amount
The internal header node/detail/node.h is included by public headers;
YAML::detail::node is implemented in the header itself, and thus it gets
inlined... except for its static m_amount class member, which is
instantiated in the library only. Right now all the symbols of yaml-cpp
are exported (nothing is hidden), so the linker will find node::m_amount
in the yaml-cpp library.
As solution/workaround, explicitly export YAML::detail::node::m_amount.
* CMake: use GenerateExportHeader
Make use of the GenerateExportHeader CMake module to generate the dll.h
header with export macros.
While the produced dll.h is different, the result should be the same,
i.e. nothing changes for yaml-cpp or its users.
* CMake: hide all the symbols by default
Hide all the symbols that are not explicitly exported with YAML_CPP_API.
This way the ABI will be way smaller, and only actually exposing the
public classes/functions.
Library debug postfix might not be suitable for cross platform project, and usually require extra work of link against prebuilt yaml-cpp.
Generally, Xcode project output library to these directories:
Debug
Release
Debug-iphoneos
Release-iphoneos
Debug-iphonesimulator
Release-iphonesimulator
Another Xcode project usually configured its build setting as follow, and expects library name to be same between Release and Debug
LIBRARY_SEARCH_PATHS=$(CONFIGURATION)$(EFFECT_PLATFORM_NAME)
OTHER_LDFLAGS= $(inherited) -lyaml-cpp
Remove 2.6-isms
Remove 2.8-isms
Bump CMake minimum version to 3.4
Disable some options when used as a subdirectory
Use `CONFIGURE_DEPENDS` with `file(GLOB)` when possible
Backport CMake 3.15's MSVC_RUNTIME_LIBRARY setting.
Set all compile options as generator expressions.
Set all find-package files to be installed to the correct file.
Remove `export(PACKAGE)`, as this has been deprecated.
Remove fat binary support
Remove manual setting of iPhone settings. These should be set by parent
projects.
Remove use of ExternalProject for a local use
Conditionally remove format target unless clang-format is found
* CMake: Prefix options with "YAML" and hide platform-specific options
When including yaml-cpp as a subproject, some option names can conflict with other projects.
(1) Make sure the yaml-cpp options are prefixed with YAML
(2) Hide platform-specific options when possible to avoid cluttering the cmake option list
* Update docs for change from BUILD_SHARED_LIBS to YAML_BUILD_SHARED_LIBS
Setting CMAKE_CXX_STANDARD and CMAKE_CXX_STANDARD_REQUIRED directly is problematic when including yaml-cpp as a subproject.
The proper way is to set these per-target.
* Add compilation flags: -Wshadow -Weffc++ -pedantic -pedantic-errors
* Delete implicit copy & move constructors & assignment operators
in classes with pointer data members.
* An exception to the above: Add default copy & move constructors &
assignment operators for the Binary class.
* Convert boolean RegEx operators to binary operators.
* Initialize all members in all classes in ctors.
* Let default ctor delegate to the converting ctor in
Binary and RegEx
* Don't change any tests except regex_test (as a result of the change
to binary operators).
Note: https://bugzilla.redhat.com/show_bug.cgi?id=1544675 makes
-Weffc++ report a false positive in "include/yaml-cpp/node/impl.h".
NDK now uses ninja for building but yaml-cpp would emit the “ninja: error: build.ninja:326: bad $-escape (literal $ must be written as $$)” error due to syntax error in the generated build.ninja file. Related issue: https://github.com/jbeder/yaml-cpp/issues/630
Let CMake handle the default optimizations for various configurations. We don't need to override them. In fact, overriding them makes it impossible for users to override them themselves.
Roll-forward of c90c08ccc9 "Revert "Improvements to CMake buildsystem (#563)""
NEW:
* Replace CMAKE_SOURCE_DIR with CMAKE_CURRENT_SOURCE_DIR
Fixes#612 when yaml-cpp is used as a git submodule.
ORIGINAL:
* Move enable_testing() into proper place
* Added CMake's checks for C++11 standards
Raised minimal version of CMake to 3.1, since on old systems there no
decent compilers that supports c++11.
Closes#377.
* Externalize googletest project
Externalize gtest to avoid installation, fixes#539.
* Remove defined cmake_policies
CMP0012 - OLD marked as deprecated for >=cmake-3.1 and will be removed
CMP0015 - does not affect to build process
CMP0042 - already NEW for >=cmake-3.1
Fixes#505
* Fix compiling in Windows MSVC
* Move enable_testing() into proper place
* Added CMake's checks for C++11 standards
Raised minimal version of CMake to 3.1, since on old systems there no
decent compilers that supports c++11.
Closes#377.
* Externalize googletest project
Externalize gtest to avoid installation, fixes#539.
* Remove defined cmake_policies
CMP0012 - OLD marked as deprecated for >=cmake-3.1 and will be removed
CMP0015 - does not affect to build process
CMP0042 - already NEW for >=cmake-3.1
Fixes#505
* Fix compiling in Windows MSVC