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
c3fec456
Commit
c3fec456
authored
Nov 11, 2021
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmake: reformat modules
Apply the standard project cmake formatting to the modules.
parent
b608af6c
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
558 additions
and
681 deletions
+558
-681
cmake/AddCFlagIfSupported.cmake
+21
-21
cmake/EnableWarnings.cmake
+13
-13
cmake/FindCoreFoundation.cmake
+13
-13
cmake/FindGSSAPI.cmake
+117
-233
cmake/FindGSSFramework.cmake
+13
-13
cmake/FindHTTPParser.cmake
+17
-17
cmake/FindIconv.cmake
+27
-27
cmake/FindLibSSH2.cmake
+4
-4
cmake/FindPCRE.cmake
+13
-13
cmake/FindPCRE2.cmake
+12
-12
cmake/FindPkgLibraries.cmake
+19
-19
cmake/FindSecurity.cmake
+14
-14
cmake/Findfutimens.cmake
+8
-8
cmake/FindmbedTLS.cmake
+46
-53
cmake/IdeSplitSources.cmake
+17
-17
cmake/PkgBuildConfig.cmake
+0
-0
cmake/SanitizeBool.cmake
+20
-20
cmake/SelectGSSAPI.cmake
+37
-37
cmake/SelectHTTPSBackend.cmake
+100
-100
cmake/SelectHashes.cmake
+47
-47
No files found.
cmake/AddCFlagIfSupported.cmake
View file @
c3fec456
...
@@ -3,28 +3,28 @@
...
@@ -3,28 +3,28 @@
# <flag> - the compiler flag to test
# <flag> - the compiler flag to test
# This internally calls the CHECK_C_COMPILER_FLAG macro.
# This internally calls the CHECK_C_COMPILER_FLAG macro.
INCLUDE
(
CheckCCompilerFlag
)
include
(
CheckCCompilerFlag
)
MACRO
(
ADD_C_FLAG _FLAG
)
macro
(
ADD_C_FLAG _FLAG
)
STRING
(
TOUPPER
${
_FLAG
}
UPCASE
)
string
(
TOUPPER
${
_FLAG
}
UPCASE
)
STRING
(
REGEX REPLACE
"[-=]"
"_"
UPCASE_PRETTY
${
UPCASE
}
)
string
(
REGEX REPLACE
"[-=]"
"_"
UPCASE_PRETTY
${
UPCASE
}
)
STRING
(
REGEX REPLACE
"^_+"
""
UPCASE_PRETTY
${
UPCASE_PRETTY
}
)
string
(
REGEX REPLACE
"^_+"
""
UPCASE_PRETTY
${
UPCASE_PRETTY
}
)
CHECK_C_COMPILER_FLAG
(
${
_FLAG
}
IS_
${
UPCASE_PRETTY
}
_SUPPORTED
)
check_c_compiler_flag
(
${
_FLAG
}
IS_
${
UPCASE_PRETTY
}
_SUPPORTED
)
IF
(
IS_
${
UPCASE_PRETTY
}
_SUPPORTED
)
if
(
IS_
${
UPCASE_PRETTY
}
_SUPPORTED
)
SET
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
${
_FLAG
}
"
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
${
_FLAG
}
"
)
ELSE
()
else
()
MESSAGE
(
FATAL_ERROR
"Required flag
${
_FLAG
}
is not supported"
)
message
(
FATAL_ERROR
"Required flag
${
_FLAG
}
is not supported"
)
ENDIF
()
endif
()
ENDMACRO
()
endmacro
()
MACRO
(
ADD_C_FLAG_IF_SUPPORTED _FLAG
)
macro
(
ADD_C_FLAG_IF_SUPPORTED _FLAG
)
STRING
(
TOUPPER
${
_FLAG
}
UPCASE
)
string
(
TOUPPER
${
_FLAG
}
UPCASE
)
STRING
(
REGEX REPLACE
"[-=]"
"_"
UPCASE_PRETTY
${
UPCASE
}
)
string
(
REGEX REPLACE
"[-=]"
"_"
UPCASE_PRETTY
${
UPCASE
}
)
STRING
(
REGEX REPLACE
"^_+"
""
UPCASE_PRETTY
${
UPCASE_PRETTY
}
)
string
(
REGEX REPLACE
"^_+"
""
UPCASE_PRETTY
${
UPCASE_PRETTY
}
)
CHECK_C_COMPILER_FLAG
(
${
_FLAG
}
IS_
${
UPCASE_PRETTY
}
_SUPPORTED
)
check_c_compiler_flag
(
${
_FLAG
}
IS_
${
UPCASE_PRETTY
}
_SUPPORTED
)
IF
(
IS_
${
UPCASE_PRETTY
}
_SUPPORTED
)
if
(
IS_
${
UPCASE_PRETTY
}
_SUPPORTED
)
SET
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
${
_FLAG
}
"
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
${
_FLAG
}
"
)
ENDIF
()
endif
()
ENDMACRO
()
endmacro
()
cmake/EnableWarnings.cmake
View file @
c3fec456
MACRO
(
ENABLE_WARNINGS flag
)
macro
(
ENABLE_WARNINGS flag
)
ADD_C_FLAG_IF_SUPPORTED
(
-W
${
flag
}
)
add_c_flag_if_supported
(
-W
${
flag
}
)
ENDMACRO
()
endmacro
()
MACRO
(
DISABLE_WARNINGS flag
)
macro
(
DISABLE_WARNINGS flag
)
ADD_C_FLAG_IF_SUPPORTED
(
-Wno-
${
flag
}
)
add_c_flag_if_supported
(
-Wno-
${
flag
}
)
ENDMACRO
()
endmacro
()
IF
(
ENABLE_WERROR
)
if
(
ENABLE_WERROR
)
IF
(
MSVC
)
if
(
MSVC
)
ADD_COMPILE_OPTIONS
(
-WX
)
add_compile_options
(
-WX
)
ELSE
()
else
()
ADD_C_FLAG_IF_SUPPORTED
(
-Werror
)
add_c_flag_if_supported
(
-Werror
)
ENDIF
()
endif
()
ENDIF
()
endif
()
cmake/FindCoreFoundation.cmake
View file @
c3fec456
...
@@ -6,21 +6,21 @@
...
@@ -6,21 +6,21 @@
# COREFOUNDATION_LDFLAGS
# COREFOUNDATION_LDFLAGS
#
#
FIND_PATH
(
COREFOUNDATION_INCLUDE_DIR NAMES CoreFoundation.h
)
find_path
(
COREFOUNDATION_INCLUDE_DIR NAMES CoreFoundation.h
)
FIND_LIBRARY
(
COREFOUNDATION_LIBRARIES NAMES CoreFoundation
)
find_library
(
COREFOUNDATION_LIBRARIES NAMES CoreFoundation
)
IF
(
COREFOUNDATION_INCLUDE_DIR AND COREFOUNDATION_LIBRARIES
)
if
(
COREFOUNDATION_INCLUDE_DIR AND COREFOUNDATION_LIBRARIES
)
IF
(
NOT CoreFoundation_FIND_QUIETLY
)
if
(
NOT CoreFoundation_FIND_QUIETLY
)
MESSAGE
(
STATUS
"Found CoreFoundation
${
COREFOUNDATION_LIBRARIES
}
"
)
message
(
STATUS
"Found CoreFoundation
${
COREFOUNDATION_LIBRARIES
}
"
)
ENDIF
()
endif
()
SET
(
COREFOUNDATION_FOUND TRUE
)
set
(
COREFOUNDATION_FOUND TRUE
)
SET
(
COREFOUNDATION_LDFLAGS
"-framework CoreFoundation"
)
set
(
COREFOUNDATION_LDFLAGS
"-framework CoreFoundation"
)
ENDIF
()
endif
()
IF
(
CoreFoundation_FIND_REQUIRED AND NOT COREFOUNDATION_FOUND
)
if
(
CoreFoundation_FIND_REQUIRED AND NOT COREFOUNDATION_FOUND
)
MESSAGE
(
FATAL_ERROR
"CoreFoundation not found"
)
message
(
FATAL_ERROR
"CoreFoundation not found"
)
ENDIF
()
endif
()
MARK_AS_ADVANCED
(
mark_as_advanced
(
COREFOUNDATION_INCLUDE_DIR
COREFOUNDATION_INCLUDE_DIR
COREFOUNDATION_LIBRARIES
COREFOUNDATION_LIBRARIES
)
)
cmake/FindGSSAPI.cmake
View file @
c3fec456
...
@@ -25,300 +25,184 @@
...
@@ -25,300 +25,184 @@
#
#
find_path
(
GSSAPI_ROOT_DIR
find_path
(
GSSAPI_ROOT_DIR
NAMES
NAMES include/gssapi.h include/gssapi/gssapi.h
include/gssapi.h
HINTS
${
_GSSAPI_ROOT_HINTS
}
include/gssapi/gssapi.h
PATHS
${
_GSSAPI_ROOT_PATHS
}
)
HINTS
${
_GSSAPI_ROOT_HINTS
}
PATHS
${
_GSSAPI_ROOT_PATHS
}
)
mark_as_advanced
(
GSSAPI_ROOT_DIR
)
mark_as_advanced
(
GSSAPI_ROOT_DIR
)
if
(
UNIX
)
if
(
UNIX
)
find_program
(
KRB5_CONFIG
find_program
(
KRB5_CONFIG
NAMES
NAMES krb5-config
krb5-config
PATHS
${
GSSAPI_ROOT_DIR
}
/bin /opt/local/bin
)
PATHS
${
GSSAPI_ROOT_DIR
}
/bin
/opt/local/bin
)
mark_as_advanced
(
KRB5_CONFIG
)
mark_as_advanced
(
KRB5_CONFIG
)
if
(
KRB5_CONFIG
)
if
(
KRB5_CONFIG
)
# Check if we have MIT KRB5
# Check if we have MIT KRB5
execute_process
(
execute_process
(
COMMAND
COMMAND
${
KRB5_CONFIG
}
--vendor
${
KRB5_CONFIG
}
--vendor
RESULT_VARIABLE _GSSAPI_VENDOR_RESULT
RESULT_VARIABLE
OUTPUT_VARIABLE _GSSAPI_VENDOR_STRING
)
_GSSAPI_VENDOR_RESULT
OUTPUT_VARIABLE
if
(
_GSSAPI_VENDOR_STRING MATCHES
".*Massachusetts.*"
)
_GSSAPI_VENDOR_STRING
)
if
(
_GSSAPI_VENDOR_STRING MATCHES
".*Massachusetts.*"
)
set
(
GSSAPI_FLAVOR_MIT TRUE
)
set
(
GSSAPI_FLAVOR_MIT TRUE
)
else
()
else
()
execute_process
(
execute_process
(
COMMAND
COMMAND
${
KRB5_CONFIG
}
--libs gssapi
${
KRB5_CONFIG
}
--libs gssapi
RESULT_VARIABLE _GSSAPI_LIBS_RESULT
RESULT_VARIABLE
OUTPUT_VARIABLE _GSSAPI_LIBS_STRING
)
_GSSAPI_LIBS_RESULT
OUTPUT_VARIABLE
if
(
_GSSAPI_LIBS_STRING MATCHES
".*roken.*"
)
_GSSAPI_LIBS_STRING
)
if
(
_GSSAPI_LIBS_STRING MATCHES
".*roken.*"
)
set
(
GSSAPI_FLAVOR_HEIMDAL TRUE
)
set
(
GSSAPI_FLAVOR_HEIMDAL TRUE
)
endif
()
endif
()
endif
()
endif
()
# Get the include dir
# Get the include dir
execute_process
(
execute_process
(
COMMAND
COMMAND
${
KRB5_CONFIG
}
--cflags gssapi
${
KRB5_CONFIG
}
--cflags gssapi
RESULT_VARIABLE _GSSAPI_INCLUDE_RESULT
RESULT_VARIABLE
OUTPUT_VARIABLE _GSSAPI_INCLUDE_STRING
)
_GSSAPI_INCLUDE_RESULT
OUTPUT_VARIABLE
_GSSAPI_INCLUDE_STRING
)
string
(
REGEX REPLACE
"(
\r
?
\n
)+$"
""
_GSSAPI_INCLUDE_STRING
"
${
_GSSAPI_INCLUDE_STRING
}
"
)
string
(
REGEX REPLACE
"(
\r
?
\n
)+$"
""
_GSSAPI_INCLUDE_STRING
"
${
_GSSAPI_INCLUDE_STRING
}
"
)
string
(
REGEX REPLACE
" *-I"
""
_GSSAPI_INCLUDEDIR
"
${
_GSSAPI_INCLUDE_STRING
}
"
)
string
(
REGEX REPLACE
" *-I"
""
_GSSAPI_INCLUDEDIR
"
${
_GSSAPI_INCLUDE_STRING
}
"
)
endif
()
endif
()
if
(
NOT GSSAPI_FLAVOR_MIT AND NOT GSSAPI_FLAVOR_HEIMDAL
)
if
(
NOT GSSAPI_FLAVOR_MIT AND NOT GSSAPI_FLAVOR_HEIMDAL
)
# Check for HEIMDAL
# Check for HEIMDAL
find_package
(
PkgConfig
)
find_package
(
PkgConfig
)
if
(
PKG_CONFIG_FOUND
)
if
(
PKG_CONFIG_FOUND
)
pkg_check_modules
(
_GSSAPI heimdal-gssapi
)
pkg_check_modules
(
_GSSAPI heimdal-gssapi
)
endif
(
PKG_CONFIG_FOUND
)
endif
(
)
if
(
_GSSAPI_FOUND
)
if
(
_GSSAPI_FOUND
)
set
(
GSSAPI_FLAVOR_HEIMDAL TRUE
)
set
(
GSSAPI_FLAVOR_HEIMDAL TRUE
)
else
()
else
()
find_path
(
_GSSAPI_ROKEN
find_path
(
_GSSAPI_ROKEN
NAMES
NAMES roken.h
roken.h
PATHS
${
GSSAPI_ROOT_DIR
}
/include
${
_GSSAPI_INCLUDEDIR
}
)
PATHS
if
(
_GSSAPI_ROKEN
)
${
GSSAPI_ROOT_DIR
}
/include
${
_GSSAPI_INCLUDEDIR
}
)
if
(
_GSSAPI_ROKEN
)
set
(
GSSAPI_FLAVOR_HEIMDAL TRUE
)
set
(
GSSAPI_FLAVOR_HEIMDAL TRUE
)
endif
()
endif
()
endif
()
endif
()
endif
()
endif
(
UNIX
)
endif
()
endif
()
find_path
(
GSSAPI_INCLUDE_DIR
find_path
(
GSSAPI_INCLUDE_DIR
NAMES
NAMES gssapi.h gssapi/gssapi.h
gssapi.h
PATHS
${
GSSAPI_ROOT_DIR
}
/include
${
_GSSAPI_INCLUDEDIR
}
)
gssapi/gssapi.h
PATHS
if
(
GSSAPI_FLAVOR_MIT
)
${
GSSAPI_ROOT_DIR
}
/include
${
_GSSAPI_INCLUDEDIR
}
)
if
(
GSSAPI_FLAVOR_MIT
)
find_library
(
GSSAPI_LIBRARY
find_library
(
GSSAPI_LIBRARY
NAMES
NAMES gssapi_krb5
gssapi_krb5
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
${
_GSSAPI_LIBDIR
}
)
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
${
_GSSAPI_LIBDIR
}
)
find_library
(
KRB5_LIBRARY
find_library
(
KRB5_LIBRARY
NAMES
NAMES krb5
krb5
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
${
_GSSAPI_LIBDIR
}
)
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
${
_GSSAPI_LIBDIR
}
)
find_library
(
K5CRYPTO_LIBRARY
find_library
(
K5CRYPTO_LIBRARY
NAMES
NAMES k5crypto
k5crypto
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
${
_GSSAPI_LIBDIR
}
)
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
${
_GSSAPI_LIBDIR
}
)
find_library
(
COM_ERR_LIBRARY
find_library
(
COM_ERR_LIBRARY
NAMES
NAMES com_err
com_err
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
${
_GSSAPI_LIBDIR
}
)
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
if
(
GSSAPI_LIBRARY
)
${
_GSSAPI_LIBDIR
}
set
(
GSSAPI_LIBRARIES
${
GSSAPI_LIBRARIES
}
${
GSSAPI_LIBRARY
}
)
)
endif
()
if
(
GSSAPI_LIBRARY
)
if
(
KRB5_LIBRARY
)
set
(
GSSAPI_LIBRARIES
set
(
GSSAPI_LIBRARIES
${
GSSAPI_LIBRARIES
}
${
KRB5_LIBRARY
}
)
${
GSSAPI_LIBRARIES
}
endif
()
${
GSSAPI_LIBRARY
}
)
if
(
K5CRYPTO_LIBRARY
)
endif
(
GSSAPI_LIBRARY
)
set
(
GSSAPI_LIBRARIES
${
GSSAPI_LIBRARIES
}
${
K5CRYPTO_LIBRARY
}
)
endif
()
if
(
KRB5_LIBRARY
)
set
(
GSSAPI_LIBRARIES
if
(
COM_ERR_LIBRARY
)
${
GSSAPI_LIBRARIES
}
set
(
GSSAPI_LIBRARIES
${
GSSAPI_LIBRARIES
}
${
COM_ERR_LIBRARY
}
)
${
KRB5_LIBRARY
}
endif
()
)
endif
()
endif
(
KRB5_LIBRARY
)
if
(
GSSAPI_FLAVOR_HEIMDAL
)
if
(
K5CRYPTO_LIBRARY
)
set
(
GSSAPI_LIBRARIES
${
GSSAPI_LIBRARIES
}
${
K5CRYPTO_LIBRARY
}
)
endif
(
K5CRYPTO_LIBRARY
)
if
(
COM_ERR_LIBRARY
)
set
(
GSSAPI_LIBRARIES
${
GSSAPI_LIBRARIES
}
${
COM_ERR_LIBRARY
}
)
endif
(
COM_ERR_LIBRARY
)
endif
(
GSSAPI_FLAVOR_MIT
)
if
(
GSSAPI_FLAVOR_HEIMDAL
)
find_library
(
GSSAPI_LIBRARY
find_library
(
GSSAPI_LIBRARY
NAMES
NAMES gssapi
gssapi
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
${
_GSSAPI_LIBDIR
}
)
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
${
_GSSAPI_LIBDIR
}
)
find_library
(
KRB5_LIBRARY
find_library
(
KRB5_LIBRARY
NAMES
NAMES krb5
krb5
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
${
_GSSAPI_LIBDIR
}
)
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
${
_GSSAPI_LIBDIR
}
)
find_library
(
HCRYPTO_LIBRARY
find_library
(
HCRYPTO_LIBRARY
NAMES
NAMES hcrypto
hcrypto
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
${
_GSSAPI_LIBDIR
}
)
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
${
_GSSAPI_LIBDIR
}
)
find_library
(
COM_ERR_LIBRARY
find_library
(
COM_ERR_LIBRARY
NAMES
NAMES com_err
com_err
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
${
_GSSAPI_LIBDIR
}
)
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
${
_GSSAPI_LIBDIR
}
)
find_library
(
HEIMNTLM_LIBRARY
find_library
(
HEIMNTLM_LIBRARY
NAMES
NAMES heimntlm
heimntlm
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
${
_GSSAPI_LIBDIR
}
)
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
${
_GSSAPI_LIBDIR
}
)
find_library
(
HX509_LIBRARY
find_library
(
HX509_LIBRARY
NAMES
NAMES hx509
hx509
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
${
_GSSAPI_LIBDIR
}
)
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
${
_GSSAPI_LIBDIR
}
)
find_library
(
ASN1_LIBRARY
find_library
(
ASN1_LIBRARY
NAMES
NAMES asn1
asn1
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
${
_GSSAPI_LIBDIR
}
)
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
${
_GSSAPI_LIBDIR
}
)
find_library
(
WIND_LIBRARY
find_library
(
WIND_LIBRARY
NAMES
NAMES wind
wind
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
${
_GSSAPI_LIBDIR
}
)
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
${
_GSSAPI_LIBDIR
}
)
find_library
(
ROKEN_LIBRARY
find_library
(
ROKEN_LIBRARY
NAMES
NAMES roken
roken
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
${
_GSSAPI_LIBDIR
}
)
PATHS
${
GSSAPI_ROOT_DIR
}
/lib
if
(
GSSAPI_LIBRARY
)
${
_GSSAPI_LIBDIR
}
set
(
GSSAPI_LIBRARIES
${
GSSAPI_LIBRARIES
}
${
GSSAPI_LIBRARY
}
)
)
endif
()
if
(
GSSAPI_LIBRARY
)
if
(
KRB5_LIBRARY
)
set
(
GSSAPI_LIBRARIES
set
(
GSSAPI_LIBRARIES
${
GSSAPI_LIBRARIES
}
${
KRB5_LIBRARY
}
)
${
GSSAPI_LIBRARIES
}
endif
()
${
GSSAPI_LIBRARY
}
)
if
(
HCRYPTO_LIBRARY
)
endif
(
GSSAPI_LIBRARY
)
set
(
GSSAPI_LIBRARIES
${
GSSAPI_LIBRARIES
}
${
HCRYPTO_LIBRARY
}
)
endif
()
if
(
KRB5_LIBRARY
)
set
(
GSSAPI_LIBRARIES
if
(
COM_ERR_LIBRARY
)
${
GSSAPI_LIBRARIES
}
set
(
GSSAPI_LIBRARIES
${
GSSAPI_LIBRARIES
}
${
COM_ERR_LIBRARY
}
)
${
KRB5_LIBRARY
}
endif
()
)
endif
(
KRB5_LIBRARY
)
if
(
HEIMNTLM_LIBRARY
)
set
(
GSSAPI_LIBRARIES
${
GSSAPI_LIBRARIES
}
${
HEIMNTLM_LIBRARY
}
)
if
(
HCRYPTO_LIBRARY
)
endif
()
set
(
GSSAPI_LIBRARIES
${
GSSAPI_LIBRARIES
}
if
(
HX509_LIBRARY
)
${
HCRYPTO_LIBRARY
}
set
(
GSSAPI_LIBRARIES
${
GSSAPI_LIBRARIES
}
${
HX509_LIBRARY
}
)
)
endif
()
endif
(
HCRYPTO_LIBRARY
)
if
(
ASN1_LIBRARY
)
if
(
COM_ERR_LIBRARY
)
set
(
GSSAPI_LIBRARIES
${
GSSAPI_LIBRARIES
}
${
ASN1_LIBRARY
}
)
set
(
GSSAPI_LIBRARIES
endif
()
${
GSSAPI_LIBRARIES
}
${
COM_ERR_LIBRARY
}
if
(
WIND_LIBRARY
)
)
set
(
GSSAPI_LIBRARIES
${
GSSAPI_LIBRARIES
}
${
WIND_LIBRARY
}
)
endif
(
COM_ERR_LIBRARY
)
endif
()
if
(
HEIMNTLM_LIBRARY
)
if
(
ROKEN_LIBRARY
)
set
(
GSSAPI_LIBRARIES
set
(
GSSAPI_LIBRARIES
${
GSSAPI_LIBRARIES
}
${
WIND_LIBRARY
}
)
${
GSSAPI_LIBRARIES
}
endif
()
${
HEIMNTLM_LIBRARY
}
endif
()
)
endif
(
HEIMNTLM_LIBRARY
)
if
(
HX509_LIBRARY
)
set
(
GSSAPI_LIBRARIES
${
GSSAPI_LIBRARIES
}
${
HX509_LIBRARY
}
)
endif
(
HX509_LIBRARY
)
if
(
ASN1_LIBRARY
)
set
(
GSSAPI_LIBRARIES
${
GSSAPI_LIBRARIES
}
${
ASN1_LIBRARY
}
)
endif
(
ASN1_LIBRARY
)
if
(
WIND_LIBRARY
)
set
(
GSSAPI_LIBRARIES
${
GSSAPI_LIBRARIES
}
${
WIND_LIBRARY
}
)
endif
(
WIND_LIBRARY
)
if
(
ROKEN_LIBRARY
)
set
(
GSSAPI_LIBRARIES
${
GSSAPI_LIBRARIES
}
${
WIND_LIBRARY
}
)
endif
(
ROKEN_LIBRARY
)
endif
(
GSSAPI_FLAVOR_HEIMDAL
)
include
(
FindPackageHandleStandardArgs
)
include
(
FindPackageHandleStandardArgs
)
find_package_handle_standard_args
(
GSSAPI DEFAULT_MSG GSSAPI_LIBRARIES GSSAPI_INCLUDE_DIR
)
find_package_handle_standard_args
(
GSSAPI DEFAULT_MSG GSSAPI_LIBRARIES GSSAPI_INCLUDE_DIR
)
if
(
GSSAPI_INCLUDE_DIRS AND GSSAPI_LIBRARIES
)
if
(
GSSAPI_INCLUDE_DIRS AND GSSAPI_LIBRARIES
)
set
(
GSSAPI_FOUND TRUE
)
set
(
GSSAPI_FOUND TRUE
)
endif
(
GSSAPI_INCLUDE_DIRS AND GSSAPI_LIBRARIES
)
endif
(
GSSAPI_INCLUDE_DIRS AND GSSAPI_LIBRARIES
)
# show the GSSAPI_INCLUDE_DIRS and GSSAPI_LIBRARIES variables only in the advanced view
# show the GSSAPI_INCLUDE_DIRS and GSSAPI_LIBRARIES variables only in the advanced view
mark_as_advanced
(
GSSAPI_INCLUDE_DIRS GSSAPI_LIBRARIES
)
mark_as_advanced
(
GSSAPI_INCLUDE_DIRS GSSAPI_LIBRARIES
)
cmake/FindGSSFramework.cmake
View file @
c3fec456
...
@@ -7,21 +7,21 @@
...
@@ -7,21 +7,21 @@
# GSSFRAMEWORK_LDFLAGS
# GSSFRAMEWORK_LDFLAGS
#
#
FIND_PATH
(
GSSFRAMEWORK_INCLUDE_DIR NAMES GSS.h
)
find_path
(
GSSFRAMEWORK_INCLUDE_DIR NAMES GSS.h
)
FIND_LIBRARY
(
GSSFRAMEWORK_LIBRARIES NAMES GSS
)
find_library
(
GSSFRAMEWORK_LIBRARIES NAMES GSS
)
IF
(
GSSFRAMEWORK_INCLUDE_DIR AND GSSFRAMEWORK_LIBRARIES
)
if
(
GSSFRAMEWORK_INCLUDE_DIR AND GSSFRAMEWORK_LIBRARIES
)
IF
(
NOT CoreFoundation_FIND_QUIETLY
)
if
(
NOT CoreFoundation_FIND_QUIETLY
)
MESSAGE
(
STATUS
"Found GSS.framework
${
GSSFRAMEWORK_LIBRARIES
}
"
)
message
(
STATUS
"Found GSS.framework
${
GSSFRAMEWORK_LIBRARIES
}
"
)
ENDIF
()
endif
()
SET
(
GSSFRAMEWORK_FOUND TRUE
)
set
(
GSSFRAMEWORK_FOUND TRUE
)
SET
(
GSSFRAMEWORK_LDFLAGS
"-framework GSS"
)
set
(
GSSFRAMEWORK_LDFLAGS
"-framework GSS"
)
ENDIF
()
endif
()
IF
(
GSS_FIND_REQUIRED AND NOT GSSFRAMEWORK_FOUND
)
if
(
GSS_FIND_REQUIRED AND NOT GSSFRAMEWORK_FOUND
)
MESSAGE
(
FATAL_ERROR
"CoreFoundation not found"
)
message
(
FATAL_ERROR
"CoreFoundation not found"
)
ENDIF
()
endif
()
MARK_AS_ADVANCED
(
mark_as_advanced
(
GSSFRAMEWORK_INCLUDE_DIR
GSSFRAMEWORK_INCLUDE_DIR
GSSFRAMEWORK_LIBRARIES
GSSFRAMEWORK_LIBRARIES
GSSFRAMEWORK_LDFLAGS
GSSFRAMEWORK_LDFLAGS
...
...
cmake/FindHTTPParser.cmake
View file @
c3fec456
...
@@ -10,30 +10,30 @@
...
@@ -10,30 +10,30 @@
# HTTP_PARSER_VERSION_STRING - the version of http-parser found
# HTTP_PARSER_VERSION_STRING - the version of http-parser found
# Find the header and library
# Find the header and library
FIND_PATH
(
HTTP_PARSER_INCLUDE_DIR NAMES http_parser.h
)
find_path
(
HTTP_PARSER_INCLUDE_DIR NAMES http_parser.h
)
FIND_LIBRARY
(
HTTP_PARSER_LIBRARY NAMES http_parser libhttp_parser
)
find_library
(
HTTP_PARSER_LIBRARY NAMES http_parser libhttp_parser
)
# Found the header, read version
# Found the header, read version
if
(
HTTP_PARSER_INCLUDE_DIR AND EXISTS
"
${
HTTP_PARSER_INCLUDE_DIR
}
/http_parser.h"
)
if
(
HTTP_PARSER_INCLUDE_DIR AND EXISTS
"
${
HTTP_PARSER_INCLUDE_DIR
}
/http_parser.h"
)
FILE
(
READ
"
${
HTTP_PARSER_INCLUDE_DIR
}
/http_parser.h"
HTTP_PARSER_H
)
file
(
READ
"
${
HTTP_PARSER_INCLUDE_DIR
}
/http_parser.h"
HTTP_PARSER_H
)
IF
(
HTTP_PARSER_H
)
if
(
HTTP_PARSER_H
)
STRING
(
REGEX REPLACE
".*#define[
\t
]+HTTP_PARSER_VERSION_MAJOR[
\t
]+([0-9]+).*"
"
\\
1"
HTTP_PARSER_VERSION_MAJOR
"
${
HTTP_PARSER_H
}
"
)
string
(
REGEX REPLACE
".*#define[
\t
]+HTTP_PARSER_VERSION_MAJOR[
\t
]+([0-9]+).*"
"
\\
1"
HTTP_PARSER_VERSION_MAJOR
"
${
HTTP_PARSER_H
}
"
)
STRING
(
REGEX REPLACE
".*#define[
\t
]+HTTP_PARSER_VERSION_MINOR[
\t
]+([0-9]+).*"
"
\\
1"
HTTP_PARSER_VERSION_MINOR
"
${
HTTP_PARSER_H
}
"
)
string
(
REGEX REPLACE
".*#define[
\t
]+HTTP_PARSER_VERSION_MINOR[
\t
]+([0-9]+).*"
"
\\
1"
HTTP_PARSER_VERSION_MINOR
"
${
HTTP_PARSER_H
}
"
)
SET
(
HTTP_PARSER_VERSION_STRING
"
${
HTTP_PARSER_VERSION_MAJOR
}
.
${
HTTP_PARSER_VERSION_MINOR
}
"
)
set
(
HTTP_PARSER_VERSION_STRING
"
${
HTTP_PARSER_VERSION_MAJOR
}
.
${
HTTP_PARSER_VERSION_MINOR
}
"
)
ENDIF
()
endif
()
UNSET
(
HTTP_PARSER_H
)
unset
(
HTTP_PARSER_H
)
ENDIF
()
endif
()
# Handle the QUIETLY and REQUIRED arguments and set HTTP_PARSER_FOUND
# Handle the QUIETLY and REQUIRED arguments and set HTTP_PARSER_FOUND
# to TRUE if all listed variables are TRUE
# to TRUE if all listed variables are TRUE
INCLUDE
(
FindPackageHandleStandardArgs
)
include
(
FindPackageHandleStandardArgs
)
FIND_PACKAGE_HANDLE_STANDARD_ARGS
(
HTTP_Parser REQUIRED_VARS HTTP_PARSER_INCLUDE_DIR HTTP_PARSER_LIBRARY
)
find_package_handle_standard_args
(
HTTP_Parser REQUIRED_VARS HTTP_PARSER_INCLUDE_DIR HTTP_PARSER_LIBRARY
)
# Hide advanced variables
# Hide advanced variables
MARK_AS_ADVANCED
(
HTTP_PARSER_INCLUDE_DIR HTTP_PARSER_LIBRARY
)
mark_as_advanced
(
HTTP_PARSER_INCLUDE_DIR HTTP_PARSER_LIBRARY
)
# Set standard variables
# Set standard variables
IF
(
HTTP_PARSER_FOUND
)
if
(
HTTP_PARSER_FOUND
)
SET
(
HTTP_PARSER_LIBRARIES
${
HTTP_PARSER_LIBRARY
}
)
set
(
HTTP_PARSER_LIBRARIES
${
HTTP_PARSER_LIBRARY
}
)
set
(
HTTP_PARSER_INCLUDE_DIRS
${
HTTP_PARSER_INCLUDE_DIR
}
)
set
(
HTTP_PARSER_INCLUDE_DIRS
${
HTTP_PARSER_INCLUDE_DIR
}
)
ENDIF
()
endif
()
cmake/FindIconv.cmake
View file @
c3fec456
...
@@ -6,40 +6,40 @@
...
@@ -6,40 +6,40 @@
# ICONV_LIBRARIES - Link these to use Iconv
# ICONV_LIBRARIES - Link these to use Iconv
#
#
IF
(
ICONV_INCLUDE_DIR AND ICONV_LIBRARIES
)
if
(
ICONV_INCLUDE_DIR AND ICONV_LIBRARIES
)
# Already in cache, be silent
# Already in cache, be silent
SET
(
ICONV_FIND_QUIETLY TRUE
)
set
(
ICONV_FIND_QUIETLY TRUE
)
ENDIF
()
endif
()
FIND_PATH
(
ICONV_INCLUDE_DIR iconv.h
)
find_path
(
ICONV_INCLUDE_DIR iconv.h
)
CHECK_FUNCTION_EXISTS
(
iconv_open libc_has_iconv
)
check_function_exists
(
iconv_open libc_has_iconv
)
FIND_LIBRARY
(
iconv_lib NAMES iconv libiconv libiconv-2 c
)
find_library
(
iconv_lib NAMES iconv libiconv libiconv-2 c
)
IF
(
ICONV_INCLUDE_DIR AND libc_has_iconv
)
if
(
ICONV_INCLUDE_DIR AND libc_has_iconv
)
SET
(
ICONV_FOUND TRUE
)
set
(
ICONV_FOUND TRUE
)
SET
(
ICONV_LIBRARIES
""
)
set
(
ICONV_LIBRARIES
""
)
IF
(
NOT ICONV_FIND_QUIETLY
)
if
(
NOT ICONV_FIND_QUIETLY
)
MESSAGE
(
STATUS
"Found Iconv: provided by libc"
)
message
(
STATUS
"Found Iconv: provided by libc"
)
ENDIF
(
NOT ICONV_FIND_QUIETLY
)
endif
(
NOT ICONV_FIND_QUIETLY
)
ELSEIF
(
ICONV_INCLUDE_DIR AND iconv_lib
)
elseif
(
ICONV_INCLUDE_DIR AND iconv_lib
)
SET
(
ICONV_FOUND TRUE
)
set
(
ICONV_FOUND TRUE
)
# split iconv into -L and -l linker options, so we can
# split iconv into -L and -l linker options, so we can
# set them for pkg-config
# set them for pkg-config
GET_FILENAME_COMPONENT
(
iconv_path
${
iconv_lib
}
PATH
)
get_filename_component
(
iconv_path
${
iconv_lib
}
PATH
)
GET_FILENAME_COMPONENT
(
iconv_name
${
iconv_lib
}
NAME_WE
)
get_filename_component
(
iconv_name
${
iconv_lib
}
NAME_WE
)
STRING
(
REGEX REPLACE
"^lib"
""
iconv_name
${
iconv_name
}
)
string
(
REGEX REPLACE
"^lib"
""
iconv_name
${
iconv_name
}
)
SET
(
ICONV_LIBRARIES
"-L
${
iconv_path
}
-l
${
iconv_name
}
"
)
set
(
ICONV_LIBRARIES
"-L
${
iconv_path
}
-l
${
iconv_name
}
"
)
IF
(
NOT ICONV_FIND_QUIETLY
)
if
(
NOT ICONV_FIND_QUIETLY
)
MESSAGE
(
STATUS
"Found Iconv:
${
ICONV_LIBRARIES
}
"
)
message
(
STATUS
"Found Iconv:
${
ICONV_LIBRARIES
}
"
)
ENDIF
(
NOT ICONV_FIND_QUIETLY
)
endif
(
)
ELSE
()
else
()
IF
(
Iconv_FIND_REQUIRED
)
if
(
Iconv_FIND_REQUIRED
)
MESSAGE
(
FATAL_ERROR
"Could not find Iconv"
)
message
(
FATAL_ERROR
"Could not find Iconv"
)
ENDIF
(
Iconv_FIND_REQUIRED
)
endif
(
Iconv_FIND_REQUIRED
)
ENDIF
()
endif
()
MARK_AS_ADVANCED
(
mark_as_advanced
(
ICONV_INCLUDE_DIR
ICONV_INCLUDE_DIR
ICONV_LIBRARIES
ICONV_LIBRARIES
)
)
cmake/FindLibSSH2.cmake
View file @
c3fec456
...
@@ -2,12 +2,12 @@
...
@@ -2,12 +2,12 @@
# LIBSSH2_INCLUDE_DIR - the libssh2 include directory
# LIBSSH2_INCLUDE_DIR - the libssh2 include directory
# LIBSSH2_LIBRARY - the libssh2 library name
# LIBSSH2_LIBRARY - the libssh2 library name
FIND_PATH
(
LIBSSH2_INCLUDE_DIR libssh2.h
)
find_path
(
LIBSSH2_INCLUDE_DIR libssh2.h
)
FIND_LIBRARY
(
LIBSSH2_LIBRARY NAMES ssh2 libssh2
)
find_library
(
LIBSSH2_LIBRARY NAMES ssh2 libssh2
)
INCLUDE
(
FindPackageHandleStandardArgs
)
include
(
FindPackageHandleStandardArgs
)
find_package_handle_standard_args
(
LibSSH2
find_package_handle_standard_args
(
LibSSH2
REQUIRED_VARS LIBSSH2_LIBRARY LIBSSH2_INCLUDE_DIR
)
REQUIRED_VARS LIBSSH2_LIBRARY LIBSSH2_INCLUDE_DIR
)
MARK_AS_ADVANCED
(
LIBSSH2_INCLUDE_DIR LIBSSH2_LIBRARY
)
mark_as_advanced
(
LIBSSH2_INCLUDE_DIR LIBSSH2_LIBRARY
)
cmake/FindPCRE.cmake
View file @
c3fec456
...
@@ -16,23 +16,23 @@
...
@@ -16,23 +16,23 @@
# PCRE_FOUND - True if pcre found.
# PCRE_FOUND - True if pcre found.
# Look for the header file.
# Look for the header file.
FIND_PATH
(
PCRE_INCLUDE_DIR NAMES pcreposix.h
)
find_path
(
PCRE_INCLUDE_DIR NAMES pcreposix.h
)
# Look for the library.
# Look for the library.
FIND_LIBRARY
(
PCRE_LIBRARY NAMES pcre
)
find_library
(
PCRE_LIBRARY NAMES pcre
)
FIND_LIBRARY
(
PCRE_POSIX_LIBRARY NAMES pcreposix
)
find_library
(
PCRE_POSIX_LIBRARY NAMES pcreposix
)
# Handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if all listed variables are TRUE.
# Handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if all listed variables are TRUE.
INCLUDE
(
FindPackageHandleStandardArgs
)
include
(
FindPackageHandleStandardArgs
)
FIND_PACKAGE_HANDLE_STANDARD_ARGS
(
PCRE DEFAULT_MSG PCRE_LIBRARY PCRE_POSIX_LIBRARY PCRE_INCLUDE_DIR
)
find_package_handle_standard_args
(
PCRE DEFAULT_MSG PCRE_LIBRARY PCRE_POSIX_LIBRARY PCRE_INCLUDE_DIR
)
# Copy the results to the output variables.
# Copy the results to the output variables.
IF
(
PCRE_FOUND
)
if
(
PCRE_FOUND
)
SET
(
PCRE_LIBRARIES
${
PCRE_LIBRARY
}
${
PCRE_POSIX_LIBRARY
}
)
set
(
PCRE_LIBRARIES
${
PCRE_LIBRARY
}
${
PCRE_POSIX_LIBRARY
}
)
SET
(
PCRE_INCLUDE_DIRS
${
PCRE_INCLUDE_DIR
}
)
set
(
PCRE_INCLUDE_DIRS
${
PCRE_INCLUDE_DIR
}
)
ELSE
(
PCRE_FOUND
)
else
(
PCRE_FOUND
)
SET
(
PCRE_LIBRARIES
)
set
(
PCRE_LIBRARIES
)
SET
(
PCRE_INCLUDE_DIRS
)
set
(
PCRE_INCLUDE_DIRS
)
ENDIF
(
PCRE_FOUND
)
endif
(
)
MARK_AS_ADVANCED
(
PCRE_INCLUDE_DIRS PCRE_LIBRARIES
)
mark_as_advanced
(
PCRE_INCLUDE_DIRS PCRE_LIBRARIES
)
cmake/FindPCRE2.cmake
View file @
c3fec456
...
@@ -16,22 +16,22 @@
...
@@ -16,22 +16,22 @@
# PCRE2_FOUND - True if pcre found.
# PCRE2_FOUND - True if pcre found.
# Look for the header file.
# Look for the header file.
FIND_PATH
(
PCRE2_INCLUDE_DIR NAMES pcre2posix.h
)
find_path
(
PCRE2_INCLUDE_DIR NAMES pcre2posix.h
)
# Look for the library.
# Look for the library.
FIND_LIBRARY
(
PCRE2_LIBRARY NAMES pcre2-8
)
find_library
(
PCRE2_LIBRARY NAMES pcre2-8
)
# Handle the QUIETLY and REQUIRED arguments and set PCRE2_FOUND to TRUE if all listed variables are TRUE.
# Handle the QUIETLY and REQUIRED arguments and set PCRE2_FOUND to TRUE if all listed variables are TRUE.
INCLUDE
(
FindPackageHandleStandardArgs
)
include
(
FindPackageHandleStandardArgs
)
FIND_PACKAGE_HANDLE_STANDARD_ARGS
(
PCRE2 DEFAULT_MSG PCRE2_LIBRARY PCRE2_INCLUDE_DIR
)
find_package_handle_standard_args
(
PCRE2 DEFAULT_MSG PCRE2_LIBRARY PCRE2_INCLUDE_DIR
)
# Copy the results to the output variables.
# Copy the results to the output variables.
IF
(
PCRE2_FOUND
)
if
(
PCRE2_FOUND
)
SET
(
PCRE2_LIBRARIES
${
PCRE2_LIBRARY
}
)
set
(
PCRE2_LIBRARIES
${
PCRE2_LIBRARY
}
)
SET
(
PCRE2_INCLUDE_DIRS
${
PCRE2_INCLUDE_DIR
}
)
set
(
PCRE2_INCLUDE_DIRS
${
PCRE2_INCLUDE_DIR
}
)
ELSE
(
PCRE2_FOUND
)
else
(
PCRE2_FOUND
)
SET
(
PCRE2_LIBRARIES
)
set
(
PCRE2_LIBRARIES
)
SET
(
PCRE2_INCLUDE_DIRS
)
set
(
PCRE2_INCLUDE_DIRS
)
ENDIF
(
PCRE2_FOUND
)
endif
(
)
MARK_AS_ADVANCED
(
PCRE2_INCLUDE_DIRS PCRE2_LIBRARIES
)
mark_as_advanced
(
PCRE2_INCLUDE_DIRS PCRE2_LIBRARIES
)
cmake/FindPkgLibraries.cmake
View file @
c3fec456
INCLUDE
(
FindPkgConfig
)
include
(
FindPkgConfig
)
# This function will find and set up a pkg-config based module.
# This function will find and set up a pkg-config based module.
# If a pc-file was found, it will resolve library paths to
# If a pc-file was found, it will resolve library paths to
# absolute paths. Furthermore, the function will automatically
# absolute paths. Furthermore, the function will automatically
# fall back to use static libraries in case no dynamic libraries
# fall back to use static libraries in case no dynamic libraries
# were found.
# were found.
FUNCTION
(
FIND_PKGLIBRARIES prefix package
)
function
(
FIND_PKGLIBRARIES prefix package
)
PKG_CHECK_MODULES
(
${
prefix
}
${
package
}
)
pkg_check_modules
(
${
prefix
}
${
package
}
)
IF
(
NOT
${
prefix
}
_FOUND
)
if
(
NOT
${
prefix
}
_FOUND
)
RETURN
()
return
()
ENDIF
()
endif
()
FOREACH
(
LIBRARY
${${
prefix
}
_LIBRARIES
}
)
foreach
(
LIBRARY
${${
prefix
}
_LIBRARIES
}
)
FIND_LIBRARY
(
${
LIBRARY
}
_RESOLVED
${
LIBRARY
}
PATHS
${${
prefix
}
_LIBRARY_DIRS
}
)
find_library
(
${
LIBRARY
}
_RESOLVED
${
LIBRARY
}
PATHS
${${
prefix
}
_LIBRARY_DIRS
}
)
IF
(
${${
LIBRARY
}
_RESOLVED
}
STREQUAL
"
${
LIBRARY
}
_RESOLVED-NOTFOUND"
)
if
(
${${
LIBRARY
}
_RESOLVED
}
STREQUAL
"
${
LIBRARY
}
_RESOLVED-NOTFOUND"
)
MESSAGE
(
FATAL_ERROR
"could not resolve
${
LIBRARY
}
"
)
message
(
FATAL_ERROR
"could not resolve
${
LIBRARY
}
"
)
ENDIF
()
endif
()
LIST
(
APPEND RESOLVED_LIBRARIES
${${
LIBRARY
}
_RESOLVED
}
)
list
(
APPEND RESOLVED_LIBRARIES
${${
LIBRARY
}
_RESOLVED
}
)
ENDFOREACH
(
LIBRARY
)
endforeach
(
)
SET
(
${
prefix
}
_FOUND 1 PARENT_SCOPE
)
set
(
${
prefix
}
_FOUND 1 PARENT_SCOPE
)
SET
(
${
prefix
}
_LIBRARIES
${
RESOLVED_LIBRARIES
}
PARENT_SCOPE
)
set
(
${
prefix
}
_LIBRARIES
${
RESOLVED_LIBRARIES
}
PARENT_SCOPE
)
SET
(
${
prefix
}
_INCLUDE_DIRS
${${
prefix
}
_INCLUDE_DIRS
}
PARENT_SCOPE
)
set
(
${
prefix
}
_INCLUDE_DIRS
${${
prefix
}
_INCLUDE_DIRS
}
PARENT_SCOPE
)
SET
(
${
prefix
}
_LDFLAGS
${${
prefix
}
_LDFLAGS
}
PARENT_SCOPE
)
set
(
${
prefix
}
_LDFLAGS
${${
prefix
}
_LDFLAGS
}
PARENT_SCOPE
)
MESSAGE
(
STATUS
" Resolved libraries:
${
RESOLVED_LIBRARIES
}
"
)
message
(
STATUS
" Resolved libraries:
${
RESOLVED_LIBRARIES
}
"
)
ENDFUNCTION
()
endfunction
()
cmake/FindSecurity.cmake
View file @
c3fec456
...
@@ -7,22 +7,22 @@
...
@@ -7,22 +7,22 @@
# SECURITY_HAS_SSLCREATECONTEXT
# SECURITY_HAS_SSLCREATECONTEXT
#
#
FIND_PATH
(
SECURITY_INCLUDE_DIR NAMES Security/Security.h
)
find_path
(
SECURITY_INCLUDE_DIR NAMES Security/Security.h
)
FIND_LIBRARY
(
SECURITY_LIBRARIES NAMES Security
)
find_library
(
SECURITY_LIBRARIES NAMES Security
)
IF
(
SECURITY_INCLUDE_DIR AND SECURITY_LIBRARIES
)
if
(
SECURITY_INCLUDE_DIR AND SECURITY_LIBRARIES
)
IF
(
NOT Security_FIND_QUIETLY
)
if
(
NOT Security_FIND_QUIETLY
)
MESSAGE
(
STATUS
"Found Security
${
SECURITY_LIBRARIES
}
"
)
message
(
STATUS
"Found Security
${
SECURITY_LIBRARIES
}
"
)
ENDIF
()
endif
()
SET
(
SECURITY_FOUND TRUE
)
set
(
SECURITY_FOUND TRUE
)
SET
(
SECURITY_LDFLAGS
"-framework Security"
)
set
(
SECURITY_LDFLAGS
"-framework Security"
)
CHECK_LIBRARY_EXISTS
(
"
${
SECURITY_LIBRARIES
}
"
SSLCreateContext
"Security/SecureTransport.h"
SECURITY_HAS_SSLCREATECONTEXT
)
check_library_exists
(
"
${
SECURITY_LIBRARIES
}
"
SSLCreateContext
"Security/SecureTransport.h"
SECURITY_HAS_SSLCREATECONTEXT
)
ENDIF
()
endif
()
IF
(
Security_FIND_REQUIRED AND NOT SECURITY_FOUND
)
if
(
Security_FIND_REQUIRED AND NOT SECURITY_FOUND
)
MESSAGE
(
FATAL_ERROR
"Security not found"
)
message
(
FATAL_ERROR
"Security not found"
)
ENDIF
()
endif
()
MARK_AS_ADVANCED
(
mark_as_advanced
(
SECURITY_INCLUDE_DIR
SECURITY_INCLUDE_DIR
SECURITY_LIBRARIES
SECURITY_LIBRARIES
)
)
cmake/Findfutimens.cmake
View file @
c3fec456
INCLUDE
(
EnableWarnings
)
include
(
EnableWarnings
)
IF
(
APPLE
)
if
(
APPLE
)
# We cannot simply CHECK_FUNCTION_EXISTS on macOS because
# We cannot simply CHECK_FUNCTION_EXISTS on macOS because
# MACOSX_DEPLOYMENT_TARGET may be set to a version in the past
# MACOSX_DEPLOYMENT_TARGET may be set to a version in the past
# that doesn't have futimens. Instead we need to enable warnings
# that doesn't have futimens. Instead we need to enable warnings
# as errors, then check for the symbol existing in `sys/stat.h`,
# as errors, then check for the symbol existing in `sys/stat.h`,
# then reset warnings as errors.
# then reset warnings as errors.
ENABLE_WARNINGS
(
error
)
enable_warnings
(
error
)
CHECK_SYMBOL_EXISTS
(
futimens sys/stat.h HAVE_FUTIMENS
)
check_symbol_exists
(
futimens sys/stat.h HAVE_FUTIMENS
)
DISABLE_WARNINGS
(
error
)
disable_warnings
(
error
)
ELSE
()
else
()
CHECK_FUNCTION_EXISTS
(
futimens HAVE_FUTIMENS
)
check_function_exists
(
futimens HAVE_FUTIMENS
)
ENDIF
()
endif
()
cmake/FindmbedTLS.cmake
View file @
c3fec456
...
@@ -13,81 +13,74 @@
...
@@ -13,81 +13,74 @@
# Hint
# Hint
# MBEDTLS_ROOT_DIR can be pointed to a local mbedTLS installation.
# MBEDTLS_ROOT_DIR can be pointed to a local mbedTLS installation.
SET
(
_MBEDTLS_ROOT_HINTS
set
(
_MBEDTLS_ROOT_HINTS
${
MBEDTLS_ROOT_DIR
}
${
MBEDTLS_ROOT_DIR
}
ENV MBEDTLS_ROOT_DIR
ENV MBEDTLS_ROOT_DIR
)
)
SET
(
_MBEDTLS_ROOT_HINTS_AND_PATHS
set
(
_MBEDTLS_ROOT_HINTS_AND_PATHS
HINTS
${
_MBEDTLS_ROOT_HINTS
}
HINTS
${
_MBEDTLS_ROOT_HINTS
}
PATHS
${
_MBEDTLS_ROOT_PATHS
}
PATHS
${
_MBEDTLS_ROOT_PATHS
}
)
)
FIND_PATH
(
MBEDTLS_INCLUDE_DIR
find_path
(
MBEDTLS_INCLUDE_DIR
NAMES mbedtls/version.h
NAMES mbedtls/version.h
${
_MBEDTLS_ROOT_HINTS_AND_PATHS
}
${
_MBEDTLS_ROOT_HINTS_AND_PATHS
}
PATH_SUFFIXES include
PATH_SUFFIXES include
)
)
IF
(
MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARIES
)
if
(
MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARIES
)
# Already in cache, be silent
# Already in cache, be silent
SET
(
MBEDTLS_FIND_QUIETLY TRUE
)
set
(
MBEDTLS_FIND_QUIETLY TRUE
)
ENDIF
()
endif
()
FIND_LIBRARY
(
MBEDTLS_LIBRARY
find_library
(
MBEDTLS_LIBRARY
NAMES mbedtls libmbedtls
NAMES mbedtls libmbedtls
${
_MBEDTLS_ROOT_HINTS_AND_PATHS
}
${
_MBEDTLS_ROOT_HINTS_AND_PATHS
}
PATH_SUFFIXES library
PATH_SUFFIXES library
)
)
find_library
(
MBEDX509_LIBRARY
FIND_LIBRARY
(
MBEDX509_LIBRARY
NAMES mbedx509 libmbedx509
NAMES mbedx509 libmbedx509
${
_MBEDTLS_ROOT_HINTS_AND_PATHS
}
${
_MBEDTLS_ROOT_HINTS_AND_PATHS
}
PATH_SUFFIXES library
PATH_SUFFIXES library
)
)
find_library
(
MBEDCRYPTO_LIBRARY
FIND_LIBRARY
(
MBEDCRYPTO_LIBRARY
NAMES mbedcrypto libmbedcrypto
NAMES mbedcrypto libmbedcrypto
${
_MBEDTLS_ROOT_HINTS_AND_PATHS
}
${
_MBEDTLS_ROOT_HINTS_AND_PATHS
}
PATH_SUFFIXES library
PATH_SUFFIXES library
)
)
IF
(
MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARY AND MBEDX509_LIBRARY AND MBEDCRYPTO_LIBRARY
)
if
(
MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARY AND MBEDX509_LIBRARY AND MBEDCRYPTO_LIBRARY
)
SET
(
MBEDTLS_FOUND TRUE
)
set
(
MBEDTLS_FOUND TRUE
)
ENDIF
()
endif
()
IF
(
MBEDTLS_FOUND
)
if
(
MBEDTLS_FOUND
)
# split mbedTLS into -L and -l linker options, so we can set them for pkg-config
# split mbedTLS into -L and -l linker options, so we can set them for pkg-config
GET_FILENAME_COMPONENT
(
MBEDTLS_LIBRARY_DIR
${
MBEDTLS_LIBRARY
}
PATH
)
get_filename_component
(
MBEDTLS_LIBRARY_DIR
${
MBEDTLS_LIBRARY
}
PATH
)
GET_FILENAME_COMPONENT
(
MBEDTLS_LIBRARY_FILE
${
MBEDTLS_LIBRARY
}
NAME_WE
)
get_filename_component
(
MBEDTLS_LIBRARY_FILE
${
MBEDTLS_LIBRARY
}
NAME_WE
)
GET_FILENAME_COMPONENT
(
MBEDX509_LIBRARY_FILE
${
MBEDX509_LIBRARY
}
NAME_WE
)
get_filename_component
(
MBEDX509_LIBRARY_FILE
${
MBEDX509_LIBRARY
}
NAME_WE
)
GET_FILENAME_COMPONENT
(
MBEDCRYPTO_LIBRARY_FILE
${
MBEDCRYPTO_LIBRARY
}
NAME_WE
)
get_filename_component
(
MBEDCRYPTO_LIBRARY_FILE
${
MBEDCRYPTO_LIBRARY
}
NAME_WE
)
STRING
(
REGEX REPLACE
"^lib"
""
MBEDTLS_LIBRARY_FILE
${
MBEDTLS_LIBRARY_FILE
}
)
string
(
REGEX REPLACE
"^lib"
""
MBEDTLS_LIBRARY_FILE
${
MBEDTLS_LIBRARY_FILE
}
)
STRING
(
REGEX REPLACE
"^lib"
""
MBEDX509_LIBRARY_FILE
${
MBEDX509_LIBRARY_FILE
}
)
string
(
REGEX REPLACE
"^lib"
""
MBEDX509_LIBRARY_FILE
${
MBEDX509_LIBRARY_FILE
}
)
STRING
(
REGEX REPLACE
"^lib"
""
MBEDCRYPTO_LIBRARY_FILE
${
MBEDCRYPTO_LIBRARY_FILE
}
)
string
(
REGEX REPLACE
"^lib"
""
MBEDCRYPTO_LIBRARY_FILE
${
MBEDCRYPTO_LIBRARY_FILE
}
)
SET
(
MBEDTLS_LIBRARIES
"-L
${
MBEDTLS_LIBRARY_DIR
}
-l
${
MBEDTLS_LIBRARY_FILE
}
-l
${
MBEDX509_LIBRARY_FILE
}
-l
${
MBEDCRYPTO_LIBRARY_FILE
}
"
)
set
(
MBEDTLS_LIBRARIES
"-L
${
MBEDTLS_LIBRARY_DIR
}
-l
${
MBEDTLS_LIBRARY_FILE
}
-l
${
MBEDX509_LIBRARY_FILE
}
-l
${
MBEDCRYPTO_LIBRARY_FILE
}
"
)
IF
(
NOT MBEDTLS_FIND_QUIETLY
)
if
(
NOT MBEDTLS_FIND_QUIETLY
)
MESSAGE
(
STATUS
"Found mbedTLS:"
)
message
(
STATUS
"Found mbedTLS:"
)
FILE
(
READ
${
MBEDTLS_INCLUDE_DIR
}
/mbedtls/version.h MBEDTLSCONTENT
)
file
(
READ
${
MBEDTLS_INCLUDE_DIR
}
/mbedtls/version.h MBEDTLSCONTENT
)
STRING
(
REGEX MATCH
"MBEDTLS_VERSION_STRING +
\"
[0-9|.]+
\"
"
MBEDTLSMATCH
${
MBEDTLSCONTENT
}
)
string
(
REGEX MATCH
"MBEDTLS_VERSION_STRING +
\"
[0-9|.]+
\"
"
MBEDTLSMATCH
${
MBEDTLSCONTENT
}
)
IF
(
MBEDTLSMATCH
)
if
(
MBEDTLSMATCH
)
STRING
(
REGEX REPLACE
"MBEDTLS_VERSION_STRING +
\"
([0-9|.]+)
\"
"
"
\\
1"
MBEDTLS_VERSION
${
MBEDTLSMATCH
}
)
string
(
REGEX REPLACE
"MBEDTLS_VERSION_STRING +
\"
([0-9|.]+)
\"
"
"
\\
1"
MBEDTLS_VERSION
${
MBEDTLSMATCH
}
)
MESSAGE
(
STATUS
" version
${
MBEDTLS_VERSION
}
"
)
message
(
STATUS
" version
${
MBEDTLS_VERSION
}
"
)
ENDIF
(
MBEDTLSMATCH
)
endif
(
)
MESSAGE
(
STATUS
" TLS:
${
MBEDTLS_LIBRARY
}
"
)
message
(
STATUS
" TLS:
${
MBEDTLS_LIBRARY
}
"
)
MESSAGE
(
STATUS
" X509:
${
MBEDX509_LIBRARY
}
"
)
message
(
STATUS
" X509:
${
MBEDX509_LIBRARY
}
"
)
MESSAGE
(
STATUS
" Crypto:
${
MBEDCRYPTO_LIBRARY
}
"
)
message
(
STATUS
" Crypto:
${
MBEDCRYPTO_LIBRARY
}
"
)
ENDIF
(
NOT MBEDTLS_FIND_QUIETLY
)
endif
(
)
ELSE
(
MBEDTLS_FOUND
)
else
(
MBEDTLS_FOUND
)
IF
(
MBEDTLS_FIND_REQUIRED
)
if
(
MBEDTLS_FIND_REQUIRED
)
MESSAGE
(
FATAL_ERROR
"Could not find mbedTLS"
)
message
(
FATAL_ERROR
"Could not find mbedTLS"
)
ENDIF
(
MBEDTLS_FIND_REQUIRED
)
endif
(
)
ENDIF
(
MBEDTLS_FOUND
)
endif
(
)
MARK_AS_ADVANCED
(
mark_as_advanced
(
MBEDTLS_INCLUDE_DIR
MBEDTLS_INCLUDE_DIR
MBEDTLS_LIBRARY_DIR
MBEDTLS_LIBRARY_DIR
MBEDTLS_LIBRARIES
MBEDTLS_LIBRARIES
MBEDTLS_LIBRARY
MBEDTLS_LIBRARY
MBEDX509_LIBRARY
MBEDX509_LIBRARY
MBEDCRYPTO_LIBRARY
MBEDCRYPTO_LIBRARY
)
)
cmake/IdeSplitSources.cmake
View file @
c3fec456
...
@@ -3,20 +3,20 @@
...
@@ -3,20 +3,20 @@
# Visual Studio, so that you can navigate into the libgit2_tests project,
# Visual Studio, so that you can navigate into the libgit2_tests project,
# and see the folders within the tests folder (instead of just seeing all
# and see the folders within the tests folder (instead of just seeing all
# source and tests in a single folder.)
# source and tests in a single folder.)
FUNCTION
(
IDE_SPLIT_SOURCES target
)
function
(
IDE_SPLIT_SOURCES target
)
IF
(
MSVC_IDE OR CMAKE_GENERATOR STREQUAL Xcode
)
if
(
MSVC_IDE OR CMAKE_GENERATOR STREQUAL Xcode
)
GET_TARGET_PROPERTY
(
sources
${
target
}
SOURCES
)
get_target_property
(
sources
${
target
}
SOURCES
)
FOREACH
(
source
${
sources
}
)
foreach
(
source
${
sources
}
)
IF
(
source MATCHES
".*/"
)
if
(
source MATCHES
".*/"
)
STRING
(
REPLACE
${
libgit2_SOURCE_DIR
}
/
""
rel
${
source
}
)
string
(
REPLACE
${
libgit2_SOURCE_DIR
}
/
""
rel
${
source
}
)
IF
(
rel
)
if
(
rel
)
STRING
(
REGEX REPLACE
"/([^/]*)$"
""
rel
${
rel
}
)
string
(
REGEX REPLACE
"/([^/]*)$"
""
rel
${
rel
}
)
IF
(
rel
)
if
(
rel
)
STRING
(
REPLACE
"/"
"
\\\\
"
rel
${
rel
}
)
string
(
REPLACE
"/"
"
\\\\
"
rel
${
rel
}
)
SOURCE_GROUP
(
${
rel
}
FILES
${
source
}
)
source_group
(
${
rel
}
FILES
${
source
}
)
ENDIF
()
endif
()
ENDIF
()
endif
()
ENDIF
()
endif
()
ENDFOREACH
()
endforeach
()
ENDIF
()
endif
()
ENDFUNCTION
()
endfunction
()
cmake/PkgBuildConfig.cmake
View file @
c3fec456
cmake/SanitizeBool.cmake
View file @
c3fec456
FUNCTION
(
SanitizeBool VAR
)
function
(
SanitizeBool VAR
)
STRING
(
TOLOWER
"
${${
VAR
}}
"
VALUE
)
string
(
TOLOWER
"
${${
VAR
}}
"
VALUE
)
IF
(
VALUE STREQUAL
"on"
)
if
(
VALUE STREQUAL
"on"
)
SET
(
${
VAR
}
"ON"
PARENT_SCOPE
)
set
(
${
VAR
}
"ON"
PARENT_SCOPE
)
ELSEIF
(
VALUE STREQUAL
"yes"
)
elseif
(
VALUE STREQUAL
"yes"
)
SET
(
${
VAR
}
"ON"
PARENT_SCOPE
)
set
(
${
VAR
}
"ON"
PARENT_SCOPE
)
ELSEIF
(
VALUE STREQUAL
"true"
)
elseif
(
VALUE STREQUAL
"true"
)
SET
(
${
VAR
}
"ON"
PARENT_SCOPE
)
set
(
${
VAR
}
"ON"
PARENT_SCOPE
)
ELSEIF
(
VALUE STREQUAL
"1"
)
elseif
(
VALUE STREQUAL
"1"
)
SET
(
${
VAR
}
"ON"
PARENT_SCOPE
)
set
(
${
VAR
}
"ON"
PARENT_SCOPE
)
ELSEIF
(
VALUE STREQUAL
"off"
)
elseif
(
VALUE STREQUAL
"off"
)
SET
(
${
VAR
}
"OFF"
PARENT_SCOPE
)
set
(
${
VAR
}
"OFF"
PARENT_SCOPE
)
ELSEIF
(
VALUE STREQUAL
"no"
)
elseif
(
VALUE STREQUAL
"no"
)
SET
(
${
VAR
}
"OFF"
PARENT_SCOPE
)
set
(
${
VAR
}
"OFF"
PARENT_SCOPE
)
ELSEIF
(
VALUE STREQUAL
"false"
)
elseif
(
VALUE STREQUAL
"false"
)
SET
(
${
VAR
}
"OFF"
PARENT_SCOPE
)
set
(
${
VAR
}
"OFF"
PARENT_SCOPE
)
ELSEIF
(
VALUE STREQUAL
"0"
)
elseif
(
VALUE STREQUAL
"0"
)
SET
(
${
VAR
}
"OFF"
PARENT_SCOPE
)
set
(
${
VAR
}
"OFF"
PARENT_SCOPE
)
ENDIF
()
endif
()
ENDFUNCTION
()
endfunction
()
cmake/SelectGSSAPI.cmake
View file @
c3fec456
INCLUDE
(
SanitizeBool
)
include
(
SanitizeBool
)
# We try to find any packages our backends might use
# We try to find any packages our backends might use
FIND_PACKAGE
(
GSSAPI
)
find_package
(
GSSAPI
)
IF
(
CMAKE_SYSTEM_NAME MATCHES
"Darwin"
)
if
(
CMAKE_SYSTEM_NAME MATCHES
"Darwin"
)
INCLUDE
(
FindGSSFramework
)
include
(
FindGSSFramework
)
ENDIF
()
endif
()
IF
(
USE_GSSAPI
)
if
(
USE_GSSAPI
)
# Auto-select GSS backend
# Auto-select GSS backend
SanitizeB
ool
(
USE_GSSAPI
)
sanitizeb
ool
(
USE_GSSAPI
)
IF
(
USE_GSSAPI STREQUAL ON
)
if
(
USE_GSSAPI STREQUAL ON
)
IF
(
GSSFRAMEWORK_FOUND
)
if
(
GSSFRAMEWORK_FOUND
)
SET
(
USE_GSSAPI
"GSS.framework"
)
set
(
USE_GSSAPI
"GSS.framework"
)
ELSEIF
(
GSSAPI_FOUND
)
elseif
(
GSSAPI_FOUND
)
SET
(
USE_GSSAPI
"gssapi"
)
set
(
USE_GSSAPI
"gssapi"
)
ELSE
()
else
()
MESSAGE
(
FATAL_ERROR
"Unable to autodetect a usable GSS backend."
message
(
FATAL_ERROR
"Unable to autodetect a usable GSS backend."
"Please pass the backend name explicitly (-DUSE_GSS=backend)"
)
"Please pass the backend name explicitly (-DUSE_GSS=backend)"
)
ENDIF
()
endif
()
ENDIF
()
endif
()
# Check that we can find what's required for the selected backend
# Check that we can find what's required for the selected backend
IF
(
USE_GSSAPI STREQUAL
"GSS.framework"
)
if
(
USE_GSSAPI STREQUAL
"GSS.framework"
)
IF
(
NOT GSSFRAMEWORK_FOUND
)
if
(
NOT GSSFRAMEWORK_FOUND
)
MESSAGE
(
FATAL_ERROR
"Asked for GSS.framework backend, but it wasn't found"
)
message
(
FATAL_ERROR
"Asked for GSS.framework backend, but it wasn't found"
)
ENDIF
()
endif
()
LIST
(
APPEND LIBGIT2_LIBS
${
GSSFRAMEWORK_LIBRARIES
}
)
list
(
APPEND LIBGIT2_LIBS
${
GSSFRAMEWORK_LIBRARIES
}
)
SET
(
GIT_GSSFRAMEWORK 1
)
set
(
GIT_GSSFRAMEWORK 1
)
ADD_FEATURE_INFO
(
SPNEGO GIT_GSSFRAMEWORK
"SPNEGO authentication support (
${
USE_GSSAPI
}
)"
)
add_feature_info
(
SPNEGO GIT_GSSFRAMEWORK
"SPNEGO authentication support (
${
USE_GSSAPI
}
)"
)
ELSEIF
(
USE_GSSAPI STREQUAL
"gssapi"
)
elseif
(
USE_GSSAPI STREQUAL
"gssapi"
)
IF
(
NOT GSSAPI_FOUND
)
if
(
NOT GSSAPI_FOUND
)
MESSAGE
(
FATAL_ERROR
"Asked for gssapi GSS backend, but it wasn't found"
)
message
(
FATAL_ERROR
"Asked for gssapi GSS backend, but it wasn't found"
)
ENDIF
()
endif
()
LIST
(
APPEND LIBGIT2_LIBS
${
GSSAPI_LIBRARIES
}
)
list
(
APPEND LIBGIT2_LIBS
${
GSSAPI_LIBRARIES
}
)
SET
(
GIT_GSSAPI 1
)
set
(
GIT_GSSAPI 1
)
ADD_FEATURE_INFO
(
SPNEGO GIT_GSSAPI
"SPNEGO authentication support (
${
USE_GSSAPI
}
)"
)
add_feature_info
(
SPNEGO GIT_GSSAPI
"SPNEGO authentication support (
${
USE_GSSAPI
}
)"
)
ELSE
()
else
()
MESSAGE
(
FATAL_ERROR
"Asked for backend
${
USE_GSSAPI
}
but it wasn't found"
)
message
(
FATAL_ERROR
"Asked for backend
${
USE_GSSAPI
}
but it wasn't found"
)
ENDIF
()
endif
()
ELSE
()
else
()
SET
(
GIT_GSSAPI 0
)
set
(
GIT_GSSAPI 0
)
ADD_FEATURE_INFO
(
SPNEGO NO
"SPNEGO authentication support"
)
add_feature_info
(
SPNEGO NO
"SPNEGO authentication support"
)
ENDIF
()
endif
()
cmake/SelectHTTPSBackend.cmake
View file @
c3fec456
INCLUDE
(
SanitizeBool
)
include
(
SanitizeBool
)
# We try to find any packages our backends might use
# We try to find any packages our backends might use
FIND_PACKAGE
(
OpenSSL
)
find_package
(
OpenSSL
)
FIND_PACKAGE
(
mbedTLS
)
find_package
(
mbedTLS
)
IF
(
CMAKE_SYSTEM_NAME MATCHES
"Darwin"
)
if
(
CMAKE_SYSTEM_NAME MATCHES
"Darwin"
)
FIND_PACKAGE
(
Security
)
find_package
(
Security
)
FIND_PACKAGE
(
CoreFoundation
)
find_package
(
CoreFoundation
)
ENDIF
()
endif
()
IF
(
USE_HTTPS
)
if
(
USE_HTTPS
)
# Auto-select TLS backend
# Auto-select TLS backend
SanitizeB
ool
(
USE_HTTPS
)
sanitizeb
ool
(
USE_HTTPS
)
IF
(
USE_HTTPS STREQUAL ON
)
if
(
USE_HTTPS STREQUAL ON
)
IF
(
SECURITY_FOUND
)
if
(
SECURITY_FOUND
)
IF
(
SECURITY_HAS_SSLCREATECONTEXT
)
if
(
SECURITY_HAS_SSLCREATECONTEXT
)
SET
(
USE_HTTPS
"SecureTransport"
)
set
(
USE_HTTPS
"SecureTransport"
)
ELSE
()
else
()
MESSAGE
(
STATUS
"Security framework is too old, falling back to OpenSSL"
)
message
(
STATUS
"Security framework is too old, falling back to OpenSSL"
)
SET
(
USE_HTTPS
"OpenSSL"
)
set
(
USE_HTTPS
"OpenSSL"
)
ENDIF
()
endif
()
ELSEIF
(
USE_WINHTTP
)
elseif
(
USE_WINHTTP
)
SET
(
USE_HTTPS
"WinHTTP"
)
set
(
USE_HTTPS
"WinHTTP"
)
ELSEIF
(
OPENSSL_FOUND
)
elseif
(
OPENSSL_FOUND
)
SET
(
USE_HTTPS
"OpenSSL"
)
set
(
USE_HTTPS
"OpenSSL"
)
ELSEIF
(
MBEDTLS_FOUND
)
elseif
(
MBEDTLS_FOUND
)
SET
(
USE_HTTPS
"mbedTLS"
)
set
(
USE_HTTPS
"mbedTLS"
)
ELSE
()
else
()
MESSAGE
(
FATAL_ERROR
"Unable to autodetect a usable HTTPS backend."
message
(
FATAL_ERROR
"Unable to autodetect a usable HTTPS backend."
"Please pass the backend name explicitly (-DUSE_HTTPS=backend)"
)
"Please pass the backend name explicitly (-DUSE_HTTPS=backend)"
)
ENDIF
()
endif
()
ENDIF
()
endif
()
# Check that we can find what's required for the selected backend
# Check that we can find what's required for the selected backend
IF
(
USE_HTTPS STREQUAL
"SecureTransport"
)
if
(
USE_HTTPS STREQUAL
"SecureTransport"
)
IF
(
NOT COREFOUNDATION_FOUND
)
if
(
NOT COREFOUNDATION_FOUND
)
MESSAGE
(
FATAL_ERROR
"Cannot use SecureTransport backend, CoreFoundation.framework not found"
)
message
(
FATAL_ERROR
"Cannot use SecureTransport backend, CoreFoundation.framework not found"
)
ENDIF
()
endif
()
IF
(
NOT SECURITY_FOUND
)
if
(
NOT SECURITY_FOUND
)
MESSAGE
(
FATAL_ERROR
"Cannot use SecureTransport backend, Security.framework not found"
)
message
(
FATAL_ERROR
"Cannot use SecureTransport backend, Security.framework not found"
)
ENDIF
()
endif
()
IF
(
NOT SECURITY_HAS_SSLCREATECONTEXT
)
if
(
NOT SECURITY_HAS_SSLCREATECONTEXT
)
MESSAGE
(
FATAL_ERROR
"Cannot use SecureTransport backend, SSLCreateContext not supported"
)
message
(
FATAL_ERROR
"Cannot use SecureTransport backend, SSLCreateContext not supported"
)
ENDIF
()
endif
()
SET
(
GIT_SECURE_TRANSPORT 1
)
set
(
GIT_SECURE_TRANSPORT 1
)
LIST
(
APPEND LIBGIT2_SYSTEM_INCLUDES
${
SECURITY_INCLUDE_DIR
}
)
list
(
APPEND LIBGIT2_SYSTEM_INCLUDES
${
SECURITY_INCLUDE_DIR
}
)
LIST
(
APPEND LIBGIT2_LIBS
${
COREFOUNDATION_LDFLAGS
}
${
SECURITY_LDFLAGS
}
)
list
(
APPEND LIBGIT2_LIBS
${
COREFOUNDATION_LDFLAGS
}
${
SECURITY_LDFLAGS
}
)
LIST
(
APPEND LIBGIT2_PC_LIBS
${
COREFOUNDATION_LDFLAGS
}
${
SECURITY_LDFLAGS
}
)
list
(
APPEND LIBGIT2_PC_LIBS
${
COREFOUNDATION_LDFLAGS
}
${
SECURITY_LDFLAGS
}
)
ELSEIF
(
USE_HTTPS STREQUAL
"OpenSSL"
)
elseif
(
USE_HTTPS STREQUAL
"OpenSSL"
)
IF
(
NOT OPENSSL_FOUND
)
if
(
NOT OPENSSL_FOUND
)
MESSAGE
(
FATAL_ERROR
"Asked for OpenSSL TLS backend, but it wasn't found"
)
message
(
FATAL_ERROR
"Asked for OpenSSL TLS backend, but it wasn't found"
)
ENDIF
()
endif
()
SET
(
GIT_OPENSSL 1
)
set
(
GIT_OPENSSL 1
)
LIST
(
APPEND LIBGIT2_SYSTEM_INCLUDES
${
OPENSSL_INCLUDE_DIR
}
)
list
(
APPEND LIBGIT2_SYSTEM_INCLUDES
${
OPENSSL_INCLUDE_DIR
}
)
LIST
(
APPEND LIBGIT2_LIBS
${
OPENSSL_LIBRARIES
}
)
list
(
APPEND LIBGIT2_LIBS
${
OPENSSL_LIBRARIES
}
)
LIST
(
APPEND LIBGIT2_PC_LIBS
${
OPENSSL_LDFLAGS
}
)
list
(
APPEND LIBGIT2_PC_LIBS
${
OPENSSL_LDFLAGS
}
)
LIST
(
APPEND LIBGIT2_PC_REQUIRES
"openssl"
)
list
(
APPEND LIBGIT2_PC_REQUIRES
"openssl"
)
ELSEIF
(
USE_HTTPS STREQUAL
"mbedTLS"
)
elseif
(
USE_HTTPS STREQUAL
"mbedTLS"
)
IF
(
NOT MBEDTLS_FOUND
)
if
(
NOT MBEDTLS_FOUND
)
MESSAGE
(
FATAL_ERROR
"Asked for mbedTLS backend, but it wasn't found"
)
message
(
FATAL_ERROR
"Asked for mbedTLS backend, but it wasn't found"
)
ENDIF
()
endif
()
IF
(
NOT CERT_LOCATION
)
if
(
NOT CERT_LOCATION
)
MESSAGE
(
STATUS
"Auto-detecting default certificates location"
)
message
(
STATUS
"Auto-detecting default certificates location"
)
IF
(
CMAKE_SYSTEM_NAME MATCHES Darwin
)
if
(
CMAKE_SYSTEM_NAME MATCHES Darwin
)
# Check for an Homebrew installation
# Check for an Homebrew installation
SET
(
OPENSSL_CMD
"/usr/local/opt/openssl/bin/openssl"
)
set
(
OPENSSL_CMD
"/usr/local/opt/openssl/bin/openssl"
)
ELSE
()
else
()
SET
(
OPENSSL_CMD
"openssl"
)
set
(
OPENSSL_CMD
"openssl"
)
ENDIF
()
endif
()
EXECUTE_PROCESS
(
COMMAND
${
OPENSSL_CMD
}
version -d OUTPUT_VARIABLE OPENSSL_DIR OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process
(
COMMAND
${
OPENSSL_CMD
}
version -d OUTPUT_VARIABLE OPENSSL_DIR OUTPUT_STRIP_TRAILING_WHITESPACE
)
IF
(
OPENSSL_DIR
)
if
(
OPENSSL_DIR
)
STRING
(
REGEX REPLACE
"^OPENSSLDIR:
\"
(.*)
\"
$"
"
\\
1/"
OPENSSL_DIR
${
OPENSSL_DIR
}
)
string
(
REGEX REPLACE
"^OPENSSLDIR:
\"
(.*)
\"
$"
"
\\
1/"
OPENSSL_DIR
${
OPENSSL_DIR
}
)
SET
(
OPENSSL_CA_LOCATIONS
set
(
OPENSSL_CA_LOCATIONS
"ca-bundle.pem"
# OpenSUSE Leap 42.1
"ca-bundle.pem"
# OpenSUSE Leap 42.1
"cert.pem"
# Ubuntu 14.04, FreeBSD
"cert.pem"
# Ubuntu 14.04, FreeBSD
"certs/ca-certificates.crt"
# Ubuntu 16.04
"certs/ca-certificates.crt"
# Ubuntu 16.04
"certs/ca.pem"
# Debian 7
"certs/ca.pem"
# Debian 7
)
)
FOREACH
(
SUFFIX IN LISTS OPENSSL_CA_LOCATIONS
)
foreach
(
SUFFIX IN LISTS OPENSSL_CA_LOCATIONS
)
SET
(
LOC
"
${
OPENSSL_DIR
}${
SUFFIX
}
"
)
set
(
LOC
"
${
OPENSSL_DIR
}${
SUFFIX
}
"
)
IF
(
NOT CERT_LOCATION AND EXISTS
"
${
OPENSSL_DIR
}${
SUFFIX
}
"
)
if
(
NOT CERT_LOCATION AND EXISTS
"
${
OPENSSL_DIR
}${
SUFFIX
}
"
)
SET
(
CERT_LOCATION
${
LOC
}
)
set
(
CERT_LOCATION
${
LOC
}
)
ENDIF
()
endif
()
ENDFOREACH
()
endforeach
()
ELSE
()
else
()
MESSAGE
(
FATAL_ERROR
"Unable to find OpenSSL executable. Please provide default certificate location via CERT_LOCATION"
)
message
(
FATAL_ERROR
"Unable to find OpenSSL executable. Please provide default certificate location via CERT_LOCATION"
)
ENDIF
()
endif
()
ENDIF
()
endif
()
IF
(
CERT_LOCATION
)
if
(
CERT_LOCATION
)
IF
(
NOT EXISTS
${
CERT_LOCATION
}
)
if
(
NOT EXISTS
${
CERT_LOCATION
}
)
MESSAGE
(
FATAL_ERROR
"Cannot use CERT_LOCATION=
${
CERT_LOCATION
}
as it doesn't exist"
)
message
(
FATAL_ERROR
"Cannot use CERT_LOCATION=
${
CERT_LOCATION
}
as it doesn't exist"
)
ENDIF
()
endif
()
ADD_FEATURE_INFO
(
CERT_LOCATION ON
"using certificates from
${
CERT_LOCATION
}
"
)
add_feature_info
(
CERT_LOCATION ON
"using certificates from
${
CERT_LOCATION
}
"
)
ADD_DEFINITIONS
(
-DGIT_DEFAULT_CERT_LOCATION=
"
${
CERT_LOCATION
}
"
)
add_definitions
(
-DGIT_DEFAULT_CERT_LOCATION=
"
${
CERT_LOCATION
}
"
)
ENDIF
()
endif
()
SET
(
GIT_MBEDTLS 1
)
set
(
GIT_MBEDTLS 1
)
LIST
(
APPEND LIBGIT2_SYSTEM_INCLUDES
${
MBEDTLS_INCLUDE_DIR
}
)
list
(
APPEND LIBGIT2_SYSTEM_INCLUDES
${
MBEDTLS_INCLUDE_DIR
}
)
LIST
(
APPEND LIBGIT2_LIBS
${
MBEDTLS_LIBRARIES
}
)
list
(
APPEND LIBGIT2_LIBS
${
MBEDTLS_LIBRARIES
}
)
# mbedTLS has no pkgconfig file, hence we can't require it
# mbedTLS has no pkgconfig file, hence we can't require it
# https://github.com/ARMmbed/mbedtls/issues/228
# https://github.com/ARMmbed/mbedtls/issues/228
# For now, pass its link flags as our own
# For now, pass its link flags as our own
LIST
(
APPEND LIBGIT2_PC_LIBS
${
MBEDTLS_LIBRARIES
}
)
list
(
APPEND LIBGIT2_PC_LIBS
${
MBEDTLS_LIBRARIES
}
)
ELSEIF
(
USE_HTTPS STREQUAL
"WinHTTP"
)
elseif
(
USE_HTTPS STREQUAL
"WinHTTP"
)
# WinHTTP setup was handled in the WinHTTP-specific block above
# WinHTTP setup was handled in the WinHTTP-specific block above
ELSEIF
(
USE_HTTPS STREQUAL
"OpenSSL-Dynamic"
)
elseif
(
USE_HTTPS STREQUAL
"OpenSSL-Dynamic"
)
SET
(
GIT_OPENSSL 1
)
set
(
GIT_OPENSSL 1
)
SET
(
GIT_OPENSSL_DYNAMIC 1
)
set
(
GIT_OPENSSL_DYNAMIC 1
)
LIST
(
APPEND LIBGIT2_LIBS dl
)
list
(
APPEND LIBGIT2_LIBS dl
)
ELSE
()
else
()
MESSAGE
(
FATAL_ERROR
"Asked for backend
${
USE_HTTPS
}
but it wasn't found"
)
message
(
FATAL_ERROR
"Asked for backend
${
USE_HTTPS
}
but it wasn't found"
)
ENDIF
()
endif
()
SET
(
GIT_HTTPS 1
)
set
(
GIT_HTTPS 1
)
ADD_FEATURE_INFO
(
HTTPS GIT_HTTPS
"using
${
USE_HTTPS
}
"
)
add_feature_info
(
HTTPS GIT_HTTPS
"using
${
USE_HTTPS
}
"
)
ELSE
()
else
()
SET
(
GIT_HTTPS 0
)
set
(
GIT_HTTPS 0
)
ADD_FEATURE_INFO
(
HTTPS NO
""
)
add_feature_info
(
HTTPS NO
""
)
ENDIF
()
endif
()
cmake/SelectHashes.cmake
View file @
c3fec456
# Select a hash backend
# Select a hash backend
INCLUDE
(
SanitizeBool
)
include
(
SanitizeBool
)
# USE_SHA1=CollisionDetection(ON)/HTTPS/Generic/OFF
# USE_SHA1=CollisionDetection(ON)/HTTPS/Generic/OFF
SanitizeB
ool
(
USE_SHA1
)
sanitizeb
ool
(
USE_SHA1
)
IF
(
USE_SHA1 STREQUAL ON
)
if
(
USE_SHA1 STREQUAL ON
)
SET
(
USE_SHA1
"CollisionDetection"
)
set
(
USE_SHA1
"CollisionDetection"
)
ELSEIF
(
USE_SHA1 STREQUAL
"HTTPS"
)
elseif
(
USE_SHA1 STREQUAL
"HTTPS"
)
IF
(
USE_HTTPS STREQUAL
"SecureTransport"
)
if
(
USE_HTTPS STREQUAL
"SecureTransport"
)
SET
(
USE_SHA1
"CommonCrypto"
)
set
(
USE_SHA1
"CommonCrypto"
)
ELSEIF
(
USE_HTTPS STREQUAL
"WinHTTP"
)
elseif
(
USE_HTTPS STREQUAL
"WinHTTP"
)
SET
(
USE_SHA1
"Win32"
)
set
(
USE_SHA1
"Win32"
)
ELSEIF
(
USE_HTTPS
)
elseif
(
USE_HTTPS
)
SET
(
USE_SHA1
${
USE_HTTPS
}
)
set
(
USE_SHA1
${
USE_HTTPS
}
)
ELSE
()
else
()
SET
(
USE_SHA1
"CollisionDetection"
)
set
(
USE_SHA1
"CollisionDetection"
)
ENDIF
()
endif
()
ENDIF
()
endif
()
IF
(
USE_SHA1 STREQUAL
"CollisionDetection"
)
if
(
USE_SHA1 STREQUAL
"CollisionDetection"
)
SET
(
GIT_SHA1_COLLISIONDETECT 1
)
set
(
GIT_SHA1_COLLISIONDETECT 1
)
ADD_DEFINITIONS
(
-DSHA1DC_NO_STANDARD_INCLUDES=1
)
add_definitions
(
-DSHA1DC_NO_STANDARD_INCLUDES=1
)
ADD_DEFINITIONS
(
-DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\
"common.h
\"
)
add_definitions
(
-DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\
"common.h
\"
)
ADD_DEFINITIONS
(-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=
\"
common.h
\"
)
add_definitions
(-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=
\"
common.h
\"
)
FILE
(GLOB SRC_SHA1 hash/sha1/collisiondetect.* hash/sha1/sha1dc/*)
file
(GLOB SRC_SHA1 hash/sha1/collisiondetect.* hash/sha1/sha1dc/*)
ELSEIF
(USE_SHA1 STREQUAL "
OpenSSL
")
elseif
(USE_SHA1 STREQUAL "
OpenSSL
")
# OPENSSL_FOUND should already be set, we're checking USE_HTTPS
# OPENSSL_FOUND should already be set, we're checking USE_HTTPS
SET
(GIT_SHA1_OPENSSL 1)
set
(GIT_SHA1_OPENSSL 1)
IF
(CMAKE_SYSTEM_NAME MATCHES "
FreeBSD
")
if
(CMAKE_SYSTEM_NAME MATCHES "
FreeBSD
")
LIST
(APPEND LIBGIT2_PC_LIBS "
-lssl
")
list
(APPEND LIBGIT2_PC_LIBS "
-lssl
")
ELSE
()
else
()
LIST
(APPEND LIBGIT2_PC_REQUIRES "
openssl
")
list
(APPEND LIBGIT2_PC_REQUIRES "
openssl
")
ENDIF
()
endif
()
FILE
(GLOB SRC_SHA1 hash/sha1/openssl.*)
file
(GLOB SRC_SHA1 hash/sha1/openssl.*)
ELSEIF
(USE_SHA1 STREQUAL "
CommonCrypto
")
elseif
(USE_SHA1 STREQUAL "
CommonCrypto
")
SET
(GIT_SHA1_COMMON_CRYPTO 1)
set
(GIT_SHA1_COMMON_CRYPTO 1)
FILE
(GLOB SRC_SHA1 hash/sha1/common_crypto.*)
file
(GLOB SRC_SHA1 hash/sha1/common_crypto.*)
ELSEIF
(USE_SHA1 STREQUAL "
mbedTLS
")
elseif
(USE_SHA1 STREQUAL "
mbedTLS
")
SET
(GIT_SHA1_MBEDTLS 1)
set
(GIT_SHA1_MBEDTLS 1)
FILE
(GLOB SRC_SHA1 hash/sha1/mbedtls.*)
file
(GLOB SRC_SHA1 hash/sha1/mbedtls.*)
LIST
(APPEND LIBGIT2_SYSTEM_INCLUDES
${
MBEDTLS_INCLUDE_DIR
}
)
list
(APPEND LIBGIT2_SYSTEM_INCLUDES
${
MBEDTLS_INCLUDE_DIR
}
)
LIST
(APPEND LIBGIT2_LIBS
${
MBEDTLS_LIBRARIES
}
)
list
(APPEND LIBGIT2_LIBS
${
MBEDTLS_LIBRARIES
}
)
# mbedTLS has no pkgconfig file, hence we can't require it
# mbedTLS has no pkgconfig file, hence we can't require it
# https://github.com/ARMmbed/mbedtls/issues/228
# https://github.com/ARMmbed/mbedtls/issues/228
# For now, pass its link flags as our own
# For now, pass its link flags as our own
LIST
(APPEND LIBGIT2_PC_LIBS
${
MBEDTLS_LIBRARIES
}
)
list
(APPEND LIBGIT2_PC_LIBS
${
MBEDTLS_LIBRARIES
}
)
ELSEIF
(USE_SHA1 STREQUAL "
Win32
")
elseif
(USE_SHA1 STREQUAL "
Win32
")
SET
(GIT_SHA1_WIN32 1)
set
(GIT_SHA1_WIN32 1)
FILE
(GLOB SRC_SHA1 hash/sha1/win32.*)
file
(GLOB SRC_SHA1 hash/sha1/win32.*)
ELSEIF
(USE_SHA1 STREQUAL "
Generic
")
elseif
(USE_SHA1 STREQUAL "
Generic
")
FILE
(GLOB SRC_SHA1 hash/sha1/generic.*)
file
(GLOB SRC_SHA1 hash/sha1/generic.*)
ELSE
()
else
()
MESSAGE
(FATAL_ERROR "
Asked for unknown SHA1 backend:
${
USE_SHA1
}
")
message
(FATAL_ERROR "
Asked for unknown SHA1 backend:
${
USE_SHA1
}
")
ENDIF
()
endif
()
list(APPEND SRC_SHA1 "
hash/sha1.h
")
list(APPEND SRC_SHA1 "
hash/sha1.h
")
list(SORT SRC_SHA1)
list(SORT SRC_SHA1)
ADD_FEATURE_INFO
(SHA ON "
using
${
USE_SHA1
}
")
add_feature_info
(SHA ON "
using
${
USE_SHA1
}
")
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