diff options
| author | Jasper Orschulko <jasper@fancydomain.eu> | 2023-07-19 12:51:06 +0200 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2023-07-21 09:39:09 -0700 |
| commit | c575c5cb69686ff5764af79e5299c00b7bd6cb3c (patch) | |
| tree | ab31c5224c8a240aa7a5abf4b5d655b11722d640 | |
| parent | 3a91bdb9cb6e43b337343b40fb36d9ed0c7f288e (diff) | |
| download | meta-openembedded-c575c5cb69686ff5764af79e5299c00b7bd6cb3c.tar.gz | |
yaml-cpp: Fix cmake export
Signed-off-by: Jasper Orschulko <jasper@fancydomain.eu>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
| -rw-r--r-- | meta-oe/recipes-support/yaml-cpp/yaml-cpp/0001-Fix-CMake-export-files-1077.patch | 117 | ||||
| -rw-r--r-- | meta-oe/recipes-support/yaml-cpp/yaml-cpp_0.7.0.bb | 1 |
2 files changed, 118 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/yaml-cpp/yaml-cpp/0001-Fix-CMake-export-files-1077.patch b/meta-oe/recipes-support/yaml-cpp/yaml-cpp/0001-Fix-CMake-export-files-1077.patch new file mode 100644 index 0000000000..b6c4a3b883 --- /dev/null +++ b/meta-oe/recipes-support/yaml-cpp/yaml-cpp/0001-Fix-CMake-export-files-1077.patch | |||
| @@ -0,0 +1,117 @@ | |||
| 1 | From 3d436f6cfc2dfe52fc1533c01f57c25ae7ffac9c Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Felix Schwitzer <flx107809@gmail.com> | ||
| 3 | Date: Fri, 1 Apr 2022 05:26:47 +0200 | ||
| 4 | Subject: [PATCH] Fix CMake export files (#1077) | ||
| 5 | |||
| 6 | After configuring the file `yaml-cpp-config.cmake.in`, the result ends up with | ||
| 7 | empty variables. (see also the discussion in #774). | ||
| 8 | |||
| 9 | Rework this file and the call to `configure_package_config_file` according the | ||
| 10 | cmake documentation | ||
| 11 | (https://cmake.org/cmake/help/v3.22/module/CMakePackageConfigHelpers.html?highlight=configure_package_config#command:configure_package_config_file) | ||
| 12 | to overcome this issue and allow a simple `find_package` after install. | ||
| 13 | |||
| 14 | As there was some discussion about the place where to install the | ||
| 15 | `yaml-cpp-config.cmake` file, e.g. #1055, factor out the install location into | ||
| 16 | an extra variable to make it easier changing this location in the future. | ||
| 17 | |||
| 18 | Also untabify CMakeLists.txt in some places to align with the other code parts in this file. | ||
| 19 | |||
| 20 | Upstream-Status: Accepted [https://github.com/jbeder/yaml-cpp/pull/1077] | ||
| 21 | |||
| 22 | Signed-off-by: Jasper Orschulko <jasper@fancydomain.eu> | ||
| 23 | --- | ||
| 24 | CMakeLists.txt | 29 ++++++++++++++++++----------- | ||
| 25 | yaml-cpp-config.cmake.in | 10 ++++++---- | ||
| 26 | 2 files changed, 24 insertions(+), 15 deletions(-) | ||
| 27 | |||
| 28 | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
| 29 | index b230b9e..983d1a4 100644 | ||
| 30 | --- a/CMakeLists.txt | ||
| 31 | +++ b/CMakeLists.txt | ||
| 32 | @@ -127,10 +127,16 @@ set_target_properties(yaml-cpp PROPERTIES | ||
| 33 | PROJECT_LABEL "yaml-cpp ${yaml-cpp-label-postfix}" | ||
| 34 | DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}") | ||
| 35 | |||
| 36 | +# FIXME(felix2012): A more common place for the cmake export would be | ||
| 37 | +# `CMAKE_INSTALL_LIBDIR`, as e.g. done in ubuntu or in this project for GTest | ||
| 38 | +set(CONFIG_EXPORT_DIR "${CMAKE_INSTALL_DATADIR}/cmake/yaml-cpp") | ||
| 39 | +set(EXPORT_TARGETS yaml-cpp) | ||
| 40 | configure_package_config_file( | ||
| 41 | "${PROJECT_SOURCE_DIR}/yaml-cpp-config.cmake.in" | ||
| 42 | "${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake" | ||
| 43 | - INSTALL_DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/yaml-cpp") | ||
| 44 | + INSTALL_DESTINATION "${CONFIG_EXPORT_DIR}" | ||
| 45 | + PATH_VARS CMAKE_INSTALL_INCLUDEDIR CONFIG_EXPORT_DIR) | ||
| 46 | +unset(EXPORT_TARGETS) | ||
| 47 | |||
| 48 | write_basic_package_version_file( | ||
| 49 | "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake" | ||
| 50 | @@ -139,30 +145,31 @@ write_basic_package_version_file( | ||
| 51 | configure_file(yaml-cpp.pc.in yaml-cpp.pc @ONLY) | ||
| 52 | |||
| 53 | if (YAML_CPP_INSTALL) | ||
| 54 | - install(TARGETS yaml-cpp | ||
| 55 | + install(TARGETS yaml-cpp | ||
| 56 | EXPORT yaml-cpp-targets | ||
| 57 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
| 58 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
| 59 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
| 60 | - install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ | ||
| 61 | + install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ | ||
| 62 | DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
| 63 | - FILES_MATCHING PATTERN "*.h") | ||
| 64 | + FILES_MATCHING PATTERN "*.h") | ||
| 65 | install(EXPORT yaml-cpp-targets | ||
| 66 | - DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/yaml-cpp") | ||
| 67 | - install(FILES | ||
| 68 | - "${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake" | ||
| 69 | - "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake" | ||
| 70 | - DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/yaml-cpp") | ||
| 71 | + DESTINATION "${CONFIG_EXPORT_DIR}") | ||
| 72 | + install(FILES | ||
| 73 | + "${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake" | ||
| 74 | + "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake" | ||
| 75 | + DESTINATION "${CONFIG_EXPORT_DIR}") | ||
| 76 | install(FILES "${PROJECT_BINARY_DIR}/yaml-cpp.pc" | ||
| 77 | DESTINATION ${CMAKE_INSTALL_DATADIR}/pkgconfig) | ||
| 78 | endif() | ||
| 79 | +unset(CONFIG_EXPORT_DIR) | ||
| 80 | |||
| 81 | if(YAML_CPP_BUILD_TESTS) | ||
| 82 | - add_subdirectory(test) | ||
| 83 | + add_subdirectory(test) | ||
| 84 | endif() | ||
| 85 | |||
| 86 | if(YAML_CPP_BUILD_TOOLS) | ||
| 87 | - add_subdirectory(util) | ||
| 88 | + add_subdirectory(util) | ||
| 89 | endif() | ||
| 90 | |||
| 91 | if (YAML_CPP_CLANG_FORMAT_EXE) | ||
| 92 | diff --git a/yaml-cpp-config.cmake.in b/yaml-cpp-config.cmake.in | ||
| 93 | index 7b41e3f..a7ace3d 100644 | ||
| 94 | --- a/yaml-cpp-config.cmake.in | ||
| 95 | +++ b/yaml-cpp-config.cmake.in | ||
| 96 | @@ -3,12 +3,14 @@ | ||
| 97 | # YAML_CPP_INCLUDE_DIR - include directory | ||
| 98 | # YAML_CPP_LIBRARIES - libraries to link against | ||
| 99 | |||
| 100 | -# Compute paths | ||
| 101 | -get_filename_component(YAML_CPP_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) | ||
| 102 | -set(YAML_CPP_INCLUDE_DIR "@CONFIG_INCLUDE_DIRS@") | ||
| 103 | +@PACKAGE_INIT@ | ||
| 104 | + | ||
| 105 | +set_and_check(YAML_CPP_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@") | ||
| 106 | |||
| 107 | # Our library dependencies (contains definitions for IMPORTED targets) | ||
| 108 | -include("${YAML_CPP_CMAKE_DIR}/yaml-cpp-targets.cmake") | ||
| 109 | +include(@PACKAGE_CONFIG_EXPORT_DIR@/yaml-cpp-targets.cmake) | ||
| 110 | |||
| 111 | # These are IMPORTED targets created by yaml-cpp-targets.cmake | ||
| 112 | set(YAML_CPP_LIBRARIES "@EXPORT_TARGETS@") | ||
| 113 | + | ||
| 114 | +check_required_components(@EXPORT_TARGETS@) | ||
| 115 | -- | ||
| 116 | 2.39.2 | ||
| 117 | |||
diff --git a/meta-oe/recipes-support/yaml-cpp/yaml-cpp_0.7.0.bb b/meta-oe/recipes-support/yaml-cpp/yaml-cpp_0.7.0.bb index d3984abe8b..e04d4705a4 100644 --- a/meta-oe/recipes-support/yaml-cpp/yaml-cpp_0.7.0.bb +++ b/meta-oe/recipes-support/yaml-cpp/yaml-cpp_0.7.0.bb | |||
| @@ -8,6 +8,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=6a8aaf0595c2efc1a9c2e0913e9c1a2c" | |||
| 8 | # yaml-cpp releases are stored as archive files in github. | 8 | # yaml-cpp releases are stored as archive files in github. |
| 9 | # download the exact revision of release | 9 | # download the exact revision of release |
| 10 | SRC_URI = "git://github.com/jbeder/yaml-cpp.git;branch=master;protocol=https" | 10 | SRC_URI = "git://github.com/jbeder/yaml-cpp.git;branch=master;protocol=https" |
| 11 | SRC_URI += "file://0001-Fix-CMake-export-files-1077.patch" | ||
| 11 | SRCREV = "0579ae3d976091d7d664aa9d2527e0d0cff25763" | 12 | SRCREV = "0579ae3d976091d7d664aa9d2527e0d0cff25763" |
| 12 | 13 | ||
| 13 | S = "${WORKDIR}/git" | 14 | S = "${WORKDIR}/git" |
