Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
env:
CC: clang
CFLAGS: -fsanitize=memory -fsanitize-memory-track-origins=2 -fsanitize-blacklist=/home/libgit2/source/script/sanitizers.supp -fno-optimize-sibling-calls -fno-omit-frame-pointer
CMAKE_OPTIONS: -DC_EXTENSIONS=ON -DCMAKE_PREFIX_PATH=/usr/local/msan -DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_BUNDLED_ZLIB=ON -DUSE_SSH=ON
CMAKE_OPTIONS: -DCMAKE_C_EXTENSIONS=ON -DCMAKE_PREFIX_PATH=/usr/local/msan -DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_BUNDLED_ZLIB=ON -DUSE_SSH=ON
CMAKE_GENERATOR: Ninja
SKIP_SSH_TESTS: true
SKIP_NEGOTIATE_TESTS: true
Expand Down
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ option(SONAME "Set the (SO)VERSION of the target"
option(DEPRECATE_HARD "Do not include deprecated functions in the library" OFF)

# Compilation options
# Default to c99 on Android Studio for compatibility; c90 everywhere else
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Android")
set(CMAKE_C_STANDARD "99" CACHE STRING "The C standard to compile against")
else()
set(CMAKE_C_STANDARD "90" CACHE STRING "The C standard to compile against")
endif()
option(CMAKE_C_EXTENSIONS "Whether compiler extensions are supported" OFF)
option(ENABLE_WERROR "Enable compilation with -Werror" OFF)

if(UNIX)
Expand Down Expand Up @@ -91,7 +98,6 @@ endif()
# Modules

include(FeatureSummary)
include(SetCStandard)
include(CheckLibraryExists)
include(CheckFunctionExists)
include(CheckSymbolExists)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,8 @@ linker. These flags may be useful for cross-compilation or specialized
setups.

- `CMAKE_C_FLAGS`: Set your own compiler flags
- `C_STANDARD`: the C standard to compile against; defaults to `C90`
- `C_EXTENSIONS`: whether compiler extensions are supported; defaults to `OFF`
- `CMAKE_C_STANDARD`: the C standard to compile against; defaults to `C90`
- `CMAKE_C_EXTENSIONS`: whether compiler extensions are supported; defaults to `OFF`
- `CMAKE_FIND_ROOT_PATH`: Override the search path for libraries
- `ZLIB_LIBRARY`, `OPENSSL_SSL_LIBRARY` AND `OPENSSL_CRYPTO_LIBRARY`:
Tell CMake where to find those specific libraries
Expand Down
24 changes: 0 additions & 24 deletions cmake/SetCStandard.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion deps/llhttp/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void llhttp_free(llhttp_t* parser) {
free(parser);
}

#endif // defined(__wasm__)
#endif /* defined(__wasm__) */

/* Some getters required to get stuff from the parser */

Expand Down
1 change: 0 additions & 1 deletion deps/ntlmclient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,3 @@ else()
endif()

add_library(ntlmclient OBJECT ${SRC_NTLMCLIENT} ${SRC_NTLMCLIENT_UNICODE} ${SRC_NTLMCLIENT_CRYPTO})
set_target_properties(ntlmclient PROPERTIES C_STANDARD 90)
1 change: 0 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
file(GLOB SRC_EXAMPLES *.c *.h)

add_executable(lg2 ${SRC_EXAMPLES})
set_c_standard(lg2)

# Ensure that we do not use deprecated functions internally
add_definitions(-DGIT_DEPRECATE_HARD)
Expand Down
1 change: 0 additions & 1 deletion fuzzers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ foreach(fuzz_target_src ${SRC_FUZZERS})
endif()

add_executable(${fuzz_target_name} ${${fuzz_target_name}_SOURCES})
set_c_standard(${fuzz_target_name})
target_include_directories(${fuzz_target_name} PRIVATE ${LIBGIT2_INCLUDES} ${LIBGIT2_DEPENDENCY_INCLUDES})
target_include_directories(${fuzz_target_name} SYSTEM PRIVATE ${LIBGIT2_SYSTEM_INCLUDES})

Expand Down
1 change: 0 additions & 1 deletion src/cli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ add_executable(git2_cli ${CLI_SRC_C} ${CLI_SRC_OS} ${CLI_OBJECTS}
${LIBGIT2_DEPENDENCY_OBJECTS})
target_link_libraries(git2_cli ${CLI_LIBGIT2_LIBRARY} ${LIBGIT2_SYSTEM_LIBS})

set_c_standard(git2_cli)
set_target_properties(git2_cli PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${libgit2_BINARY_DIR})
set_target_properties(git2_cli PROPERTIES OUTPUT_NAME ${LIBGIT2_FILENAME})

Expand Down
1 change: 0 additions & 1 deletion src/libgit2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# git library functionality.

add_library(libgit2 OBJECT)
set_c_standard(libgit2)

include(PkgBuildConfig)

Expand Down
1 change: 0 additions & 1 deletion src/util/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# util: a shared library for common utility functions for libgit2 projects

add_library(util OBJECT)
set_c_standard(util)

configure_file(git2_features.h.in git2_features.h)

Expand Down
1 change: 0 additions & 1 deletion tests/headertest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# even when they have aggressive C90 warnings enabled.

add_executable(headertest headertest.c)
set_c_standard(headertest)

target_include_directories(headertest PRIVATE ${LIBGIT2_INCLUDES})

Expand Down
1 change: 0 additions & 1 deletion tests/libgit2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ set_source_files_properties(
PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/clar.suite)

add_executable(libgit2_tests ${SRC_CLAR} ${SRC_TEST} ${LIBGIT2_OBJECTS})
set_c_standard(libgit2_tests)

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})
Expand Down
1 change: 0 additions & 1 deletion tests/util/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ set_source_files_properties(
PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/clar.suite)

add_executable(util_tests ${SRC_CLAR} ${SRC_TEST} ${LIBGIT2_OBJECTS})
set_c_standard(util_tests)

set_target_properties(util_tests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${libgit2_BINARY_DIR})

Expand Down