CMake: switch to using autouic on plugins
- Use autouic so that we can also pass in --include to add a code-warning-suppression to the generated code, just like we can do with moc.
This commit is contained in:
parent
ed3eafbc2d
commit
ba7ee445c6
@ -211,6 +211,7 @@ if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
|||||||
set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" )
|
set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" )
|
||||||
|
|
||||||
set( CALAMARES_AUTOMOC_OPTIONS "-butils/moc-warnings.h" )
|
set( CALAMARES_AUTOMOC_OPTIONS "-butils/moc-warnings.h" )
|
||||||
|
set( CALAMARES_AUTOUIC_OPTIONS --include utils/moc-warnings.h )
|
||||||
else()
|
else()
|
||||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--no-undefined" )
|
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--no-undefined" )
|
||||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--fatal-warnings -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type" )
|
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--fatal-warnings -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type" )
|
||||||
|
@ -61,11 +61,6 @@ function(calamares_add_library)
|
|||||||
include_directories(${CMAKE_CURRENT_LIST_DIR})
|
include_directories(${CMAKE_CURRENT_LIST_DIR})
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
if(LIBRARY_UI)
|
|
||||||
qt5_wrap_ui(LIBRARY_UI_SOURCES ${LIBRARY_UI})
|
|
||||||
list(APPEND LIBRARY_SOURCES ${LIBRARY_UI_SOURCES})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# add resources from current dir
|
# add resources from current dir
|
||||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${LIBRARY_RESOURCES}")
|
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${LIBRARY_RESOURCES}")
|
||||||
qt5_add_resources(LIBRARY_RC_SOURCES "${LIBRARY_RESOURCES}")
|
qt5_add_resources(LIBRARY_RC_SOURCES "${LIBRARY_RESOURCES}")
|
||||||
@ -83,6 +78,9 @@ function(calamares_add_library)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
calamares_automoc(${target})
|
calamares_automoc(${target})
|
||||||
|
if(LIBRARY_UI)
|
||||||
|
calamares_autouic(${target} ${LIBRARY_UI})
|
||||||
|
endif()
|
||||||
|
|
||||||
if(LIBRARY_EXPORT_MACRO)
|
if(LIBRARY_EXPORT_MACRO)
|
||||||
set_target_properties(${target} PROPERTIES COMPILE_DEFINITIONS ${LIBRARY_EXPORT_MACRO})
|
set_target_properties(${target} PROPERTIES COMPILE_DEFINITIONS ${LIBRARY_EXPORT_MACRO})
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#
|
#
|
||||||
###
|
###
|
||||||
#
|
#
|
||||||
# Helper function for doing automoc on a target.
|
# Helper function for doing automoc on a target, and autoui on a .ui file.
|
||||||
#
|
#
|
||||||
# Sets AUTOMOC TRUE for a target.
|
# Sets AUTOMOC TRUE for a target.
|
||||||
#
|
#
|
||||||
@ -27,6 +27,8 @@
|
|||||||
# libcalamares/utils/moc-warnings.h file to the moc, which in turn
|
# libcalamares/utils/moc-warnings.h file to the moc, which in turn
|
||||||
# reduces compiler warnings in generated MOC code.
|
# reduces compiler warnings in generated MOC code.
|
||||||
#
|
#
|
||||||
|
# If the global variable CALAMARES_AUTOUIC_OPTIONS is set, adds that
|
||||||
|
# to the options passed to uic.
|
||||||
|
|
||||||
function(calamares_automoc TARGET)
|
function(calamares_automoc TARGET)
|
||||||
set_target_properties( ${TARGET} PROPERTIES AUTOMOC TRUE )
|
set_target_properties( ${TARGET} PROPERTIES AUTOMOC TRUE )
|
||||||
@ -34,3 +36,12 @@ function(calamares_automoc TARGET)
|
|||||||
set_target_properties( ${TARGET} PROPERTIES AUTOMOC_MOC_OPTIONS "${CALAMARES_AUTOMOC_OPTIONS}" )
|
set_target_properties( ${TARGET} PROPERTIES AUTOMOC_MOC_OPTIONS "${CALAMARES_AUTOMOC_OPTIONS}" )
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
function(calamares_autouic TARGET)
|
||||||
|
set_target_properties( ${TARGET} PROPERTIES AUTOUIC TRUE )
|
||||||
|
if ( CALAMARES_AUTOUIC_OPTIONS )
|
||||||
|
foreach(S ${ARGN})
|
||||||
|
set_property(SOURCE ${S} PROPERTY AUTOUIC_OPTIONS "${CALAMARES_AUTOUIC_OPTIONS}")
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
Loading…
Reference in New Issue
Block a user