From 40c49bd50dc2acefa71bee7d688a94a1f7128cbc Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 21 Sep 2017 04:53:09 -0400 Subject: [PATCH] Clang: be more explicit about marking third-party code. - This is only a partial solution to warnings caused by third-party code, since #including the headers from other sources won't apply the warning-suppressions. - Flags are not applied when building the source as part of a larger target, but are on re-building just one object (it seems -- CMake issue to track down). --- CMakeLists.txt | 11 +++++++++-- src/libcalamares/CMakeLists.txt | 3 +-- src/libcalamaresui/CMakeLists.txt | 12 ++++++++++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f9075296..179e2197c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,8 +67,7 @@ if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) # Third-party code where we don't care so much about compiler warnings # (because it's uncomfortable to patch) get different flags; use - # set_source_files_properties( - # PROPERTIES COMPILE_FLAGS "${SUPPRESS_3RDPARTY_WARNINGS}" ) + # mark_thirdparty_code( [...] ) # to switch off warnings for those sources. set( SUPPRESS_3RDPARTY_WARNINGS "-Wno-everything" ) @@ -87,6 +86,14 @@ else() set( SUPPRESS_3RDPARTY_WARNINGS "" ) endif() +macro(mark_thirdparty_code) + set_source_files_properties( ${ARGV} + PROPERTIES + COMPILE_FLAGS "${SUPPRESS_3RDPARTY_WARNINGS}" + COMPILE_DEFINITIONS "THIRDPARTY" + ) +endmacro() + if( CMAKE_COMPILER_IS_GNUCXX ) if( CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 4.9 ) diff --git a/src/libcalamares/CMakeLists.txt b/src/libcalamares/CMakeLists.txt index ba10fcc70..b5bfa4c98 100644 --- a/src/libcalamares/CMakeLists.txt +++ b/src/libcalamares/CMakeLists.txt @@ -32,8 +32,7 @@ set( kdsagSources kdsingleapplicationguard/kdtoolsglobal.cpp kdsingleapplicationguard/kdlockedsharedmemorypointer.cpp ) -set_source_files_properties( ${kdsagSources} - PROPERTIES COMPILE_FLAGS "${SUPPRESS_3RDPARTY_WARNINGS}" ) +mark_thirdparty_code( ${kdsagSources} ) include_directories( ${CMAKE_CURRENT_BINARY_DIR} diff --git a/src/libcalamaresui/CMakeLists.txt b/src/libcalamaresui/CMakeLists.txt index 0021fbbfd..ccc46f2f3 100644 --- a/src/libcalamaresui/CMakeLists.txt +++ b/src/libcalamaresui/CMakeLists.txt @@ -1,6 +1,6 @@ project( libcalamaresui CXX ) -list( APPEND calamaresui_SOURCES +set( calamaresui_SOURCES modulesystem/CppJobModule.cpp modulesystem/Module.cpp modulesystem/ModuleManager.cpp @@ -29,7 +29,15 @@ list( APPEND calamaresui_SOURCES ViewManager.cpp ) -list( APPEND calamaresui_UI +# Don't warn about third-party sources +mark_thirdparty_code( + utils/ImageRegistry.cpp + utils/qjsonitem.cpp + utils/qjsonmodel.cpp + widgets/waitingspinnerwidget.cpp +) + +set( calamaresui_UI utils/DebugWindow.ui )