Ticket #69343: yaml-cpp-update.diff

File yaml-cpp-update.diff, 5.9 KB (added by DanielO (Daniel O'Connor), 9 months ago)
  • devel/yaml-cpp/Portfile

    diff -Nur /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/devel/yaml-cpp/Portfile devel/yaml-cpp/Portfile
    old new  
    44PortGroup           cmake 1.1
    55PortGroup           github 1.0
    66
    7 github.setup        jbeder yaml-cpp 0.7.0 yaml-cpp-
     7github.setup        jbeder yaml-cpp 0.8.0
    88revision            1
    99
    1010categories          devel
     
    1414description         yaml-cpp is a YAML parser and emitter in C++ written around the YAML 1.2 spec
    1515long_description    {*}${description}
    1616
    17 checksums           rmd160  d574a07e1e12a590dc85e74ee58910c410c31313 \
    18                     sha256  2a5ed8e606edce269b5ffaed3f224ba7e4c46ee9163313ac103dc62a56330ff7 \
    19                     size    1033398
    20 
    21 patchfiles          patch-CMakeLists.txt.diff
     17checksums           rmd160  f2bb5d61707943c0b8b33044bbf05d2480d8ffb6 \
     18                    sha256  46c4f7f574c1ee0975406144624088f7ff775667a163591dbc942d315bf0c77a \
     19                    size    1017454
    2220
    2321compiler.cxx_standard   2011
    2422
  • devel/yaml-cpp/files/patch-CMakeLists.txt.diff

    diff -Nur /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/devel/yaml-cpp/files/patch-CMakeLists.txt.diff devel/yaml-cpp/files/patch-CMakeLists.txt.diff
    old new  
    1 From 4aad2b1666a4742743b04e765a34742512915674 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  CMakeLists.txt           | 29 ++++++++++++++++++-----------
    21  yaml-cpp-config.cmake.in | 10 ++++++----
    22  2 files changed, 24 insertions(+), 15 deletions(-)
    23 
    24 diff --git CMakeLists.txt CMakeLists.txt
    25 index 564b7c8d1..ccc1964ea 100644
    26 --- CMakeLists.txt
    27 +++ CMakeLists.txt
    28 @@ -133,10 +133,16 @@ set_target_properties(yaml-cpp PROPERTIES
    29    PROJECT_LABEL "yaml-cpp ${yaml-cpp-label-postfix}"
    30    DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
    31  
    32 +# FIXME(felix2012): A more common place for the cmake export would be
    33 +# `CMAKE_INSTALL_LIBDIR`, as e.g. done in ubuntu or in this project for GTest
    34 +set(CONFIG_EXPORT_DIR "${CMAKE_INSTALL_DATADIR}/cmake/yaml-cpp")
    35 +set(EXPORT_TARGETS yaml-cpp)
    36  configure_package_config_file(
    37    "${PROJECT_SOURCE_DIR}/yaml-cpp-config.cmake.in"
    38    "${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake"
    39 -  INSTALL_DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/yaml-cpp")
    40 +  INSTALL_DESTINATION "${CONFIG_EXPORT_DIR}"
    41 +  PATH_VARS CMAKE_INSTALL_INCLUDEDIR CONFIG_EXPORT_DIR)
    42 +unset(EXPORT_TARGETS)
    43  
    44  write_basic_package_version_file(
    45    "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake"
    46 @@ -145,30 +151,31 @@ write_basic_package_version_file(
    47  configure_file(yaml-cpp.pc.in yaml-cpp.pc @ONLY)
    48  
    49  if (YAML_CPP_INSTALL)
    50 -       install(TARGETS yaml-cpp
    51 +  install(TARGETS yaml-cpp
    52      EXPORT yaml-cpp-targets
    53      RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
    54      LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    55      ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
    56 -       install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
    57 +  install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
    58      DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
    59 -               FILES_MATCHING PATTERN "*.h")
    60 +                FILES_MATCHING PATTERN "*.h")
    61    install(EXPORT yaml-cpp-targets
    62 -    DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/yaml-cpp")
    63 -       install(FILES
    64 -               "${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake"
    65 -               "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake"
    66 -    DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/yaml-cpp")
    67 +    DESTINATION "${CONFIG_EXPORT_DIR}")
    68 +  install(FILES
    69 +      "${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake"
    70 +      "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake"
    71 +    DESTINATION "${CONFIG_EXPORT_DIR}")
    72    install(FILES "${PROJECT_BINARY_DIR}/yaml-cpp.pc"
    73      DESTINATION ${CMAKE_INSTALL_DATADIR}/pkgconfig)
    74  endif()
    75 +unset(CONFIG_EXPORT_DIR)
    76  
    77  if(YAML_CPP_BUILD_TESTS)
    78 -       add_subdirectory(test)
    79 +  add_subdirectory(test)
    80  endif()
    81  
    82  if(YAML_CPP_BUILD_TOOLS)
    83 -       add_subdirectory(util)
    84 +  add_subdirectory(util)
    85  endif()
    86  
    87  if (YAML_CPP_CLANG_FORMAT_EXE)
    88 diff --git yaml-cpp-config.cmake.in yaml-cpp-config.cmake.in
    89 index 7b41e3f30..a7ace3dc0 100644
    90 --- yaml-cpp-config.cmake.in
    91 +++ yaml-cpp-config.cmake.in
    92 @@ -3,12 +3,14 @@
    93  #  YAML_CPP_INCLUDE_DIR - include directory
    94  #  YAML_CPP_LIBRARIES    - libraries to link against
    95  
    96 -# Compute paths
    97 -get_filename_component(YAML_CPP_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
    98 -set(YAML_CPP_INCLUDE_DIR "@CONFIG_INCLUDE_DIRS@")
    99 +@PACKAGE_INIT@
    100 +
    101 +set_and_check(YAML_CPP_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
    102  
    103  # Our library dependencies (contains definitions for IMPORTED targets)
    104 -include("${YAML_CPP_CMAKE_DIR}/yaml-cpp-targets.cmake")
    105 +include(@PACKAGE_CONFIG_EXPORT_DIR@/yaml-cpp-targets.cmake)
    106  
    107  # These are IMPORTED targets created by yaml-cpp-targets.cmake
    108  set(YAML_CPP_LIBRARIES "@EXPORT_TARGETS@")
    109 +
    110 +check_required_components(@EXPORT_TARGETS@)