Mark qt4_use_modules and qt4_automoc as obsolete.
The QT_QMAKE_EXECUTABLE has to be passed through the cmake calls because the executable may not be in the PATH.
This commit is contained in:
parent
c64326bc0b
commit
cb7f32f5b8
|
@ -100,6 +100,7 @@
|
|||
# because you need a custom filename for the moc file or something similar.
|
||||
#
|
||||
# macro QT4_AUTOMOC(sourcefile1 sourcefile2 ... )
|
||||
# The qt4_automoc macro is obsolete. Use the CMAKE_AUTOMOC feature instead.
|
||||
# This macro is still experimental.
|
||||
# It can be used to have moc automatically handled.
|
||||
# So if you have the files foo.h and foo.cpp, and in foo.h a
|
||||
|
@ -174,6 +175,7 @@
|
|||
# must exist and are not updated in any way.
|
||||
#
|
||||
# function QT4_USE_MODULES( target [link_type] modules...)
|
||||
# This function is obsolete. Use target_link_libraries with IMPORTED targets instead.
|
||||
# Make <target> use the <modules> from Qt. Using a Qt module means
|
||||
# to link to the library, add the relevant include directories for the module,
|
||||
# and add the relevant compiler defines for using the module.
|
||||
|
|
|
@ -357,6 +357,17 @@ endmacro()
|
|||
|
||||
|
||||
macro(QT4_AUTOMOC)
|
||||
if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.11)
|
||||
if(CMAKE_WARN_DEPRECATED)
|
||||
set(messageType WARNING)
|
||||
endif()
|
||||
if(CMAKE_ERROR_DEPRECATED)
|
||||
set(messageType FATAL_ERROR)
|
||||
endif()
|
||||
if(messageType)
|
||||
message(${messageType} "The qt4_automoc macro is obsolete. Use the CMAKE_AUTOMOC feature instead.")
|
||||
endif()
|
||||
endif()
|
||||
QT4_GET_MOC_FLAGS(_moc_INCS)
|
||||
|
||||
set(_matching_FILES )
|
||||
|
@ -467,6 +478,17 @@ macro(QT4_ADD_TRANSLATION _qm_files)
|
|||
endmacro()
|
||||
|
||||
function(qt4_use_modules _target _link_type)
|
||||
if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.11)
|
||||
if(CMAKE_WARN_DEPRECATED)
|
||||
set(messageType WARNING)
|
||||
endif()
|
||||
if(CMAKE_ERROR_DEPRECATED)
|
||||
set(messageType FATAL_ERROR)
|
||||
endif()
|
||||
if(messageType)
|
||||
message(${messageType} "The qt4_use_modules function is obsolete. Use target_link_libraries with IMPORTED targets instead.")
|
||||
endif()
|
||||
endif()
|
||||
if ("${_link_type}" STREQUAL "LINK_PUBLIC" OR "${_link_type}" STREQUAL "LINK_PRIVATE")
|
||||
set(modules ${ARGN})
|
||||
set(link_type ${_link_type})
|
||||
|
|
|
@ -101,6 +101,10 @@ find_package(Qt5Core QUIET)
|
|||
if (QT4_FOUND AND Qt5Core_FOUND AND NOT Qt5Core_VERSION VERSION_LESS 5.1.0)
|
||||
add_RunCMake_test(IncompatibleQt)
|
||||
endif()
|
||||
if (QT4_FOUND)
|
||||
set(ObsoleteQtMacros_ARGS -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE})
|
||||
add_RunCMake_test(ObsoleteQtMacros)
|
||||
endif()
|
||||
|
||||
if("${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio [^6]")
|
||||
add_RunCMake_test(include_external_msproject)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
0
|
|
@ -0,0 +1,5 @@
|
|||
CMake Warning at .*/Modules/Qt4Macros.cmake:[^ ]+ \(message\):
|
||||
The qt4_automoc macro is obsolete. Use the CMAKE_AUTOMOC feature instead.
|
||||
Call Stack \(most recent call first\):
|
||||
AutomocMacro-WARN.cmake:7 \(qt4_automoc\)
|
||||
CMakeLists.txt:3 \(include\)
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
find_package(Qt4 REQUIRED)
|
||||
|
||||
set(CMAKE_WARN_DEPRECATED 1)
|
||||
|
||||
add_library(foo SHARED empty.cpp)
|
||||
qt4_automoc(foo_moc_srcs empty.cpp)
|
|
@ -0,0 +1,3 @@
|
|||
cmake_minimum_required(VERSION 2.8.11)
|
||||
project(${RunCMake_TEST})
|
||||
include(${RunCMake_TEST}.cmake)
|
|
@ -0,0 +1,6 @@
|
|||
include(RunCMake)
|
||||
|
||||
set(RunCMake_TEST_OPTIONS -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE})
|
||||
|
||||
run_cmake(UseModulesMacro-WARN)
|
||||
run_cmake(AutomocMacro-WARN)
|
|
@ -0,0 +1 @@
|
|||
0
|
|
@ -0,0 +1,6 @@
|
|||
CMake Warning at .*/Modules/Qt4Macros.cmake:[^ ]+ \(message\):
|
||||
The qt4_use_modules function is obsolete. Use target_link_libraries with
|
||||
IMPORTED targets instead.
|
||||
Call Stack \(most recent call first\):
|
||||
UseModulesMacro-WARN.cmake:[^ ]+ \(qt4_use_modules\)
|
||||
CMakeLists.txt:3 \(include\)
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
find_package(Qt4 REQUIRED)
|
||||
|
||||
set(CMAKE_WARN_DEPRECATED 1)
|
||||
|
||||
add_library(foo SHARED empty.cpp)
|
||||
qt4_use_modules(foo LINK_PRIVATE Core)
|
|
@ -0,0 +1,7 @@
|
|||
#ifdef _WIN32
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
int empty(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue