2022-03-05 05:30:30 +08:00
|
|
|
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 @@
|
2021-11-28 15:32:06 +08:00
|
|
|
# Specify regular expression implementation
|
2022-03-05 05:30:30 +08:00
|
|
|
-find_package(PCRE)
|
2021-11-28 15:32:06 +08:00
|
|
|
|
2022-03-05 05:30:30 +08:00
|
|
|
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)
|
2021-11-28 15:32:06 +08:00
|
|
|
|
2022-03-05 05:30:30 +08:00
|
|
|
- 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()
|
2021-11-28 15:32:06 +08:00
|
|
|
|
|
|
|
# Install
|
2022-03-05 05:30:30 +08:00
|
|
|
-install(TARGETS git2
|
|
|
|
+install(TARGETS git2 EXPORT unofficial-git2Targets
|
2021-11-28 15:32:06 +08:00
|
|
|
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)
|
2022-03-05 05:30:30 +08:00
|
|
|
+if(@USE_BUNDLED_ZLIB@ STREQUAL "OFF")
|
2021-11-28 15:32:06 +08:00
|
|
|
+ find_dependency(ZLIB)
|
2022-03-05 05:30:30 +08:00
|
|
|
+endif()
|
|
|
|
+if(@REGEX_BACKEND@ STREQUAL "pcre")
|
2021-11-28 15:32:06 +08:00
|
|
|
+ find_dependency(unofficial-pcre CONFIG)
|
2022-03-05 05:30:30 +08:00
|
|
|
+endif()
|
2021-11-28 15:32:06 +08:00
|
|
|
+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)
|
|
|
|
+
|
2022-03-05 05:30:30 +08:00
|
|
|
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/git2 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
|
|
install(FILES ${PROJECT_SOURCE_DIR}/include/git2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|