Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
734468d6
Unverified
Commit
734468d6
authored
Dec 23, 2021
by
Edward Thomson
Committed by
GitHub
Dec 23, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6146 from Qix-/main
cmake: use project-specific root variable instead of CMAKE_SOURCE_DIR
parents
12b53eb0
c5cd71b2
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
29 additions
and
29 deletions
+29
-29
CMakeLists.txt
+1
-1
cmake/IdeSplitSources.cmake
+1
-1
cmake/SelectHTTPParser.cmake
+2
-2
cmake/SelectRegex.cmake
+2
-2
cmake/SelectWinHTTP.cmake
+2
-2
cmake/SelectZlib.cmake
+4
-4
deps/winhttp/CMakeLists.txt
+1
-1
src/CMakeLists.txt
+13
-13
tests/CMakeLists.txt
+3
-3
No files found.
CMakeLists.txt
View file @
734468d6
...
...
@@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.5.1)
project
(
libgit2 VERSION
"1.3.0"
LANGUAGES C
)
# Add find modules to the path
set
(
CMAKE_MODULE_PATH
${
CMAKE_MODULE_PATH
}
"
${
CMAKE
_SOURCE_DIR
}
/cmake"
)
set
(
CMAKE_MODULE_PATH
${
CMAKE_MODULE_PATH
}
"
${
PROJECT
_SOURCE_DIR
}
/cmake"
)
#
# Build options
...
...
cmake/IdeSplitSources.cmake
View file @
734468d6
...
...
@@ -8,7 +8,7 @@ function(IDE_SPLIT_SOURCES target)
get_target_property
(
sources
${
target
}
SOURCES
)
foreach
(
source
${
sources
}
)
if
(
source MATCHES
".*/"
)
string
(
REPLACE
${
CMAKE
_SOURCE_DIR
}
/
""
rel
${
source
}
)
string
(
REPLACE
${
PROJECT
_SOURCE_DIR
}
/
""
rel
${
source
}
)
if
(
rel
)
string
(
REGEX REPLACE
"/([^/]*)$"
""
rel
${
rel
}
)
if
(
rel
)
...
...
cmake/SelectHTTPParser.cmake
View file @
734468d6
...
...
@@ -12,8 +12,8 @@ if(USE_HTTP_PARSER STREQUAL "system")
endif
()
else
()
message
(
STATUS
"http-parser version 2 was not found or disabled; using bundled 3rd-party sources."
)
add_subdirectory
(
"
${
CMAKE_SOURCE_DIR
}
/deps/http-parser"
"
${
CMAKE
_BINARY_DIR
}
/deps/http-parser"
)
list
(
APPEND LIBGIT2_DEPENDENCY_INCLUDES
"
${
CMAKE
_SOURCE_DIR
}
/deps/http-parser"
)
add_subdirectory
(
"
${
PROJECT_SOURCE_DIR
}
/deps/http-parser"
"
${
PROJECT
_BINARY_DIR
}
/deps/http-parser"
)
list
(
APPEND LIBGIT2_DEPENDENCY_INCLUDES
"
${
PROJECT
_SOURCE_DIR
}
/deps/http-parser"
)
list
(
APPEND LIBGIT2_DEPENDENCY_OBJECTS
"$<TARGET_OBJECTS:http-parser>"
)
add_feature_info
(
http-parser ON
"http-parser support (bundled)"
)
endif
()
cmake/SelectRegex.cmake
View file @
734468d6
...
...
@@ -43,8 +43,8 @@ elseif(REGEX_BACKEND STREQUAL "builtin")
add_feature_info
(
regex ON
"using bundled PCRE"
)
set
(
GIT_REGEX_BUILTIN 1
)
add_subdirectory
(
"
${
CMAKE_SOURCE_DIR
}
/deps/pcre"
"
${
CMAKE
_BINARY_DIR
}
/deps/pcre"
)
list
(
APPEND LIBGIT2_DEPENDENCY_INCLUDES
"
${
CMAKE
_SOURCE_DIR
}
/deps/pcre"
)
add_subdirectory
(
"
${
PROJECT_SOURCE_DIR
}
/deps/pcre"
"
${
PROJECT
_BINARY_DIR
}
/deps/pcre"
)
list
(
APPEND LIBGIT2_DEPENDENCY_INCLUDES
"
${
PROJECT
_SOURCE_DIR
}
/deps/pcre"
)
list
(
APPEND LIBGIT2_DEPENDENCY_OBJECTS $<TARGET_OBJECTS:pcre>
)
else
()
message
(
FATAL_ERROR
"The REGEX_BACKEND option provided is not supported"
)
...
...
cmake/SelectWinHTTP.cmake
View file @
734468d6
...
...
@@ -4,9 +4,9 @@ if(WIN32 AND USE_WINHTTP)
# Since MinGW does not come with headers or an import library for winhttp,
# we have to include a private header and generate our own import library
if
(
MINGW
)
add_subdirectory
(
"
${
CMAKE_SOURCE_DIR
}
/deps/winhttp"
"
${
CMAKE
_BINARY_DIR
}
/deps/winhttp"
)
add_subdirectory
(
"
${
PROJECT_SOURCE_DIR
}
/deps/winhttp"
"
${
PROJECT
_BINARY_DIR
}
/deps/winhttp"
)
list
(
APPEND LIBGIT2_SYSTEM_LIBS winhttp
)
list
(
APPEND LIBGIT2_DEPENDENCY_INCLUDES
"
${
CMAKE
_SOURCE_DIR
}
/deps/winhttp"
)
list
(
APPEND LIBGIT2_DEPENDENCY_INCLUDES
"
${
PROJECT
_SOURCE_DIR
}
/deps/winhttp"
)
else
()
list
(
APPEND LIBGIT2_SYSTEM_LIBS
"winhttp"
)
list
(
APPEND LIBGIT2_PC_LIBS
"-lwinhttp"
)
...
...
cmake/SelectZlib.cmake
View file @
734468d6
...
...
@@ -22,13 +22,13 @@ if(USE_BUNDLED_ZLIB STREQUAL "OFF")
endif
()
endif
()
if
(
USE_BUNDLED_ZLIB STREQUAL
"Chromium"
)
add_subdirectory
(
"
${
CMAKE_SOURCE_DIR
}
/deps/chromium-zlib"
"
${
CMAKE
_BINARY_DIR
}
/deps/chromium-zlib"
)
list
(
APPEND LIBGIT2_DEPENDENCY_INCLUDES
"
${
CMAKE
_SOURCE_DIR
}
/deps/chromium-zlib"
)
add_subdirectory
(
"
${
PROJECT_SOURCE_DIR
}
/deps/chromium-zlib"
"
${
PROJECT
_BINARY_DIR
}
/deps/chromium-zlib"
)
list
(
APPEND LIBGIT2_DEPENDENCY_INCLUDES
"
${
PROJECT
_SOURCE_DIR
}
/deps/chromium-zlib"
)
list
(
APPEND LIBGIT2_DEPENDENCY_OBJECTS $<TARGET_OBJECTS:chromium_zlib>
)
add_feature_info
(
zlib ON
"using (Chromium) bundled zlib"
)
elseif
(
USE_BUNDLED_ZLIB OR NOT ZLIB_FOUND
)
add_subdirectory
(
"
${
CMAKE_SOURCE_DIR
}
/deps/zlib"
"
${
CMAKE
_BINARY_DIR
}
/deps/zlib"
)
list
(
APPEND LIBGIT2_DEPENDENCY_INCLUDES
"
${
CMAKE
_SOURCE_DIR
}
/deps/zlib"
)
add_subdirectory
(
"
${
PROJECT_SOURCE_DIR
}
/deps/zlib"
"
${
PROJECT
_BINARY_DIR
}
/deps/zlib"
)
list
(
APPEND LIBGIT2_DEPENDENCY_INCLUDES
"
${
PROJECT
_SOURCE_DIR
}
/deps/zlib"
)
list
(
APPEND LIBGIT2_DEPENDENCY_OBJECTS $<TARGET_OBJECTS:zlib>
)
add_feature_info
(
zlib ON
"using bundled zlib"
)
endif
()
deps/winhttp/CMakeLists.txt
View file @
734468d6
...
...
@@ -3,7 +3,7 @@ if(NOT DLLTOOL)
message
(
FATAL_ERROR
"Could not find dlltool command"
)
endif
()
set
(
LIBWINHTTP_PATH
"
${
CMAKE
_BINARY_DIR
}
/deps/winhttp"
)
set
(
LIBWINHTTP_PATH
"
${
PROJECT
_BINARY_DIR
}
/deps/winhttp"
)
set
(
LIBWINHTTP_PATH
${
LIBWINHTTP_PATH
}
PARENT_SCOPE
)
file
(
MAKE_DIRECTORY
${
LIBWINHTTP_PATH
}
)
...
...
src/CMakeLists.txt
View file @
734468d6
...
...
@@ -36,8 +36,8 @@ set(LIBGIT2_PC_LIBS "")
set
(
LIBGIT2_INCLUDES
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
"
${
CMAKE
_SOURCE_DIR
}
/src"
"
${
CMAKE
_SOURCE_DIR
}
/include"
)
"
${
PROJECT
_SOURCE_DIR
}
/src"
"
${
PROJECT
_SOURCE_DIR
}
/include"
)
if
(
HAVE_FUTIMENS
)
set
(
GIT_USE_FUTIMENS 1
)
...
...
@@ -117,8 +117,8 @@ target_sources(git2internal PRIVATE ${SRC_SHA1})
# Optional external dependency: ntlmclient
if
(
USE_NTLMCLIENT
)
set
(
GIT_NTLM 1
)
add_subdirectory
(
"
${
CMAKE_SOURCE_DIR
}
/deps/ntlmclient"
"
${
CMAKE
_BINARY_DIR
}
/deps/ntlmclient"
)
list
(
APPEND LIBGIT2_DEPENDENCY_INCLUDES
"
${
CMAKE
_SOURCE_DIR
}
/deps/ntlmclient"
)
add_subdirectory
(
"
${
PROJECT_SOURCE_DIR
}
/deps/ntlmclient"
"
${
PROJECT
_BINARY_DIR
}
/deps/ntlmclient"
)
list
(
APPEND LIBGIT2_DEPENDENCY_INCLUDES
"
${
PROJECT
_SOURCE_DIR
}
/deps/ntlmclient"
)
list
(
APPEND LIBGIT2_DEPENDENCY_OBJECTS
"$<TARGET_OBJECTS:ntlmclient>"
)
endif
()
add_feature_info
(
ntlmclient GIT_NTLM
"NTLM authentication support for Unix"
)
...
...
@@ -164,9 +164,9 @@ target_compile_definitions(git2internal PRIVATE _FILE_OFFSET_BITS=64)
# Collect sourcefiles
file
(
GLOB SRC_H
"
${
CMAKE
_SOURCE_DIR
}
/include/git2.h"
"
${
CMAKE
_SOURCE_DIR
}
/include/git2/*.h"
"
${
CMAKE
_SOURCE_DIR
}
/include/git2/sys/*.h"
)
"
${
PROJECT
_SOURCE_DIR
}
/include/git2.h"
"
${
PROJECT
_SOURCE_DIR
}
/include/git2/*.h"
"
${
PROJECT
_SOURCE_DIR
}
/include/git2/sys/*.h"
)
list
(
SORT SRC_H
)
target_sources
(
git2internal PRIVATE
${
SRC_H
}
)
...
...
@@ -225,7 +225,7 @@ configure_file(features.h.in git2/sys/features.h)
ide_split_sources
(
git2internal
)
list
(
APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:git2internal>
${
LIBGIT2_DEPENDENCY_OBJECTS
}
)
target_include_directories
(
git2internal PRIVATE
${
LIBGIT2_INCLUDES
}
${
LIBGIT2_DEPENDENCY_INCLUDES
}
PUBLIC
${
CMAKE
_SOURCE_DIR
}
/include
)
target_include_directories
(
git2internal PRIVATE
${
LIBGIT2_INCLUDES
}
${
LIBGIT2_DEPENDENCY_INCLUDES
}
PUBLIC
${
PROJECT
_SOURCE_DIR
}
/include
)
target_include_directories
(
git2internal SYSTEM PRIVATE
${
LIBGIT2_SYSTEM_INCLUDES
}
)
set
(
LIBGIT2_INCLUDES
${
LIBGIT2_INCLUDES
}
PARENT_SCOPE
)
...
...
@@ -247,9 +247,9 @@ add_library(git2 ${WIN_RC} ${LIBGIT2_OBJECTS})
target_link_libraries
(
git2
${
LIBGIT2_SYSTEM_LIBS
}
)
set_target_properties
(
git2 PROPERTIES C_STANDARD 90
)
set_target_properties
(
git2 PROPERTIES LIBRARY_OUTPUT_DIRECTORY
${
CMAKE
_BINARY_DIR
}
)
set_target_properties
(
git2 PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${
CMAKE
_BINARY_DIR
}
)
set_target_properties
(
git2 PROPERTIES ARCHIVE_OUTPUT_DIRECTORY
${
CMAKE
_BINARY_DIR
}
)
set_target_properties
(
git2 PROPERTIES LIBRARY_OUTPUT_DIRECTORY
${
PROJECT
_BINARY_DIR
}
)
set_target_properties
(
git2 PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${
PROJECT
_BINARY_DIR
}
)
set_target_properties
(
git2 PROPERTIES ARCHIVE_OUTPUT_DIRECTORY
${
PROJECT
_BINARY_DIR
}
)
# Workaround for Cmake bug #0011240 (see http://public.kitware.com/Bug/view.php?id=11240)
# Win64+MSVC+static libs = linker error
...
...
@@ -290,5 +290,5 @@ install(TARGETS git2
LIBRARY DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
)
install(DIRECTORY
${
CMAKE
_SOURCE_DIR
}
/include/git2 DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
)
install(FILES
${
CMAKE
_SOURCE_DIR
}
/include/git2.h DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
)
install(DIRECTORY
${
PROJECT
_SOURCE_DIR
}
/include/git2 DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
)
install(FILES
${
PROJECT
_SOURCE_DIR
}
/include/git2.h DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
)
tests/CMakeLists.txt
View file @
734468d6
...
...
@@ -38,7 +38,7 @@ set_source_files_properties(
add_executable(libgit2_tests
${
SRC_CLAR
}
${
SRC_TEST
}
${
LIBGIT2_OBJECTS
}
)
set_target_properties(libgit2_tests PROPERTIES C_STANDARD 90)
set_target_properties(libgit2_tests PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${
CMAKE
_BINARY_DIR
}
)
set_target_properties(libgit2_tests PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${
PROJECT
_BINARY_DIR
}
)
target_include_directories(libgit2_tests PRIVATE
${
TEST_INCLUDES
}
${
LIBGIT2_INCLUDES
}
${
LIBGIT2_DEPENDENCY_INCLUDES
}
)
target_include_directories(libgit2_tests SYSTEM PRIVATE
${
LIBGIT2_SYSTEM_INCLUDES
}
)
...
...
@@ -62,9 +62,9 @@ endif()
function(ADD_CLAR_TEST name)
if(NOT USE_LEAK_CHECKER STREQUAL "
OFF
")
add_test(
${
name
}
"
${
CMAKE_SOURCE_DIR
}
/script/
${
USE_LEAK_CHECKER
}
.sh
" "
${
CMAKE
_BINARY_DIR
}
/libgit2_tests
"
${
ARGN
}
)
add_test(
${
name
}
"
${
PROJECT_SOURCE_DIR
}
/script/
${
USE_LEAK_CHECKER
}
.sh
" "
${
PROJECT
_BINARY_DIR
}
/libgit2_tests
"
${
ARGN
}
)
else()
add_test(
${
name
}
"
${
CMAKE
_BINARY_DIR
}
/libgit2_tests
"
${
ARGN
}
)
add_test(
${
name
}
"
${
PROJECT
_BINARY_DIR
}
/libgit2_tests
"
${
ARGN
}
)
endif()
endfunction(ADD_CLAR_TEST)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment