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).
This commit is contained in:
parent
d89b17a244
commit
40c49bd50d
@ -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( <file>
|
||||
# PROPERTIES COMPILE_FLAGS "${SUPPRESS_3RDPARTY_WARNINGS}" )
|
||||
# mark_thirdparty_code( <file> [<file>...] )
|
||||
# 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 )
|
||||
|
@ -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}
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user