From 19f57060af101266fa3c2a361133fe76b37c71e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Sat, 23 May 2020 09:41:06 +0200 Subject: [PATCH 1/2] Fix cmake install in case of subdirectory use Original commit 7a7d6a0979664db19462ebc655f23a68da523e63 could not be cherry-picked. Kudos to Taras Kushnir --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 37c2a871..0f160079 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,7 +136,7 @@ if (EXIV2_TEAM_PACKAGING) endif() configure_file(cmake/exiv2.pc.in exiv2.pc @ONLY) -install(FILES ${CMAKE_BINARY_DIR}/exiv2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/exiv2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) # ****************************************************************************** # Man page From 9893d291b26b8ba4fc51e81bd78395d74c1c5c5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Sat, 23 May 2020 09:43:36 +0200 Subject: [PATCH 2/2] Prevent conflicts with uninstall target --- cmake/mainSetup.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmake/mainSetup.cmake b/cmake/mainSetup.cmake index 1f8d10c8..5bcc3fa5 100644 --- a/cmake/mainSetup.cmake +++ b/cmake/mainSetup.cmake @@ -27,5 +27,8 @@ if (UNIX) endif() endif() -configure_file(cmake/exiv2_uninstall.cmake ${CMAKE_BINARY_DIR}/cmake_uninstall.cmake COPYONLY) -add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake") +# Prevent conflicts when exiv2 is consumed in multiple-subdirectory projects. +if (NOT TARGET uninstall) + configure_file(cmake/exiv2_uninstall.cmake ${CMAKE_BINARY_DIR}/cmake_uninstall.cmake COPYONLY) + add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake") +endif()