[poppler] CMakeLists.txt .gitlab-ci.yml qt5/tests qt6/tests

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Aug 8 22:27:47 UTC 2022


 .gitlab-ci.yml           |    6 ++----
 CMakeLists.txt           |    6 ++++++
 qt5/tests/CMakeLists.txt |   24 ++++++++++++++++++++++++
 qt6/tests/CMakeLists.txt |   24 ++++++++++++++++++++++++
 4 files changed, 56 insertions(+), 4 deletions(-)

New commits:
commit b8aaf51d69938412f9cca215d3825f53931706d6
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue Aug 9 00:21:00 2022 +0200

    Workaround cmake 3.24.0 warning-y code
    
    https://gitlab.kitware.com/cmake/cmake/-/issues/23823

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a067dc65..237283a6 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -46,7 +46,6 @@ build:
 
 build_clang14_libcpp:
   stage: build
-  image: debian:bookworm
   script:
     - echo "We want to compile with C++23 here because it has some nice things like deleted std::string nullptr constructor"
     - sed -i -e "s at CMAKE_CXX_STANDARD 17 at CMAKE_CXX_STANDARD 23 at g" CMakeLists.txt
@@ -91,12 +90,11 @@ build_mingw64_fedora36:
 
 build_clazy_clang14:
   stage: build
-  image: debian:bookworm
   script:
     - apt-get install --yes --no-install-recommends clazy clang-14
     - mkdir -p build && cd build
-    - CC=clang-14 CXX=clazy CXXFLAGS="-Werror -Wno-deprecated-declarations" cmake -G Ninja ..
-    - CLAZY_CHECKS="level0,level1,level2,isempty-vs-count,qhash-with-char-pointer-key,tr-non-literal,no-non-pod-global-static" ninja
+    - CC=clang-14 CXX=clazy CXXFLAGS="-Werror -Wno-deprecated-declarations" cmake -G Ninja -DADD_CLAZY_FLAGS=ON ..
+    - ninja
 
 build_android:
   stage: build
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b00618d8..29709809 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -87,6 +87,7 @@ else()
   set(ENABLE_RELOCATABLE OFF)
 endif()
 option(EXTRA_WARN "Enable extra compile warnings" OFF)
+option(ADD_CLAZY_FLAGS "Enable clazy compile warnings" OFF)
 
 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
 
@@ -131,6 +132,11 @@ else()
   message(FATAL_ERROR "Invalid font configuration setting: ${FONT_CONFIGURATION}")
 endif()
 
+if(ADD_CLAZY_FLAGS)
+  set(DEFAULT_CLAZY_FLAGS "SHELL:-Xclang -plugin-arg-clazy" "SHELL:-Xclang level2,isempty-vs-count,qhash-with-char-pointer-key,tr-non-literal,no-non-pod-global-static")
+  add_compile_options(${DEFAULT_CLAZY_FLAGS})
+endif()
+
 # Enable these unconditionally.
 set(OPI_SUPPORT ON)
 set(TEXTOUT_WORD_LIST ON)
diff --git a/qt5/tests/CMakeLists.txt b/qt5/tests/CMakeLists.txt
index baadd428..adc38117 100644
--- a/qt5/tests/CMakeLists.txt
+++ b/qt5/tests/CMakeLists.txt
@@ -14,6 +14,18 @@ macro(QT5_ADD_SIMPLETEST exe source)
   )
   poppler_add_test(${exe} BUILD_QT5_TESTS ${${test_name}_SOURCES})
   target_link_libraries(${exe} poppler-qt5 Qt5::Widgets)
