summaryrefslogtreecommitdiffstats
path: root/tests/headertest
diff options
context:
space:
mode:
Diffstat (limited to 'tests/headertest')
-rw-r--r--tests/headertest/CMakeLists.txt14
-rw-r--r--tests/headertest/headertest.c13
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/headertest/CMakeLists.txt b/tests/headertest/CMakeLists.txt
new file mode 100644
index 0000000..c70ce1a
--- /dev/null
+++ b/tests/headertest/CMakeLists.txt
@@ -0,0 +1,14 @@
+# Header file validation project: ensure that we do not publish any sloppy
+# definitions in our headers and that a consumer can include <git2.dll>
+# even when they have aggressive C90 warnings enabled.
+
+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/headertest.c b/tests/headertest/headertest.c
new file mode 100644
index 0000000..2af8a14
--- /dev/null
+++ b/tests/headertest/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;
+}