Remove qt6_use_modules

qt5_use_modules has been deprecated in 2013 (commit d9ea4bb144)
and removed for the first time in 2018, but then brought back - see
discussion in https://lists.qt-project.org/pipermail/development/2018-June/032837.html .

Anyhow, I think we can finally put it to a rest in Qt 6.

Change-Id: I770f7e93406ad68535d1d90e4a3bacfb920e2d5a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Kai Koehne 2020-03-24 16:08:19 +01:00
parent 5e213a41ce
commit de67bca44e
5 changed files with 0 additions and 153 deletions

View File

@ -424,52 +424,6 @@ endif()
set(_Qt6_COMPONENT_PATH "${CMAKE_CURRENT_LIST_DIR}/..")
macro(qt6_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 qt6_use_modules macro is obsolete. Use target_link_libraries with IMPORTED targets instead.")
endif()
if (NOT TARGET ${_target})
message(FATAL_ERROR "The first argument to qt6_use_modules must be an existing target.")
endif()
if ("${_link_type}" STREQUAL "LINK_PUBLIC" OR "${_link_type}" STREQUAL "LINK_PRIVATE" )
set(_qt6_modules ${ARGN})
set(_qt6_link_type ${_link_type})
else()
set(_qt6_modules ${_link_type} ${ARGN})
endif()
if ("${_qt6_modules}" STREQUAL "")
message(FATAL_ERROR "qt6_use_modules requires at least one Qt module to use.")
endif()
foreach(_module ${_qt6_modules})
if (NOT Qt6${_module}_FOUND)
find_package(Qt6${_module} PATHS "${_Qt6_COMPONENT_PATH}" NO_DEFAULT_PATH)
if (NOT Qt6${_module}_FOUND)
message(FATAL_ERROR "Cannot use \"${_module}\" module which has not yet been found.")
endif()
endif()
target_link_libraries(${_target} ${_qt6_link_type} ${Qt6${_module}_LIBRARIES})
set_property(TARGET ${_target} APPEND PROPERTY INCLUDE_DIRECTORIES ${Qt6${_module}_INCLUDE_DIRS})
set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS ${Qt6${_module}_COMPILE_DEFINITIONS})
set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG)
set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO QT_NO_DEBUG)
set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL QT_NO_DEBUG)
if (Qt6_POSITION_INDEPENDENT_CODE
AND (NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
OR CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0))
set_property(TARGET ${_target} PROPERTY POSITION_INDEPENDENT_CODE ${Qt6_POSITION_INDEPENDENT_CODE})
endif()
endforeach()
endmacro()
function(add_qt_gui_executable target)
if(ANDROID)
add_library("${target}" MODULE ${ARGN})

View File

@ -47,7 +47,6 @@ find_package(Qt5Core REQUIRED)
include("${_Qt5CTestMacros}")
expect_pass(test_use_modules_function)
expect_pass(test_umbrella_config)
expect_pass(test_wrap_cpp_and_resources)
if (NOT NO_WIDGETS)

View File

@ -1,18 +0,0 @@
cmake_minimum_required(VERSION 2.8)
project(test_use_modules_function)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_executable(two two.cpp)
add_executable(three three.cpp)
find_package(Qt5Core)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
qt5_use_modules(two Test)
qt5_use_modules(three Gui Test)

View File

@ -1,45 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtTest>
#include <QWindow>
class Three : public QObject
{
Q_OBJECT
public:
Three(QObject *parent = 0)
{
QWindow *w = new QWindow;
w->show();
}
};
QTEST_MAIN(Three)
#include "three.moc"

View File

@ -1,43 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtTest>
class Two : public QObject
{
Q_OBJECT
public:
Two(QObject *parent = 0)
{
}
};
QTEST_MAIN(Two)
#include "two.moc"