2018-07-28 09:25:32 +03:00
|
|
|
macro(msvc_registry_search)
|
2021-04-24 17:12:40 -06:00
|
|
|
if(NOT DEFINED Qt5_DIR)
|
2023-04-21 00:52:32 -04:00
|
|
|
if (NOT EXISTS ${QT_ROOT})
|
|
|
|
# look for user-registry pointing to qtcreator
|
|
|
|
get_filename_component(QT_ROOT [HKEY_CURRENT_USER\\Software\\Classes\\Applications\\QtProject.QtCreator.pro\\shell\\Open\\Command] PATH)
|
2018-07-28 09:25:32 +03:00
|
|
|
|
2023-04-21 00:52:32 -04:00
|
|
|
# get root path
|
|
|
|
string(REPLACE "/Tools" ";" QT_ROOT "${QT_ROOT}")
|
|
|
|
list(GET QT_ROOT 0 QT_ROOT)
|
|
|
|
endif()
|
2018-07-28 09:25:32 +03:00
|
|
|
|
2024-12-17 10:34:13 -08:00
|
|
|
set(QT_VERSION 5.13.2)
|
|
|
|
set(QT_MSVC 2019)
|
2018-07-28 09:25:32 +03:00
|
|
|
|
2021-01-15 10:16:08 -07:00
|
|
|
if(QT_MSVC)
|
|
|
|
if(CMAKE_CL_64)
|
|
|
|
SET(QT_SUFFIX "_64")
|
|
|
|
else()
|
|
|
|
set(QT_SUFFIX "")
|
|
|
|
endif()
|
2024-12-17 10:34:13 -08:00
|
|
|
set(Qt5_DIR "${QT_VERSION}/msvc2017${QT_SUFFIX}/lib/cmake/Qt5")
|
2021-01-15 10:16:08 -07:00
|
|
|
endif()
|
|
|
|
endif()
|
2018-07-28 09:25:32 +03:00
|
|
|
endmacro()
|
|
|
|
|
|
|
|
macro(find_qt5)
|
2021-01-15 10:16:08 -07:00
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
#set(CMAKE_AUTOMOC ON)
|
|
|
|
set(CMAKE_AUTOUIC ON)
|
2021-03-22 01:18:56 -06:00
|
|
|
#add_definitions(-DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x060000)
|
2024-12-17 10:34:13 -08:00
|
|
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
|
|
set(Qt5_DIR "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/lib/cmake/Qt5")
|
|
|
|
else()
|
|
|
|
set(Qt5_DIR "C:/Qt/Qt5.13.2/5.13.2/msvc2017/lib/cmake/Qt5")
|
|
|
|
endif()
|
2021-01-15 10:16:08 -07:00
|
|
|
find_package(Qt5 COMPONENTS ${ARGN})
|
2018-07-28 09:25:32 +03:00
|
|
|
|
2021-01-15 10:16:08 -07:00
|
|
|
if(Qt5_FOUND)
|
|
|
|
if(WIN32 AND TARGET Qt5::qmake AND NOT TARGET Qt5::windeployqt)
|
|
|
|
get_target_property(_qt5_qmake_location Qt5::qmake IMPORTED_LOCATION)
|
2018-07-28 09:25:32 +03:00
|
|
|
|
2021-01-15 10:16:08 -07:00
|
|
|
execute_process(
|
|
|
|
COMMAND "${_qt5_qmake_location}" -query QT_INSTALL_PREFIX
|
|
|
|
RESULT_VARIABLE return_code
|
|
|
|
OUTPUT_VARIABLE qt5_install_prefix
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
2018-07-28 09:25:32 +03:00
|
|
|
|
2021-01-15 10:16:08 -07:00
|
|
|
set(imported_location "${qt5_install_prefix}/bin/windeployqt.exe")
|
2018-07-28 09:25:32 +03:00
|
|
|
|
2021-01-15 10:16:08 -07:00
|
|
|
if(EXISTS ${imported_location})
|
|
|
|
add_executable(Qt5::windeployqt IMPORTED)
|
2018-07-28 09:25:32 +03:00
|
|
|
|
2021-01-15 10:16:08 -07:00
|
|
|
set_target_properties(Qt5::windeployqt PROPERTIES
|
|
|
|
IMPORTED_LOCATION ${imported_location}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Cannot find QT5!")
|
|
|
|
endif()
|
2018-07-28 09:25:32 +03:00
|
|
|
endmacro(find_qt5)
|