diff options
-rw-r--r-- | cmake/SelectGSSAPI.cmake | 4 | ||||
-rw-r--r-- | cmake/SelectHTTPParser.cmake | 6 | ||||
-rw-r--r-- | cmake/SelectHTTPSBackend.cmake | 8 | ||||
-rw-r--r-- | cmake/SelectHashes.cmake | 4 | ||||
-rw-r--r-- | cmake/SelectRegex.cmake | 8 | ||||
-rw-r--r-- | cmake/SelectSSH.cmake | 6 | ||||
-rw-r--r-- | cmake/SelectWinHTTP.cmake | 6 | ||||
-rw-r--r-- | cmake/SelectZlib.cmake | 10 | ||||
-rw-r--r-- | examples/CMakeLists.txt | 9 | ||||
-rw-r--r-- | fuzzers/CMakeLists.txt | 14 | ||||
-rw-r--r-- | src/CMakeLists.txt | 30 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 12 |
12 files changed, 58 insertions, 59 deletions
diff --git a/cmake/SelectGSSAPI.cmake b/cmake/SelectGSSAPI.cmake index e9c5c75c1..24e2d68b9 100644 --- a/cmake/SelectGSSAPI.cmake +++ b/cmake/SelectGSSAPI.cmake @@ -26,7 +26,7 @@ if(USE_GSSAPI) message(FATAL_ERROR "Asked for GSS.framework backend, but it wasn't found") endif() - list(APPEND LIBGIT2_LIBS ${GSSFRAMEWORK_LIBRARIES}) + list(APPEND LIBGIT2_SYSTEM_LIBS ${GSSFRAMEWORK_LIBRARIES}) set(GIT_GSSFRAMEWORK 1) add_feature_info(SPNEGO GIT_GSSFRAMEWORK "SPNEGO authentication support (${USE_GSSAPI})") @@ -35,7 +35,7 @@ if(USE_GSSAPI) message(FATAL_ERROR "Asked for gssapi GSS backend, but it wasn't found") endif() - list(APPEND LIBGIT2_LIBS ${GSSAPI_LIBRARIES}) + list(APPEND LIBGIT2_SYSTEM_LIBS ${GSSAPI_LIBRARIES}) set(GIT_GSSAPI 1) add_feature_info(SPNEGO GIT_GSSAPI "SPNEGO authentication support (${USE_GSSAPI})") diff --git a/cmake/SelectHTTPParser.cmake b/cmake/SelectHTTPParser.cmake index a1724a7c4..721f7fa9f 100644 --- a/cmake/SelectHTTPParser.cmake +++ b/cmake/SelectHTTPParser.cmake @@ -4,7 +4,7 @@ if(USE_HTTP_PARSER STREQUAL "system") if(HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2) list(APPEND LIBGIT2_SYSTEM_INCLUDES ${HTTP_PARSER_INCLUDE_DIRS}) - list(APPEND LIBGIT2_LIBS ${HTTP_PARSER_LIBRARIES}) + list(APPEND LIBGIT2_SYSTEM_LIBS ${HTTP_PARSER_LIBRARIES}) list(APPEND LIBGIT2_PC_LIBS "-lhttp_parser") add_feature_info(http-parser ON "http-parser support (system)") else() @@ -13,7 +13,7 @@ if(USE_HTTP_PARSER STREQUAL "system") else() message(STATUS "http-parser version 2 was not found or disabled; using bundled 3rd-party sources.") add_subdirectory("${libgit2_SOURCE_DIR}/deps/http-parser" "${libgit2_BINARY_DIR}/deps/http-parser") - list(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/http-parser") - list(APPEND LIBGIT2_OBJECTS "$<TARGET_OBJECTS:http-parser>") + list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${libgit2_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() diff --git a/cmake/SelectHTTPSBackend.cmake b/cmake/SelectHTTPSBackend.cmake index 1c6bd6a59..79319502e 100644 --- a/cmake/SelectHTTPSBackend.cmake +++ b/cmake/SelectHTTPSBackend.cmake @@ -45,7 +45,7 @@ if(USE_HTTPS) set(GIT_SECURE_TRANSPORT 1) list(APPEND LIBGIT2_SYSTEM_INCLUDES ${SECURITY_INCLUDE_DIR}) - list(APPEND LIBGIT2_LIBS ${COREFOUNDATION_LDFLAGS} ${SECURITY_LDFLAGS}) + list(APPEND LIBGIT2_SYSTEM_LIBS ${COREFOUNDATION_LDFLAGS} ${SECURITY_LDFLAGS}) list(APPEND LIBGIT2_PC_LIBS ${COREFOUNDATION_LDFLAGS} ${SECURITY_LDFLAGS}) elseif(USE_HTTPS STREQUAL "OpenSSL") if(NOT OPENSSL_FOUND) @@ -54,7 +54,7 @@ if(USE_HTTPS) set(GIT_OPENSSL 1) list(APPEND LIBGIT2_SYSTEM_INCLUDES ${OPENSSL_INCLUDE_DIR}) - list(APPEND LIBGIT2_LIBS ${OPENSSL_LIBRARIES}) + list(APPEND LIBGIT2_SYSTEM_LIBS ${OPENSSL_LIBRARIES}) list(APPEND LIBGIT2_PC_LIBS ${OPENSSL_LDFLAGS}) list(APPEND LIBGIT2_PC_REQUIRES "openssl") elseif(USE_HTTPS STREQUAL "mbedTLS") @@ -101,7 +101,7 @@ if(USE_HTTPS) set(GIT_MBEDTLS 1) list(APPEND LIBGIT2_SYSTEM_INCLUDES ${MBEDTLS_INCLUDE_DIR}) - list(APPEND LIBGIT2_LIBS ${MBEDTLS_LIBRARIES}) + list(APPEND LIBGIT2_SYSTEM_LIBS ${MBEDTLS_LIBRARIES}) # mbedTLS has no pkgconfig file, hence we can't require it # https://github.com/ARMmbed/mbedtls/issues/228 # For now, pass its link flags as our own @@ -111,7 +111,7 @@ if(USE_HTTPS) elseif(USE_HTTPS STREQUAL "OpenSSL-Dynamic") set(GIT_OPENSSL 1) set(GIT_OPENSSL_DYNAMIC 1) - list(APPEND LIBGIT2_LIBS dl) + list(APPEND LIBGIT2_SYSTEM_LIBS dl) else() message(FATAL_ERROR "Asked for backend ${USE_HTTPS} but it wasn't found") endif() diff --git a/cmake/SelectHashes.cmake b/cmake/SelectHashes.cmake index fee8b2902..fdefb57fd 100644 --- a/cmake/SelectHashes.cmake +++ b/cmake/SelectHashes.cmake @@ -3,10 +3,10 @@ include(SanitizeBool) # USE_SHA1=CollisionDetection(ON)/HTTPS/Generic/OFF - sanitizebool(USE_SHA1) + if(USE_SHA1 STREQUAL ON) - set(USE_SHA1 "CollisionDetection") + SET(USE_SHA1 "CollisionDetection") elseif(USE_SHA1 STREQUAL "HTTPS") if(USE_HTTPS STREQUAL "SecureTransport") set(USE_SHA1 "CommonCrypto") diff --git a/cmake/SelectRegex.cmake b/cmake/SelectRegex.cmake index 900d7f150..1553d6587 100644 --- a/cmake/SelectRegex.cmake +++ b/cmake/SelectRegex.cmake @@ -27,14 +27,14 @@ elseif(REGEX_BACKEND STREQUAL "pcre2") set(GIT_REGEX_PCRE2 1) list(APPEND LIBGIT2_SYSTEM_INCLUDES ${PCRE2_INCLUDE_DIRS}) - list(APPEND LIBGIT2_LIBS ${PCRE2_LIBRARIES}) + list(APPEND LIBGIT2_SYSTEM_LIBS ${PCRE2_LIBRARIES}) list(APPEND LIBGIT2_PC_REQUIRES "libpcre2-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_LIBS ${PCRE_LIBRARIES}) + list(APPEND LIBGIT2_SYSTEM_LIBS ${PCRE_LIBRARIES}) list(APPEND LIBGIT2_PC_REQUIRES "libpcre") elseif(REGEX_BACKEND STREQUAL "regcomp") add_feature_info(regex ON "using system regcomp") @@ -44,8 +44,8 @@ elseif(REGEX_BACKEND STREQUAL "builtin") set(GIT_REGEX_BUILTIN 1) add_subdirectory("${libgit2_SOURCE_DIR}/deps/pcre" "${libgit2_BINARY_DIR}/deps/pcre") - list(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/pcre") - list(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:pcre>) + list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${libgit2_SOURCE_DIR}/deps/pcre") + list(APPEND LIBGIT2_DEPENDENCY_OBJECTS $<TARGET_OBJECTS:pcre>) else() message(FATAL_ERROR "The REGEX_BACKEND option provided is not supported") endif() diff --git a/cmake/SelectSSH.cmake b/cmake/SelectSSH.cmake index 0356ee3e7..23dfc9785 100644 --- a/cmake/SelectSSH.cmake +++ b/cmake/SelectSSH.cmake @@ -17,7 +17,7 @@ endif() if(LIBSSH2_FOUND) set(GIT_SSH 1) list(APPEND LIBGIT2_SYSTEM_INCLUDES ${LIBSSH2_INCLUDE_DIRS}) - list(APPEND LIBGIT2_LIBS ${LIBSSH2_LIBRARIES}) + list(APPEND LIBGIT2_SYSTEM_LIBS ${LIBSSH2_LIBRARIES}) list(APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS}) check_library_exists("${LIBSSH2_LIBRARIES}" libssh2_userauth_publickey_frommemory "${LIBSSH2_LIBRARY_DIRS}" HAVE_LIBSSH2_MEMORY_CREDENTIALS) @@ -31,9 +31,9 @@ endif() if(WIN32 AND EMBED_SSH_PATH) file(GLOB SSH_SRC "${EMBED_SSH_PATH}/src/*.c") list(SORT SSH_SRC) - list(APPEND LIBGIT2_OBJECTS ${SSH_SRC}) + list(APPEND LIBGIT2_DEPENDENCY_OBJECTS ${SSH_SRC}) - list(APPEND LIBGIT2_INCLUDES "${EMBED_SSH_PATH}/include") + list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${EMBED_SSH_PATH}/include") file(WRITE "${EMBED_SSH_PATH}/src/libssh2_config.h" "#define HAVE_WINCNG\n#define LIBSSH2_WINCNG\n#include \"../win32/libssh2_config.h\"") set(GIT_SSH 1) endif() diff --git a/cmake/SelectWinHTTP.cmake b/cmake/SelectWinHTTP.cmake index a4110045f..1d950c900 100644 --- a/cmake/SelectWinHTTP.cmake +++ b/cmake/SelectWinHTTP.cmake @@ -5,13 +5,13 @@ if(WIN32 AND WINHTTP) # we have to include a private header and generate our own import library if(MINGW) add_subdirectory("${libgit2_SOURCE_DIR}/deps/winhttp" "${libgit2_BINARY_DIR}/deps/winhttp") - list(APPEND LIBGIT2_LIBS winhttp) + list(APPEND LIBGIT2_SYSTEM_LIBS winhttp) list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${libgit2_SOURCE_DIR}/deps/winhttp") else() - list(APPEND LIBGIT2_LIBS "winhttp") + list(APPEND LIBGIT2_SYSTEM_LIBS "winhttp") list(APPEND LIBGIT2_PC_LIBS "-lwinhttp") endif() - list(APPEND LIBGIT2_LIBS "rpcrt4" "crypt32" "ole32") + list(APPEND LIBGIT2_SYSTEM_LIBS "rpcrt4" "crypt32" "ole32") list(APPEND LIBGIT2_PC_LIBS "-lrpcrt4" "-lcrypt32" "-lole32") endif() diff --git a/cmake/SelectZlib.cmake b/cmake/SelectZlib.cmake index 2dfc6c86e..e377d43b6 100644 --- a/cmake/SelectZlib.cmake +++ b/cmake/SelectZlib.cmake @@ -10,7 +10,7 @@ if(USE_BUNDLED_ZLIB STREQUAL "OFF") find_package(ZLIB) if(ZLIB_FOUND) list(APPEND LIBGIT2_SYSTEM_INCLUDES ${ZLIB_INCLUDE_DIRS}) - list(APPEND LIBGIT2_LIBS ${ZLIB_LIBRARIES}) + list(APPEND LIBGIT2_SYSTEM_LIBS ${ZLIB_LIBRARIES}) if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD") list(APPEND LIBGIT2_PC_LIBS "-lz") else() @@ -23,12 +23,12 @@ if(USE_BUNDLED_ZLIB STREQUAL "OFF") endif() if(USE_BUNDLED_ZLIB STREQUAL "Chromium") add_subdirectory("${libgit2_SOURCE_DIR}/deps/chromium-zlib" "${libgit2_BINARY_DIR}/deps/chromium-zlib") - list(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/chromium-zlib") - list(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:chromium_zlib>) + list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${libgit2_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("${libgit2_SOURCE_DIR}/deps/zlib" "${libgit2_BINARY_DIR}/deps/zlib") - list(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/zlib") - list(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:zlib>) + list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${libgit2_SOURCE_DIR}/deps/zlib") + list(APPEND LIBGIT2_DEPENDENCY_OBJECTS $<TARGET_OBJECTS:zlib>) add_feature_info(zlib ON "using bundled zlib") endif() diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index a7970a6d0..235e72ada 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,13 +1,14 @@ -include_directories(${LIBGIT2_INCLUDES}) -include_directories(SYSTEM ${LIBGIT2_SYSTEM_INCLUDES}) +file(GLOB SRC_EXAMPLES *.c *.h) -file(GLOB LG2_SOURCES *.c *.h) -add_executable(lg2 ${LG2_SOURCES}) +add_executable(lg2 ${SRC_EXAMPLES}) set_target_properties(lg2 PROPERTIES C_STANDARD 90) # Ensure that we do not use deprecated functions internally add_definitions(-DGIT_DEPRECATE_HARD) +target_include_directories(lg2 PRIVATE ${LIBGIT2_INCLUDES} ${LIBGIT2_DEPENDENCY_INCLUDES}) +target_include_directories(lg2 SYSTEM PRIVATE ${LIBGIT2_SYSTEM_INCLUDES}) + if(WIN32 OR ANDROID) target_link_libraries(lg2 git2) else() diff --git a/fuzzers/CMakeLists.txt b/fuzzers/CMakeLists.txt index 1479a2af8..eaa490fd9 100644 --- a/fuzzers/CMakeLists.txt +++ b/fuzzers/CMakeLists.txt @@ -1,7 +1,3 @@ -link_directories(${LIBGIT2_LIBDIRS}) -include_directories(${LIBGIT2_INCLUDES}) -include_directories(SYSTEM ${LIBGIT2_SYSTEM_INCLUDES}) - if(BUILD_FUZZERS AND NOT USE_STANDALONE_FUZZERS) set(CMAKE_REQUIRED_FLAGS "-fsanitize=fuzzer-no-link") add_c_flag(-fsanitize=fuzzer) @@ -9,8 +5,8 @@ if(BUILD_FUZZERS AND NOT USE_STANDALONE_FUZZERS) unset(CMAKE_REQUIRED_FLAGS) endif() -file(GLOB SRC_FUZZ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *_fuzzer.c) -foreach(fuzz_target_src ${SRC_FUZZ}) +file(GLOB SRC_FUZZERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *_fuzzer.c) +foreach(fuzz_target_src ${SRC_FUZZERS}) string(REPLACE ".c" "" fuzz_target_name ${fuzz_target_src}) string(REPLACE "_fuzzer" "" fuzz_name ${fuzz_target_name}) @@ -20,7 +16,11 @@ foreach(fuzz_target_src ${SRC_FUZZ}) endif() add_executable(${fuzz_target_name} ${${fuzz_target_name}_SOURCES}) set_target_properties(${fuzz_target_name} PROPERTIES C_STANDARD 90) - target_link_libraries(${fuzz_target_name} ${LIBGIT2_LIBS}) + + target_include_directories(${fuzz_target_name} PRIVATE ${LIBGIT2_INCLUDES} ${LIBGIT2_DEPENDENCY_INCLUDES}) + target_include_directories(${fuzz_target_name} SYSTEM PRIVATE ${LIBGIT2_SYSTEM_INCLUDES}) + + target_link_libraries(${fuzz_target_name} ${LIBGIT2_SYSTEM_LIBS}) add_test(${fuzz_target_name} "${CMAKE_CURRENT_BINARY_DIR}/${fuzz_target_name}" "${CMAKE_CURRENT_SOURCE_DIR}/corpora/${fuzz_name}") endforeach() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6a128cfa8..b23b6a046 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -38,8 +38,6 @@ set(LIBGIT2_INCLUDES "${CMAKE_CURRENT_BINARY_DIR}" "${libgit2_SOURCE_DIR}/src" "${libgit2_SOURCE_DIR}/include") -set(LIBGIT2_SYSTEM_INCLUDES "") -set(LIBGIT2_LIBS "") if(HAVE_FUTIMENS) set(GIT_USE_FUTIMENS 1) @@ -59,23 +57,23 @@ check_function_exists(qsort_s GIT_QSORT_S) # Find required dependencies if(WIN32) - list(APPEND LIBGIT2_LIBS ws2_32) + list(APPEND LIBGIT2_SYSTEM_LIBS ws2_32) elseif(CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)") - list(APPEND LIBGIT2_LIBS socket nsl) + list(APPEND LIBGIT2_SYSTEM_LIBS socket nsl) list(APPEND LIBGIT2_PC_LIBS "-lsocket" "-lnsl") elseif(CMAKE_SYSTEM_NAME MATCHES "Haiku") - list(APPEND LIBGIT2_LIBS network) + list(APPEND LIBGIT2_SYSTEM_LIBS network) list(APPEND LIBGIT2_PC_LIBS "-lnetwork") endif() check_library_exists(rt clock_gettime "time.h" NEED_LIBRT) if(NEED_LIBRT) - list(APPEND LIBGIT2_LIBS rt) + list(APPEND LIBGIT2_SYSTEM_LIBS rt) list(APPEND LIBGIT2_PC_LIBS "-lrt") endif() if(USE_THREADS) - list(APPEND LIBGIT2_LIBS ${CMAKE_THREAD_LIBS_INIT}) + list(APPEND LIBGIT2_SYSTEM_LIBS ${CMAKE_THREAD_LIBS_INIT}) list(APPEND LIBGIT2_PC_LIBS ${CMAKE_THREAD_LIBS_INIT}) endif() add_feature_info(threadsafe USE_THREADS "threadsafe support") @@ -105,8 +103,8 @@ target_sources(git2internal PRIVATE ${SRC_SHA1}) if(USE_NTLMCLIENT) set(GIT_NTLM 1) add_subdirectory("${libgit2_SOURCE_DIR}/deps/ntlmclient" "${libgit2_BINARY_DIR}/deps/ntlmclient") - list(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/ntlmclient") - list(APPEND LIBGIT2_OBJECTS "$<TARGET_OBJECTS:ntlmclient>") + list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${libgit2_SOURCE_DIR}/deps/ntlmclient") + list(APPEND LIBGIT2_DEPENDENCY_OBJECTS "$<TARGET_OBJECTS:ntlmclient>") endif() add_feature_info(ntlmclient GIT_NTLM "NTLM authentication support for Unix") @@ -121,7 +119,7 @@ endif() if(ICONV_FOUND) set(GIT_USE_ICONV 1) list(APPEND LIBGIT2_SYSTEM_INCLUDES ${ICONV_INCLUDE_DIR}) - list(APPEND LIBGIT2_LIBS ${ICONV_LIBRARIES}) + list(APPEND LIBGIT2_SYSTEM_LIBS ${ICONV_LIBRARIES}) list(APPEND LIBGIT2_PC_LIBS ${ICONV_LIBRARIES}) endif() add_feature_info(iconv GIT_USE_ICONV "iconv encoding conversion support") @@ -210,15 +208,17 @@ endif() configure_file(features.h.in git2/sys/features.h) ide_split_sources(git2internal) -list(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:git2internal>) +list(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:git2internal> ${LIBGIT2_DEPENDENCY_OBJECTS}) -target_include_directories(git2internal PRIVATE ${LIBGIT2_INCLUDES} PUBLIC ${libgit2_SOURCE_DIR}/include) +target_include_directories(git2internal PRIVATE ${LIBGIT2_INCLUDES} ${LIBGIT2_DEPENDENCY_INCLUDES} PUBLIC ${libgit2_SOURCE_DIR}/include) target_include_directories(git2internal SYSTEM PRIVATE ${LIBGIT2_SYSTEM_INCLUDES}) -set(LIBGIT2_OBJECTS ${LIBGIT2_OBJECTS} PARENT_SCOPE) set(LIBGIT2_INCLUDES ${LIBGIT2_INCLUDES} PARENT_SCOPE) +set(LIBGIT2_OBJECTS ${LIBGIT2_OBJECTS} PARENT_SCOPE) +set(LIBGIT2_DEPENDENCY_INCLUDES ${LIBGIT2_DEPENDENCY_INCLUDES} PARENT_SCOPE) +set(LIBGIT2_DEPENDENCY_OBJECTS ${LIBGIT2_DEPENDENCY_OBJECTS} PARENT_SCOPE) set(LIBGIT2_SYSTEM_INCLUDES ${LIBGIT2_SYSTEM_INCLUDES} PARENT_SCOPE) -set(LIBGIT2_LIBS ${LIBGIT2_LIBS} PARENT_SCOPE) +set(LIBGIT2_SYSTEM_LIBS ${LIBGIT2_SYSTEM_LIBS} PARENT_SCOPE) if(XCODE_VERSION) # This is required for Xcode to actually link the libgit2 library @@ -229,7 +229,7 @@ endif() # Compile and link libgit2 add_library(git2 ${WIN_RC} ${LIBGIT2_OBJECTS}) -target_link_libraries(git2 ${LIBGIT2_LIBS}) +target_link_libraries(git2 ${LIBGIT2_SYSTEM_LIBS}) set_target_properties(git2 PROPERTIES C_STANDARD 90) set_target_properties(git2 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${libgit2_BINARY_DIR}) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e109913ff..072470350 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -16,7 +16,7 @@ add_definitions(-D_FILE_OFFSET_BITS=64) # Ensure that we do not use deprecated functions internally add_definitions(-DGIT_DEPRECATE_HARD) -include_directories(${CLAR_PATH} ${libgit2_BINARY_DIR}/src) +set(TEST_INCLUDES "${CLAR_PATH}" "${CMAKE_CURRENT_BINARY_DIR}") file(GLOB_RECURSE SRC_TEST ${CLAR_PATH}/*/*.c ${CLAR_PATH}/*/*.h) set(SRC_CLAR "main.c" "clar_libgit2.c" "clar_libgit2_trace.c" "clar_libgit2_timer.c" "clar.c") @@ -30,22 +30,20 @@ add_custom_command( DEPENDS ${SRC_TEST} WORKING_DIRECTORY ${CLAR_PATH} ) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) set_source_files_properties( ${CLAR_PATH}/clar.c PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/clar.suite) -include_directories(${LIBGIT2_INCLUDES}) -include_directories(SYSTEM ${LIBGIT2_SYSTEM_INCLUDES}) - 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 ${libgit2_BINARY_DIR}) -target_include_directories(libgit2_tests PRIVATE ../src PUBLIC ../include) -target_link_libraries(libgit2_tests ${LIBGIT2_LIBS}) +target_include_directories(libgit2_tests PRIVATE ${TEST_INCLUDES} ${LIBGIT2_INCLUDES} ${LIBGIT2_DEPENDENCY_INCLUDES}) +target_include_directories(libgit2_tests SYSTEM PRIVATE ${LIBGIT2_SYSTEM_INCLUDES}) +target_link_libraries(libgit2_tests ${LIBGIT2_SYSTEM_LIBS}) + ide_split_sources(libgit2_tests) # |