diff options
author | Peter Pettersson <boretrk@hotmail.com> | 2021-10-02 23:54:14 +0200 |
---|---|---|
committer | Peter Pettersson <boretrk@hotmail.com> | 2021-11-15 16:45:14 +0100 |
commit | 5221e1854846ac31dd2ada44fb29dc705104e851 (patch) | |
tree | 6d4adba8c5490dc85d8f6bbbd9a42b585082f177 | |
parent | 23c5c315d5f6a3e93cdb1bf1f51016fbacb86881 (diff) | |
download | libgit2-5221e1854846ac31dd2ada44fb29dc705104e851.tar.gz |
Add target for testing libgit2 headers
-rw-r--r-- | tests/CMakeLists.txt | 14 | ||||
-rw-r--r-- | tests/headertest.c | 13 |
2 files changed, 26 insertions, 1 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 072470350..d42c6ad5b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -51,7 +51,7 @@ ide_split_sources(libgit2_tests) # this on newer compilers to avoid unnecessary recompilation. # if(CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0) - add_definitions(-include \"clar_suite.h\") + target_compile_options(libgit2_tests PRIVATE -include "clar_suite.h") endif() if(MSVC_IDE) @@ -79,3 +79,15 @@ add_clar_test(ssh -v -sonline::push -sonline::clone::ssh_cert -s add_clar_test(proxy -v -sonline::clone::proxy) add_clar_test(auth_clone -v -sonline::clone::cred) add_clar_test(auth_clone_and_push -v -sonline::clone::push -sonline::push) + +# Header file validation project +add_executable(headertest headertest.c) +set_target_properties(headertest PROPERTIES C_STANDARD 90) +set_target_properties(headertest PROPERTIES C_EXTENSIONS OFF) +target_include_directories(headertest PRIVATE ${LIBGIT2_INCLUDES}) + +if (MSVC) + target_compile_options(headertest PUBLIC /W4 /WX) +else() + target_compile_options(headertest PUBLIC -Wall -Wextra -pedantic -Werror) +endif() diff --git a/tests/headertest.c b/tests/headertest.c new file mode 100644 index 000000000..2af8a14ec --- /dev/null +++ b/tests/headertest.c @@ -0,0 +1,13 @@ +/* + * Dummy project to validate header files + * + * This project is not intended to be executed, it should only include all + * header files to make sure that they can be used with stricter compiler + * settings than the libgit2 source files generally supports. + */ +#include "git2.h" + +int main(void) +{ + return 0; +} |