diff options
author | Kai Koehne <kai.koehne@qt.io> | 2019-11-26 16:06:37 +0100 |
---|---|---|
committer | Kai Koehne <kai.koehne@qt.io> | 2020-03-25 14:43:02 +0100 |
commit | e63d2272895ea5178f0704546dc5b5deed4b1b39 (patch) | |
tree | f570b6be0166a39ad489c54c9a230fae04ef6569 /src/corelib/Qt5CoreMacros.cmake | |
parent | cc333f5faf2fa892ca0e321915263cab5d793191 (diff) |
CMake: Warn about using internal macros and functions
These functions and macros were never documented.
Let's warn about using them for now, with the option of
removing / renaming them in Qt 6.
Change-Id: Ia595aa35b73e54534e535d2946581651af8023f2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src/corelib/Qt5CoreMacros.cmake')
-rw-r--r-- | src/corelib/Qt5CoreMacros.cmake | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake index f666c67ed9..88350cb68b 100644 --- a/src/corelib/Qt5CoreMacros.cmake +++ b/src/corelib/Qt5CoreMacros.cmake @@ -1,5 +1,6 @@ #============================================================================= # Copyright 2005-2011 Kitware, Inc. +# Copyright (C) 2020 The Qt Company Ltd. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -38,8 +39,17 @@ include(CMakeParseArguments) +function(_qt5_warn_deprecated command_name) + if(NOT DEFINED _QT5_INTERNAL_SCOPE) + message(AUTHOR_WARNING + "${command_name} is not part of the official API, and might be removed in Qt 6.") + endif() +endfunction() + # macro used to create the names of output files preserving relative dirs macro(qt5_make_output_file infile prefix ext outfile ) + _qt5_warn_deprecated("qt5_make_output_file") + string(LENGTH ${CMAKE_CURRENT_BINARY_DIR} _binlength) string(LENGTH ${infile} _infileLength) set(_checkinfile ${CMAKE_CURRENT_SOURCE_DIR}) @@ -73,6 +83,8 @@ endmacro() macro(qt5_get_moc_flags _moc_flags) + _qt5_warn_deprecated("qt5_get_moc_flags") + set(${_moc_flags}) get_directory_property(_inc_DIRS INCLUDE_DIRECTORIES) @@ -105,6 +117,8 @@ endmacro() # helper macro to set up a moc rule function(qt5_create_moc_command infile outfile moc_flags moc_options moc_target moc_depends) + _qt5_warn_deprecated("qt5_create_moc_command") + # Pass the parameters in a file. Set the working directory to # be that containing the parameters file and reference it by # just the file name. This is necessary because the moc tool on @@ -151,6 +165,8 @@ endfunction() function(qt5_generate_moc infile outfile ) + set(_QT5_INTERNAL_SCOPE ON) + # get include dirs and flags qt5_get_moc_flags(moc_flags) get_filename_component(abs_infile ${infile} ABSOLUTE) @@ -177,7 +193,9 @@ endif() # qt5_wrap_cpp(outfiles inputfile ... ) -function(qt5_wrap_cpp outfiles ) +function(qt5_wrap_cpp outfiles) + set(_QT5_INTERNAL_SCOPE ON) + # get include dirs qt5_get_moc_flags(moc_flags) @@ -250,7 +268,8 @@ endfunction() # qt5_add_binary_resources(target inputfiles ... ) -function(qt5_add_binary_resources target ) +function(qt5_add_binary_resources target) + set(_QT5_INTERNAL_SCOPE ON) set(options) set(oneValueArgs DESTINATION) @@ -296,7 +315,8 @@ endif() # qt5_add_resources(outfiles inputfile ... ) -function(qt5_add_resources outfiles ) +function(qt5_add_resources outfiles) + set(_QT5_INTERNAL_SCOPE ON) set(options) set(oneValueArgs) @@ -345,7 +365,9 @@ endif() # qt5_add_big_resources(outfiles inputfile ... ) -function(qt5_add_big_resources outfiles ) +function(qt5_add_big_resources outfiles) + set(_QT5_INTERNAL_SCOPE ON) + if (CMAKE_VERSION VERSION_LESS 3.9) message(FATAL_ERROR, "qt5_add_big_resources requires CMake 3.9 or newer") endif() @@ -406,15 +428,7 @@ endif() set(_Qt5_COMPONENT_PATH "${CMAKE_CURRENT_LIST_DIR}/..") macro(qt5_use_modules _target _link_type) - if(CMAKE_WARN_DEPRECATED) - set(messageType WARNING) - endif() - if(CMAKE_ERROR_DEPRECATED) - set(messageType FATAL_ERROR) - endif() - if(messageType) - message(${messageType} "The qt5_use_modules macro is obsolete. Use target_link_libraries with IMPORTED targets instead.") - endif() + _qt5_warn_deprecated("qt5_use_modules") if (NOT TARGET ${_target}) message(FATAL_ERROR "The first argument to qt5_use_modules must be an existing target.") |