pineapple-src/externals/vcpkg/ports/libgit2/fix-configcmake.patch
2022-07-23 03:01:36 +02:00

56 lines
2.1 KiB
Diff
Executable File

diff --git a/cmake/SelectRegex.cmake b/cmake/SelectRegex.cmake
index 2a3a91b8c..cbb409350 100644
--- a/cmake/SelectRegex.cmake
+++ b/cmake/SelectRegex.cmake
@@ -1,5 +1,4 @@
# Specify regular expression implementation
-find_package(PCRE)
if(REGEX_BACKEND STREQUAL "")
check_symbol_exists(regcomp_l "regex.h;xlocale.h" HAVE_REGCOMP_L)
@@ -33,8 +32,8 @@ elseif(REGEX_BACKEND STREQUAL "pcre")
add_feature_info(regex ON "using system PCRE")
set(GIT_REGEX_PCRE 1)
- list(APPEND LIBGIT2_SYSTEM_INCLUDES ${PCRE_INCLUDE_DIRS})
- list(APPEND LIBGIT2_SYSTEM_LIBS ${PCRE_LIBRARIES})
+ find_package(unofficial-pcre CONFIG REQUIRED)
+ list(APPEND LIBGIT2_SYSTEM_LIBS unofficial::pcre::pcre)
list(APPEND LIBGIT2_PC_REQUIRES "libpcre")
elseif(REGEX_BACKEND STREQUAL "regcomp")
add_feature_info(regex ON "using system regcomp")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e7b54d036..6b549deef 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -298,10 +298,28 @@ if(MSVC_IDE)
endif()
# Install
-install(TARGETS git2
+install(TARGETS git2 EXPORT unofficial-git2Targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
+
+install(EXPORT unofficial-git2Targets
+ NAMESPACE unofficial::git2::
+ DESTINATION share/unofficial-git2
+)
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/unofficial-git2-config.cmake.in"
+[[include(CMakeFindDependencyMacro)
+if(@USE_BUNDLED_ZLIB@ STREQUAL "OFF")
+ find_dependency(ZLIB)
+endif()
+if(@REGEX_BACKEND@ STREQUAL "pcre")
+ find_dependency(unofficial-pcre CONFIG)
+endif()
+include("${CMAKE_CURRENT_LIST_DIR}/unofficial-git2Targets.cmake")
+]])
+configure_file("${CMAKE_CURRENT_BINARY_DIR}/unofficial-git2-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/unofficial-git2-config.cmake" @ONLY)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/unofficial-git2-config.cmake DESTINATION share/unofficial-git2)
+
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/git2 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES ${PROJECT_SOURCE_DIR}/include/git2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})