Commit b08fe71d3bc6d01e6e7f248bc01a6fc11fa03f4c

Edward Thomson 2022-02-27T23:16:05

cmake: export libraries needed to compile against libgit2 If users are using us as a direct dependency (via `add_subdirectory`) then they may want to know the libraries to link to; tell them.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 763bd43..750b708 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -131,6 +131,14 @@ if(BUILD_FUZZERS)
 endif()
 
 
+# Export for people who use us as a dependency
+
+if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
+	set(LIBGIT2_DEPENDENCY_OBJECTS ${LIBGIT2_DEPENDENCY_OBJECTS} PARENT_SCOPE)
+	set(LIBGIT2_SYSTEM_LIBS ${LIBGIT2_SYSTEM_LIBS} PARENT_SCOPE)
+endif()
+
+
 # Summary
 
 feature_summary(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")