Fixes improperly generated cmake config files, RHBZ#1558637.
This commit is contained in:
parent
ac7b8cfffb
commit
5be39b2a2f
12
yaml-cpp-include_dir.patch
Normal file
12
yaml-cpp-include_dir.patch
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
--- a/CMakeLists.txt
|
||||||
|
+++ b/CMakeLists.txt
|
||||||
|
@@ -335,8 +335,7 @@ else()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
-file(RELATIVE_PATH REL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_CMAKE_DIR}" "${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_ROOT_DIR}")
|
||||||
|
-set(CONFIG_INCLUDE_DIRS "\${YAML_CPP_CMAKE_DIR}/${REL_INCLUDE_DIR}")
|
||||||
|
+set(CONFIG_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}")
|
||||||
|
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config.cmake.in
|
||||||
|
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${YAML_TARGET}-config.cmake" @ONLY)
|
@ -1,18 +1,6 @@
|
|||||||
--- a/CMakeLists.txt
|
--- a/CMakeLists.txt
|
||||||
+++ b/CMakeLists.txt
|
+++ b/CMakeLists.txt
|
||||||
@@ -47,6 +47,11 @@ option(YAML_CPP_BUILD_CONTRIB "Enable co
|
@@ -274,16 +274,20 @@ set(_INSTALL_DESTINATIONS
|
||||||
# see http://www.cmake.org/cmake/help/cmake2.6docs.html#variable:BUILD_SHARED_LIBS
|
|
||||||
# http://www.cmake.org/cmake/help/cmake2.6docs.html#command:add_library
|
|
||||||
option(BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
|
|
||||||
+option(BUILD_STATIC_LIBS "Build Static Libraries" ON)
|
|
||||||
+
|
|
||||||
+if(NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS)
|
|
||||||
+ message(FATAL_ERROR "At least one library must be built.")
|
|
||||||
+endif()
|
|
||||||
|
|
||||||
# --> Apple
|
|
||||||
option(APPLE_UNIVERSAL_BIN "Apple: Build universal binary" OFF)
|
|
||||||
@@ -274,16 +279,24 @@ set(_INSTALL_DESTINATIONS
|
|
||||||
###
|
###
|
||||||
### Library
|
### Library
|
||||||
###
|
###
|
||||||
@ -20,30 +8,26 @@
|
|||||||
-set_target_properties(yaml-cpp PROPERTIES
|
-set_target_properties(yaml-cpp PROPERTIES
|
||||||
- COMPILE_FLAGS "${yaml_c_flags} ${yaml_cxx_flags}"
|
- COMPILE_FLAGS "${yaml_c_flags} ${yaml_cxx_flags}"
|
||||||
-)
|
-)
|
||||||
|
-
|
||||||
|
-set_target_properties(yaml-cpp PROPERTIES
|
||||||
+if(BUILD_SHARED_LIBS)
|
+if(BUILD_SHARED_LIBS)
|
||||||
+ add_library(yaml-cpp SHARED ${library_sources})
|
+ add_library(yaml-cpp SHARED ${library_sources})
|
||||||
+ set_target_properties(yaml-cpp PROPERTIES
|
|
||||||
+ COMPILE_FLAGS "${yaml_c_flags} ${yaml_cxx_flags}"
|
|
||||||
+ )
|
|
||||||
|
|
||||||
-set_target_properties(yaml-cpp PROPERTIES
|
|
||||||
+ set_target_properties(yaml-cpp PROPERTIES
|
+ set_target_properties(yaml-cpp PROPERTIES
|
||||||
VERSION "${YAML_CPP_VERSION}"
|
VERSION "${YAML_CPP_VERSION}"
|
||||||
SOVERSION "${YAML_CPP_VERSION_MAJOR}.${YAML_CPP_VERSION_MINOR}"
|
SOVERSION "${YAML_CPP_VERSION_MAJOR}.${YAML_CPP_VERSION_MINOR}"
|
||||||
PROJECT_LABEL "yaml-cpp ${LABEL_SUFFIX}"
|
PROJECT_LABEL "yaml-cpp ${LABEL_SUFFIX}"
|
||||||
-)
|
|
||||||
+ )
|
|
||||||
+endif()
|
|
||||||
+if(BUILD_STATIC_LIBS)
|
|
||||||
+ add_library(yaml-cpp-static STATIC ${library_sources})
|
|
||||||
+ set_target_properties(yaml-cpp-static PROPERTIES
|
|
||||||
+ COMPILE_FLAGS "${yaml_c_flags} ${yaml_cxx_flags}"
|
+ COMPILE_FLAGS "${yaml_c_flags} ${yaml_cxx_flags}"
|
||||||
+ OUTPUT_NAME yaml-cpp)
|
)
|
||||||
|
+else()
|
||||||
|
+ add_library(yaml-cpp STATIC ${library_sources})
|
||||||
|
+ set_target_properties(yaml-cpp PROPERTIES
|
||||||
|
+ COMPILE_FLAGS "${yaml_c_flags} ${yaml_cxx_flags}"
|
||||||
|
+ )
|
||||||
+endif()
|
+endif()
|
||||||
|
|
||||||
if(IPHONE)
|
if(IPHONE)
|
||||||
set_target_properties(yaml-cpp PROPERTIES
|
set_target_properties(yaml-cpp PROPERTIES
|
||||||
@@ -303,48 +316,70 @@ if(MSVC)
|
@@ -303,48 +307,56 @@ if(MSVC)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -59,30 +43,20 @@
|
|||||||
- FILE "${PROJECT_BINARY_DIR}/yaml-cpp-targets.cmake")
|
- FILE "${PROJECT_BINARY_DIR}/yaml-cpp-targets.cmake")
|
||||||
-export(PACKAGE yaml-cpp)
|
-export(PACKAGE yaml-cpp)
|
||||||
-set(EXPORT_TARGETS yaml-cpp CACHE INTERNAL "export targets")
|
-set(EXPORT_TARGETS yaml-cpp CACHE INTERNAL "export targets")
|
||||||
-
|
|
||||||
-set(CONFIG_INCLUDE_DIRS "${YAML_CPP_SOURCE_DIR}/include")
|
|
||||||
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config.cmake.in
|
|
||||||
- "${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake" @ONLY)
|
|
||||||
+if(BUILD_SHARED_LIBS)
|
+if(BUILD_SHARED_LIBS)
|
||||||
+ install(TARGETS yaml-cpp EXPORT yaml-cpp-targets ${_INSTALL_DESTINATIONS})
|
+ set(YAML_TARGET "yaml-cpp")
|
||||||
+ list(APPEND YAML_TARGETS "yaml-cpp")
|
+else()
|
||||||
+ list(APPEND EXPORT_TARGETS "yaml-cpp-targets")
|
+ set(YAML_TARGET "yaml-cpp-static")
|
||||||
+endif()
|
+endif()
|
||||||
+if(BUILD_STATIC_LIBS)
|
|
||||||
+ install(TARGETS yaml-cpp-static EXPORT yaml-cpp-static-targets ${_INSTALL_DESTINATIONS})
|
+install(TARGETS yaml-cpp EXPORT ${YAML_TARGET}-targets ${_INSTALL_DESTINATIONS})
|
||||||
+ list(APPEND YAML_TARGETS "yaml-cpp-static")
|
+export(TARGETS yaml-cpp
|
||||||
+ list(APPEND EXPORT_TARGETS "yaml-cpp-static-targets")
|
|
||||||
+endif()
|
|
||||||
+
|
|
||||||
+foreach(YAML_TARGET ${YAML_TARGETS})
|
|
||||||
+ export(TARGETS ${YAML_TARGET}
|
|
||||||
+ FILE "${PROJECT_BINARY_DIR}/${YAML_TARGET}-targets.cmake")
|
+ FILE "${PROJECT_BINARY_DIR}/${YAML_TARGET}-targets.cmake")
|
||||||
+ export(PACKAGE yaml-cpp)
|
+set(EXPORT_TARGETS yaml-cpp CACHE INTERNAL "export targets")
|
||||||
+ set(EXPORT_TARGETS ${YAML_TARGET} CACHE INTERNAL "export targets")
|
set(CONFIG_INCLUDE_DIRS "${YAML_CPP_SOURCE_DIR}/include")
|
||||||
+ set(CONFIG_INCLUDE_DIRS "${YAML_CPP_SOURCE_DIR}/include")
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config.cmake.in
|
||||||
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config.cmake.in
|
- "${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake" @ONLY)
|
||||||
+ "${PROJECT_BINARY_DIR}/${YAML_TARGET}-config.cmake" @ONLY)
|
+ "${PROJECT_BINARY_DIR}/${YAML_TARGET}-config.cmake" @ONLY)
|
||||||
+endforeach()
|
|
||||||
|
|
||||||
+if(NOT INSTALL_CMAKE_DIR)
|
+if(NOT INSTALL_CMAKE_DIR)
|
||||||
if(WIN32 AND NOT CYGWIN)
|
if(WIN32 AND NOT CYGWIN)
|
||||||
@ -98,41 +72,33 @@
|
|||||||
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config.cmake.in
|
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config.cmake.in
|
||||||
- "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/yaml-cpp-config.cmake" @ONLY)
|
- "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/yaml-cpp-config.cmake" @ONLY)
|
||||||
|
|
||||||
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config-version.cmake.in
|
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config.cmake.in
|
||||||
|
+ "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${YAML_TARGET}-config.cmake" @ONLY)
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config-version.cmake.in
|
||||||
- "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake" @ONLY)
|
- "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake" @ONLY)
|
||||||
-
|
-
|
||||||
-install(FILES
|
+ "${PROJECT_BINARY_DIR}/${YAML_TARGET}-config-version.cmake" @ONLY)
|
||||||
|
install(FILES
|
||||||
- "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/yaml-cpp-config.cmake"
|
- "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/yaml-cpp-config.cmake"
|
||||||
- "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake"
|
- "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake"
|
||||||
- DESTINATION "${INSTALL_CMAKE_DIR}" COMPONENT dev)
|
- DESTINATION "${INSTALL_CMAKE_DIR}" COMPONENT dev)
|
||||||
-install(EXPORT yaml-cpp-targets DESTINATION ${INSTALL_CMAKE_DIR})
|
-install(EXPORT yaml-cpp-targets DESTINATION ${INSTALL_CMAKE_DIR})
|
||||||
+foreach(YAML_TARGET ${YAML_TARGETS})
|
|
||||||
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config.cmake.in
|
|
||||||
+ "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${YAML_TARGET}-config.cmake" @ONLY)
|
|
||||||
+
|
|
||||||
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config-version.cmake.in
|
|
||||||
+ "${PROJECT_BINARY_DIR}/${YAML_TARGET}-config-version.cmake" @ONLY)
|
|
||||||
+
|
|
||||||
+ install(FILES
|
|
||||||
+ "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${YAML_TARGET}-config.cmake"
|
+ "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${YAML_TARGET}-config.cmake"
|
||||||
+ "${PROJECT_BINARY_DIR}/${YAML_TARGET}-config-version.cmake"
|
+ "${PROJECT_BINARY_DIR}/${YAML_TARGET}-config-version.cmake"
|
||||||
+ DESTINATION "${INSTALL_CMAKE_DIR}${YAML_TARGET}" COMPONENT dev)
|
+ DESTINATION "${INSTALL_CMAKE_DIR}${YAML_TARGET}" COMPONENT dev)
|
||||||
+install(EXPORT ${YAML_TARGET}-targets DESTINATION ${INSTALL_CMAKE_DIR}${YAML_TARGET})
|
+install(EXPORT ${YAML_TARGET}-targets DESTINATION ${INSTALL_CMAKE_DIR}${YAML_TARGET})
|
||||||
+endforeach()
|
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
- set(PC_FILE ${CMAKE_BINARY_DIR}/yaml-cpp.pc)
|
- set(PC_FILE ${CMAKE_BINARY_DIR}/yaml-cpp.pc)
|
||||||
|
- configure_file("yaml-cpp.pc.cmake" ${PC_FILE} @ONLY)
|
||||||
|
- install(FILES ${PC_FILE} DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
|
||||||
+if(BUILD_SHARED_LIBS)
|
+if(BUILD_SHARED_LIBS)
|
||||||
+ list(APPEND PC_FILES ${CMAKE_BINARY_DIR}/yaml-cpp.pc)
|
+ set(PC_FILE ${CMAKE_BINARY_DIR}/yaml-cpp.pc)
|
||||||
+endif()
|
+else()
|
||||||
+if(BUILD_STATIC_LIBS)
|
+ set(PC_FILE ${CMAKE_BINARY_DIR}/yaml-cpp-static.pc)
|
||||||
+ list(APPEND PC_FILES ${CMAKE_BINARY_DIR}/yaml-cpp-static.pc)
|
endif()
|
||||||
+endif()
|
+configure_file("yaml-cpp.pc.cmake" ${PC_FILE} @ONLY)
|
||||||
+foreach(PC_FILE ${PC_FILES})
|
+install(FILES ${PC_FILE} DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
|
||||||
configure_file("yaml-cpp.pc.cmake" ${PC_FILE} @ONLY)
|
|
||||||
install(FILES ${PC_FILE} DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
|
|
||||||
-endif()
|
|
||||||
+endforeach()
|
|
||||||
+endif(UNIX)
|
+endif(UNIX)
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Name: yaml-cpp
|
Name: yaml-cpp
|
||||||
Version: 0.6.1
|
Version: 0.6.1
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Summary: A YAML parser and emitter for C++
|
Summary: A YAML parser and emitter for C++
|
||||||
Group: Development/Libraries
|
Group: Development/Libraries
|
||||||
License: MIT
|
License: MIT
|
||||||
@ -10,6 +10,7 @@ URL: https://github.com/jbeder/yaml-cpp
|
|||||||
Source0: https://github.com/jbeder/yaml-cpp/archive/%{name}-%{version}.tar.gz
|
Source0: https://github.com/jbeder/yaml-cpp/archive/%{name}-%{version}.tar.gz
|
||||||
|
|
||||||
Patch0: yaml-cpp-static.patch
|
Patch0: yaml-cpp-static.patch
|
||||||
|
Patch1: yaml-cpp-include_dir.patch
|
||||||
|
|
||||||
BuildRequires: cmake gcc gcc-c++
|
BuildRequires: cmake gcc gcc-c++
|
||||||
|
|
||||||
@ -45,17 +46,31 @@ The %{name}-static package contains the static library for %{name}.
|
|||||||
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
# ask cmake to not strip binaries
|
rm -rf build_shared && mkdir build_shared
|
||||||
|
rm -rf build_static && mkdir build_static
|
||||||
|
|
||||||
|
pushd build_shared
|
||||||
%cmake -DYAML_CPP_BUILD_TOOLS=OFF \
|
%cmake -DYAML_CPP_BUILD_TOOLS=OFF \
|
||||||
-DBUILD_SHARED_LIBS=ON \
|
-DBUILD_SHARED_LIBS=ON \
|
||||||
-DBUILD_STATIC_LIBS=ON \
|
|
||||||
-DYAML_CPP_BUILD_TESTS=OFF \
|
-DYAML_CPP_BUILD_TESTS=OFF \
|
||||||
./
|
../
|
||||||
|
%make_build
|
||||||
|
popd
|
||||||
|
|
||||||
|
pushd build_static
|
||||||
|
%cmake -DYAML_CPP_BUILD_TOOLS=OFF \
|
||||||
|
-DBUILD_SHARED_LIBS=OFF \
|
||||||
|
-DYAML_CPP_BUILD_TESTS=OFF \
|
||||||
|
../
|
||||||
%make_build
|
%make_build
|
||||||
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
|
pushd build_shared
|
||||||
%make_install
|
%make_install
|
||||||
|
popd
|
||||||
|
pushd build_static
|
||||||
|
%make_install yaml-cpp
|
||||||
|
|
||||||
|
|
||||||
%post -p /sbin/ldconfig
|
%post -p /sbin/ldconfig
|
||||||
@ -82,6 +97,9 @@ The %{name}-static package contains the static library for %{name}.
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Apr 09 2018 Richard Shaw <hobbes1069@gmail.com> - 0.6.1-2
|
||||||
|
- Fixes improperly generated cmake config files, RHBZ#1558637.
|
||||||
|
|
||||||
* Sun Feb 18 2018 Richard Shaw <hobbes1069@gmail.com> - 0.6.1-1
|
* Sun Feb 18 2018 Richard Shaw <hobbes1069@gmail.com> - 0.6.1-1
|
||||||
- Update to 0.6.1.
|
- Update to 0.6.1.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user