[libxml2] cmake: Enable GCC compiler warnings
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] cmake: Enable GCC compiler warnings
- Date: Fri, 2 Sep 2022 16:52:04 +0000 (UTC)
commit 202b8e1954af9703a453e6891c2a6cccc1a8df4f
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Thu Sep 1 06:52:02 2022 +0200
cmake: Enable GCC compiler warnings
.gitlab-ci.yml | 4 ++--
CMakeLists.txt | 9 +++++++--
2 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d0bfb71e..b869b170 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -73,7 +73,7 @@ clang:msan:
.cmake:linux:
image: registry.gitlab.gnome.org/gnome/libxml2
script:
- - cmake -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS -DCMAKE_INSTALL_PREFIX=libxml2-install
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DLIBXML2_XMLCONF_WORKING_DIR=/tests -S . -B libxml2-build
+ - cmake -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS -DCMAKE_INSTALL_PREFIX=libxml2-install
-DCMAKE_C_FLAGS='-Werror' -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLIBXML2_XMLCONF_WORKING_DIR=/tests -S . -B
libxml2-build
- cmake --build libxml2-build --target install
- mkdir -p libxml2-install/share/libxml2
- cp Copyright libxml2-install/share/libxml2
@@ -147,7 +147,7 @@ cmake:linux:clang:static:
.\7za.exe x xmlts20080827.tar.gz -olibxml2-build
}
script:
- - cmake -G Ninja -DBUILD_SHARED_LIBS="$Env:BUILD_SHARED_LIBS" -DCMAKE_INSTALL_PREFIX=libxml2-install
-DCMAKE_BUILD_TYPE=RelWithDebInfo -S . -B libxml2-build
+ - cmake -G Ninja -DBUILD_SHARED_LIBS="$Env:BUILD_SHARED_LIBS" -DCMAKE_INSTALL_PREFIX=libxml2-install
-DCMAKE_C_FLAGS='-Werror' -DCMAKE_BUILD_TYPE=RelWithDebInfo -S . -B libxml2-build
- cmake --build libxml2-build --target install
- New-Item -ItemType Directory libxml2-install\share\libxml2
- Copy-Item Copyright libxml2-install\share\libxml2
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bb3697d7..861234da 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -359,8 +359,13 @@ if(NOT BUILD_SHARED_LIBS)
set(XML_CFLAGS "-DLIBXML_STATIC")
endif()
-if(BUILD_SHARED_LIBS AND UNIX AND NOT APPLE)
- if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID STREQUAL "GNU")
+if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra -Wshadow \
+-Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return \
+-Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline \
+-Wredundant-decls -Wno-long-long -Wno-format-extra-args")
+
+ if(BUILD_SHARED_LIBS AND UNIX AND NOT APPLE)
target_link_options(LibXml2 PRIVATE
"-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libxml2.syms")
endif()
endif()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]