diff options
author | Brad King <brad.king@kitware.com> | 2018-05-15 13:52:09 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-05-15 13:52:09 (GMT) |
commit | 29d20e2e0ce6a189e0e8fbfa2f7355f94749e390 (patch) | |
tree | 8e23f529dba916b3fc5509c966141f02bd403e92 | |
parent | 813bcc2997a5692e8d9e141cf12b662b8b4dfbac (diff) | |
parent | 9672d81ca3e51004f94bb2d9503e8b569565c8d0 (diff) | |
download | CMake-29d20e2e0ce6a189e0e8fbfa2f7355f94749e390.zip CMake-29d20e2e0ce6a189e0e8fbfa2f7355f94749e390.tar.gz CMake-29d20e2e0ce6a189e0e8fbfa2f7355f94749e390.tar.bz2 |
Merge branch 'fix-automoc-warnings' into release-3.11
Merge-request: !2066
-rw-r--r-- | Help/release/3.11.rst | 6 | ||||
-rw-r--r-- | Modules/Qt4Macros.cmake | 25 |
2 files changed, 23 insertions, 8 deletions
diff --git a/Help/release/3.11.rst b/Help/release/3.11.rst index 184497c..971b3e2 100644 --- a/Help/release/3.11.rst +++ b/Help/release/3.11.rst @@ -292,3 +292,9 @@ Changes made since CMake 3.11.0 include the following. it did prior to 3.11.0. This diagnostic was accidentally dropped from CMake 3.11.0 and 3.11.1 by the change to allow globally visible imported targets to be aliased. + +* The :module:`FindQt4` module ``qt4_wrap_cpp``, ``qt4_wrap_ui`` and + ``qt4_add_resources`` macros now set :prop_sf:`SKIP_AUTOMOC` and + :prop_sf:`SKIP_AUTOUIC` on their generated files. These files never + need to be processed by moc or uic, and we must say so explicitly to + account for policy :policy:`CMP0071`. diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index aee4028..a2c8d85 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -151,7 +151,8 @@ macro (QT4_GENERATE_MOC infile outfile ) set(moc_target ${ARGV3}) endif() QT4_CREATE_MOC_COMMAND(${abs_infile} ${_outfile} "${moc_flags}" "" "${moc_target}") - set_source_files_properties(${outfile} PROPERTIES SKIP_AUTOMOC TRUE) # don't run automoc on this file + set_property(SOURCE ${outfile} PROPERTY SKIP_AUTOMOC TRUE) # don't run automoc on this file + set_property(SOURCE ${outfile} PROPERTY SKIP_AUTOUIC TRUE) # don't run autouic on this file endmacro () @@ -166,6 +167,8 @@ macro (QT4_WRAP_CPP outfiles ) get_filename_component(it ${it} ABSOLUTE) QT4_MAKE_OUTPUT_FILE(${it} moc_ cxx outfile) QT4_CREATE_MOC_COMMAND(${it} ${outfile} "${moc_flags}" "${moc_options}" "${moc_target}") + set_property(SOURCE ${outfile} PROPERTY SKIP_AUTOMOC TRUE) # don't run automoc on this file + set_property(SOURCE ${outfile} PROPERTY SKIP_AUTOUIC TRUE) # don't run autouic on this file set(${outfiles} ${${outfiles}} ${outfile}) endforeach() @@ -185,6 +188,8 @@ macro (QT4_WRAP_UI outfiles ) COMMAND Qt4::uic ARGS ${ui_options} -o ${outfile} ${infile} MAIN_DEPENDENCY ${infile} VERBATIM) + set_property(SOURCE ${outfile} PROPERTY SKIP_AUTOMOC TRUE) # don't run automoc on this file + set_property(SOURCE ${outfile} PROPERTY SKIP_AUTOUIC TRUE) # don't run autouic on this file set(${outfiles} ${${outfiles}} ${outfile}) endforeach () @@ -233,6 +238,8 @@ macro (QT4_ADD_RESOURCES outfiles ) ARGS ${rcc_options} -name ${outfilename} -o ${outfile} ${infile} MAIN_DEPENDENCY ${infile} DEPENDS ${_RC_DEPENDS} "${out_depends}" VERBATIM) + set_property(SOURCE ${outfile} PROPERTY SKIP_AUTOMOC TRUE) # don't run automoc on this file + set_property(SOURCE ${outfile} PROPERTY SKIP_AUTOUIC TRUE) # don't run autouic on this file set(${outfiles} ${${outfiles}} ${outfile}) endforeach () @@ -245,19 +252,19 @@ macro(QT4_ADD_DBUS_INTERFACE _sources _interface _basename) set(_impl "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp") set(_moc "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc") - get_source_file_property(_nonamespace ${_interface} NO_NAMESPACE) + get_property(_nonamespace SOURCE ${_interface} PROPERTY NO_NAMESPACE) if(_nonamespace) set(_params -N -m) else() set(_params -m) endif() - get_source_file_property(_classname ${_interface} CLASSNAME) + get_property(_classname SOURCE ${_interface} PROPERTY CLASSNAME) if(_classname) set(_params ${_params} -c ${_classname}) endif() - get_source_file_property(_include ${_interface} INCLUDE) + get_property(_include SOURCE ${_interface} PROPERTY INCLUDE) if(_include) set(_params ${_params} -i ${_include}) endif() @@ -266,7 +273,8 @@ macro(QT4_ADD_DBUS_INTERFACE _sources _interface _basename) COMMAND Qt4::qdbusxml2cpp ${_params} -p ${_basename} ${_infile} DEPENDS ${_infile} VERBATIM) - set_source_files_properties("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE) + set_property(SOURCE ${_impl} PROPERTY SKIP_AUTOMOC TRUE) # don't run automoc on this file + set_property(SOURCE ${_impl} PROPERTY SKIP_AUTOUIC TRUE) # don't run autouic on this file QT4_GENERATE_MOC("${_header}" "${_moc}") @@ -350,7 +358,8 @@ macro(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optional endif() QT4_GENERATE_MOC("${_header}" "${_moc}") - set_source_files_properties("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE) + set_property(SOURCE ${_impl} PROPERTY SKIP_AUTOMOC TRUE) # don't run automoc on this file + set_property(SOURCE ${_impl} PROPERTY SKIP_AUTOUIC TRUE) # don't run autouic on this file MACRO_ADD_FILE_DEPENDENCIES("${_impl}" "${_moc}") list(APPEND ${_sources} "${_impl}" "${_header}" "${_moc}") @@ -374,7 +383,7 @@ macro(QT4_AUTOMOC) # cmake is run for the very first time on them -> however the .cpp files might # exist at a later run. at that time we need to skip them, so that we don't add two # different rules for the same moc file - get_source_file_property(_skip ${_abs_FILE} SKIP_AUTOMOC) + get_property(_skip SOURCE ${_abs_FILE} PROPERTY SKIP_AUTOMOC) if ( NOT _skip AND EXISTS ${_abs_FILE} ) @@ -454,7 +463,7 @@ macro(QT4_ADD_TRANSLATION _qm_files) foreach (_current_FILE ${ARGN}) get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE) get_filename_component(qm ${_abs_FILE} NAME_WE) - get_source_file_property(output_location ${_abs_FILE} OUTPUT_LOCATION) + get_property(output_location SOURCE ${_abs_FILE} PROPERTY OUTPUT_LOCATION) if(output_location) file(MAKE_DIRECTORY "${output_location}") set(qm "${output_location}/${qm}.qm") |