+
+  if (ADD_CLAZY_FLAGS)
+    # Workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/23823
+    get_target_property(TARGET_FLAGS ${exe} COMPILE_OPTIONS)
+    string(REPLACE "${DEFAULT_CLAZY_FLAGS}" "" TARGET_FLAGS "${TARGET_FLAGS}")
+    set_target_properties(${exe} PROPERTIES COMPILE_OPTIONS "${TARGET_FLAGS}")
+  endif()
+
+  if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+    # Workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/23823
+    set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${exe}_autogen/mocs_compilation.cpp PROPERTIES COMPILE_FLAGS "-Wno-weak-vtables")
+  endif()
 endmacro(QT5_ADD_SIMPLETEST)
 
 macro(QT5_ADD_QTEST exe source)
@@ -25,6 +37,18 @@ macro(QT5_ADD_QTEST exe source)
     poppler_add_test(${exe} BUILD_QT5_TESTS ${${test_name}_SOURCES})
     add_test(${exe} ${EXECUTABLE_OUTPUT_PATH}/${exe})
     target_link_libraries(${exe} poppler-qt5 Qt5::Widgets Qt5::Test Qt5::Core Qt5::Gui)
+
+    if (ADD_CLAZY_FLAGS)
+      # Workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/23823
+      get_target_property(TARGET_FLAGS ${exe} COMPILE_OPTIONS)
+      string(REPLACE "${DEFAULT_CLAZY_FLAGS}" "" TARGET_FLAGS "${TARGET_FLAGS}")
+      set_target_properties(${exe} PROPERTIES COMPILE_OPTIONS "${TARGET_FLAGS}")
+    endif()
+
+    if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+      # Workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/23823
+      set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${exe}_autogen/mocs_compilation.cpp PROPERTIES COMPILE_FLAGS "-Wno-weak-vtables")
+    endif()
   endif ()
 endmacro(QT5_ADD_QTEST)
 
diff --git a/qt6/tests/CMakeLists.txt b/qt6/tests/CMakeLists.txt
index d5f7184f..efa899a0 100644
--- a/qt6/tests/CMakeLists.txt
+++ b/qt6/tests/CMakeLists.txt
@@ -14,6 +14,18 @@ macro(QT6_ADD_SIMPLETEST exe source)
   )
   poppler_add_test(${exe} BUILD_QT6_TESTS ${${test_name}_SOURCES})
   target_link_libraries(${exe} poppler-qt6 Qt6::Widgets)
+
+  if (ADD_CLAZY_FLAGS)
+    # Workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/23823
+    get_target_property(TARGET_FLAGS ${exe} COMPILE_OPTIONS)
+    string(REPLACE "${DEFAULT_CLAZY_FLAGS}" "" TARGET_FLAGS "${TARGET_FLAGS}")
+    set_target_properties(${exe} PROPERTIES COMPILE_OPTIONS "${TARGET_FLAGS}")
+  endif()
+
+  if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+    # Workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/23823
+    set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${exe}_autogen/mocs_compilation.cpp PROPERTIES COMPILE_FLAGS "-Wno-weak-vtables")
+  endif()
 endmacro()
 
 macro(QT6_ADD_QTEST exe source)
@@ -24,6 +36,18 @@ macro(QT6_ADD_QTEST exe source)
     poppler_add_test(${exe} BUILD_QT6_TESTS ${${test_name}_SOURCES})
     add_test(${exe} ${EXECUTABLE_OUTPUT_PATH}/${exe})
     target_link_libraries(${exe} poppler-qt6 Qt6::Widgets Qt6::Test Qt6::Gui)
+
+    if (ADD_CLAZY_FLAGS)
+      # Workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/23823
+      get_target_property(TARGET_FLAGS ${exe} COMPILE_OPTIONS)
+      string(REPLACE "${DEFAULT_CLAZY_FLAGS}" "" TARGET_FLAGS "${TARGET_FLAGS}")
+      set_target_properties(${exe} PROPERTIES COMPILE_OPTIONS "${TARGET_FLAGS}")
+    endif()
+
+    if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+      # Workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/23823
+      set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${exe}_autogen/mocs_compilation.cpp PROPERTIES COMPILE_FLAGS "-Wno-weak-vtables")
+    endif()
 endmacro()
 
 


More information about the poppler mailing list