1
|
|
2
|
if (NOT TARGET Qt5::qmake)
|
3
|
add_executable(Qt5::qmake IMPORTED)
|
4
|
|
5
|
set(imported_location "${_qt5Core_install_prefix}/bin/qmake.exe")
|
6
|
_qt5_Core_check_file_exists(${imported_location})
|
7
|
|
8
|
set_target_properties(Qt5::qmake PROPERTIES
|
9
|
IMPORTED_LOCATION ${imported_location}
|
10
|
)
|
11
|
endif()
|
12
|
|
13
|
if (NOT TARGET Qt5::moc)
|
14
|
add_executable(Qt5::moc IMPORTED)
|
15
|
|
16
|
set(imported_location "${_qt5Core_install_prefix}/bin/moc.exe")
|
17
|
_qt5_Core_check_file_exists(${imported_location})
|
18
|
|
19
|
set_target_properties(Qt5::moc PROPERTIES
|
20
|
IMPORTED_LOCATION ${imported_location}
|
21
|
)
|
22
|
# For CMake automoc feature
|
23
|
get_target_property(QT_MOC_EXECUTABLE Qt5::moc LOCATION)
|
24
|
endif()
|
25
|
|
26
|
if (NOT TARGET Qt5::rcc)
|
27
|
add_executable(Qt5::rcc IMPORTED)
|
28
|
|
29
|
set(imported_location "${_qt5Core_install_prefix}/bin/rcc.exe")
|
30
|
_qt5_Core_check_file_exists(${imported_location})
|
31
|
|
32
|
set_target_properties(Qt5::rcc PROPERTIES
|
33
|
IMPORTED_LOCATION ${imported_location}
|
34
|
)
|
35
|
endif()
|
36
|
|
37
|
set(Qt5Core_QMAKE_EXECUTABLE Qt5::qmake)
|
38
|
set(Qt5Core_MOC_EXECUTABLE Qt5::moc)
|
39
|
set(Qt5Core_RCC_EXECUTABLE Qt5::rcc)
|
40
|
|
41
|
set_property(TARGET Qt5::Core PROPERTY INTERFACE_QT_MAJOR_VERSION 5)
|
42
|
set_property(TARGET Qt5::Core PROPERTY INTERFACE_QT_COORD_TYPE double)
|
43
|
set_property(TARGET Qt5::Core APPEND PROPERTY
|
44
|
COMPATIBLE_INTERFACE_STRING QT_MAJOR_VERSION QT_COORD_TYPE
|
45
|
)
|
46
|
|
47
|
include("${CMAKE_CURRENT_LIST_DIR}/Qt5CoreConfigExtrasMkspecDir.cmake")
|
48
|
|
49
|
foreach(_dir ${_qt5_corelib_extra_includes})
|
50
|
_qt5_Core_check_file_exists(${_dir})
|
51
|
endforeach()
|
52
|
|
53
|
list(APPEND Qt5Core_INCLUDE_DIRS ${_qt5_corelib_extra_includes})
|
54
|
set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_qt5_corelib_extra_includes})
|
55
|
set(_qt5_corelib_extra_includes)
|
56
|
|
57
|
# Targets using Qt need to use the POSITION_INDEPENDENT_CODE property. The
|
58
|
# Qt5_POSITION_INDEPENDENT_CODE variable is used in the # qt5_use_module
|
59
|
# macro to add it.
|
60
|
set(Qt5_POSITION_INDEPENDENT_CODE True)
|
61
|
|
62
|
# On x86 and x86-64 systems with ELF binaries (especially Linux), due to
|
63
|
# a new optimization in GCC 5.x in combination with a recent version of
|
64
|
# GNU binutils, compiling Qt applications with -fPIE is no longer
|
65
|
# enough.
|
66
|
# Applications now need to be compiled with the -fPIC option if the Qt option
|
67
|
# "reduce relocations" is active. For backward compatibility only, Qt accepts
|
68
|
# the use of -fPIE for GCC 4.x versions.
|
69
|
if (CMAKE_VERSION VERSION_LESS 2.8.12
|
70
|
AND (NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
|
71
|
OR CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0))
|
72
|
set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE "ON")
|
73
|
else()
|
74
|
set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_COMPILE_OPTIONS )
|
75
|
endif()
|
76
|
|
77
|
# Applications using qmake or cmake >= 2.8.12 as their build system will
|
78
|
# adapt automatically. Applications using an older release of cmake in
|
79
|
# combination with GCC 5.x need to change their CMakeLists.txt to add
|
80
|
# Qt5Core_EXECUTABLE_COMPILE_FLAGS to CMAKE_CXX_FLAGS. In particular,
|
81
|
# applications using cmake >= 2.8.9 and < 2.8.11 will continue to build
|
82
|
# with the -fPIE option and invoke the special compatibility mode if using
|
83
|
# GCC 4.x.
|
84
|
set(Qt5Core_EXECUTABLE_COMPILE_FLAGS "")
|
85
|
if (CMAKE_VERSION VERSION_LESS 2.8.12
|
86
|
AND (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
|
87
|
AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0))
|
88
|
set(Qt5Core_EXECUTABLE_COMPILE_FLAGS "-fPIC")
|
89
|
endif()
|
90
|
|
91
|
|
92
|
|
93
|
set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS $<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>)
|
94
|
|
95
|
set_property(TARGET Qt5::Core PROPERTY INTERFACE_COMPILE_FEATURES cxx_decltype)
|
96
|
|
97
|
|
98
|
|
99
|
set(Qt5Core_QTMAIN_LIBRARIES Qt5::WinMain)
|
100
|
|
101
|
if (NOT TARGET Qt5::WinMain)
|
102
|
add_library(Qt5::WinMain STATIC IMPORTED)
|
103
|
|
104
|
set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
105
|
set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELWITHDEBINFO)
|
106
|
set(imported_location "${_qt5Core_install_prefix}/lib/qtmain.lib")
|
107
|
|
108
|
set_target_properties(Qt5::WinMain PROPERTIES
|
109
|
IMPORTED_LOCATION_RELEASE ${imported_location}
|
110
|
)
|
111
|
set_target_properties(Qt5::WinMain PROPERTIES
|
112
|
IMPORTED_LOCATION_RELWITHDEBINFO ${imported_location}
|
113
|
)
|
114
|
|
115
|
set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
|
116
|
|
117
|
set(imported_location "${_qt5Core_install_prefix}/lib/qtmaind.lib")
|
118
|
|
119
|
set_target_properties(Qt5::WinMain PROPERTIES
|
120
|
IMPORTED_LOCATION_DEBUG ${imported_location}
|
121
|
)
|
122
|
|
123
|
if (NOT CMAKE_VERSION VERSION_LESS 2.8.11 AND NOT Qt5_NO_LINK_QTMAIN)
|
124
|
set(_isExe $<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>)
|
125
|
set(_isWin32 $<BOOL:$<TARGET_PROPERTY:WIN32_EXECUTABLE>>)
|
126
|
set(_isNotExcluded $<NOT:$<BOOL:$<TARGET_PROPERTY:Qt5_NO_LINK_QTMAIN>>>)
|
127
|
set(_isPolicyNEW $<TARGET_POLICY:CMP0020>)
|
128
|
get_target_property(_configs Qt5::Core IMPORTED_CONFIGURATIONS)
|
129
|
set_property(TARGET Qt5::Core APPEND PROPERTY
|
130
|
INTERFACE_LINK_LIBRARIES
|
131
|
$<$<AND:${_isExe},${_isWin32},${_isNotExcluded},${_isPolicyNEW}>:Qt5::WinMain>
|
132
|
)
|
133
|
# For backward compatibility with CMake < 2.8.12
|
134
|
foreach(_config ${_configs})
|
135
|
set_property(TARGET Qt5::Core APPEND PROPERTY
|
136
|
IMPORTED_LINK_INTERFACE_LIBRARIES_${_config}
|
137
|
$<$<AND:${_isExe},${_isWin32},${_isNotExcluded},${_isPolicyNEW}>:Qt5::WinMain>
|
138
|
)
|
139
|
endforeach()
|
140
|
unset(_configs)
|
141
|
unset(_isExe)
|
142
|
unset(_isWin32)
|
143
|
unset(_isNotExcluded)
|
144
|
unset(_isPolicyNEW)
|
145
|
endif()
|
146
|
endif()
|
147
|
|
148
|
get_filename_component(_Qt5CoreConfigDir ${CMAKE_CURRENT_LIST_FILE} PATH)
|
149
|
|
150
|
set(_Qt5CTestMacros "${_Qt5CoreConfigDir}/Qt5CTestMacros.cmake")
|
151
|
|
152
|
_qt5_Core_check_file_exists(${_Qt5CTestMacros})
|