mirror of
https://github.com/reactos/CMake.git
synced 2024-11-28 22:10:32 +00:00
FindQt4: Add INTERFACE includes and defines to Qt4 targets
This commit is contained in:
parent
c2cde7f104
commit
c8ee07d0ad
@ -418,6 +418,15 @@ macro (_QT4_ADJUST_LIB_VARS _camelCaseBasename)
|
||||
set_property(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}" )
|
||||
endif()
|
||||
endif ()
|
||||
set_property(TARGET Qt4::${_camelCaseBasename} PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${QT_${basename}_INCLUDE_DIR}"
|
||||
)
|
||||
string(REGEX REPLACE "^QT" "" _stemname ${basename})
|
||||
set_property(TARGET Qt4::${_camelCaseBasename} PROPERTY
|
||||
INTERFACE_COMPILE_DEFINITIONS
|
||||
"QT_${_stemname}_LIB"
|
||||
)
|
||||
endif()
|
||||
|
||||
# If QT_USE_IMPORTED_TARGETS is enabled, the QT_QTFOO_LIBRARY variables are set to point at these
|
||||
@ -952,6 +961,14 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
|
||||
${_PROPERTY}
|
||||
"Qt4::Qt${_DEPEND}"
|
||||
)
|
||||
set_property(TARGET Qt4::${_QT_MODULE} APPEND PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
"$<TARGET_PROPERTY:Qt4::Qt${_DEPEND},INTERFACE_INCLUDE_DIRECTORIES>"
|
||||
)
|
||||
set_property(TARGET Qt4::${_QT_MODULE} APPEND PROPERTY
|
||||
INTERFACE_COMPILE_DEFINITIONS
|
||||
"$<TARGET_PROPERTY:Qt4::Qt${_DEPEND},INTERFACE_COMPILE_DEFINITIONS>"
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
endmacro()
|
||||
@ -968,6 +985,11 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
|
||||
# Set QT_xyz_LIBRARY variable and add
|
||||
# library include path to QT_INCLUDES
|
||||
_QT4_ADJUST_LIB_VARS(QtCore)
|
||||
set_property(TARGET Qt4::QtCore APPEND PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${QT_MKSPECS_DIR}/default"
|
||||
${QT_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
foreach(QT_MODULE ${QT_MODULES})
|
||||
_QT4_ADJUST_LIB_VARS(${QT_MODULE})
|
||||
@ -992,6 +1014,10 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
|
||||
# headers.
|
||||
# Everything depends on QtCore, but that is covered above already
|
||||
_qt4_add_target_depends(Qt3Support Sql Gui Network)
|
||||
if (TARGET Qt4::Qt3Support)
|
||||
# An additional define is required for QT3_SUPPORT
|
||||
set_property(TARGET Qt4::Qt3Support APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS QT3_SUPPORT)
|
||||
endif()
|
||||
_qt4_add_target_depends(QtDeclarative Script Gui)
|
||||
_qt4_add_target_depends(QtDesigner Gui)
|
||||
_qt4_add_target_depends(QtHelp Gui)
|
||||
|
@ -4,11 +4,18 @@ project(Qt4Targets)
|
||||
|
||||
find_package(Qt4 REQUIRED)
|
||||
|
||||
include_directories(${QT_INCLUDES})
|
||||
|
||||
add_executable(Qt4Targets WIN32 main.cpp)
|
||||
target_link_libraries(Qt4Targets Qt4::QtGui)
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(Qt4Targets Qt4::qtmain)
|
||||
endif()
|
||||
|
||||
set_property(TARGET Qt4Targets APPEND PROPERTY
|
||||
INCLUDE_DIRECTORIES
|
||||
$<TARGET_PROPERTY:Qt4::QtGui,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
set_property(TARGET Qt4Targets APPEND PROPERTY
|
||||
COMPILE_DEFINITIONS
|
||||
$<TARGET_PROPERTY:Qt4::QtGui,INTERFACE_COMPILE_DEFINITIONS>
|
||||
)
|
||||
|
@ -4,6 +4,14 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
#ifndef QT_CORE_LIB
|
||||
#error Expected QT_CORE_LIB
|
||||
#endif
|
||||
|
||||
#ifndef QT_GUI_LIB
|
||||
#error Expected QT_GUI_LIB
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
Loading…
Reference in New Issue
Block a user