more reliable qt5 location

This commit is contained in:
Akash Mozumdar 2020-01-26 16:53:09 -07:00
parent 0f7a648403
commit b1769b7cd1

View File

@ -1,7 +1,7 @@
macro(msvc_registry_search) macro(msvc_registry_search)
IF(MSVC) IF(MSVC)
# look for user-registry pointing to qtcreator # look for user-registry pointing to qtcreator
get_filename_component(QT_BIN [HKEY_CURRENT_USER\\Software\\Classes\\Applications\\QtProject.QtCreator.cpp\\shell\\Open\\Command] PATH) get_filename_component(QT_BIN [HKEY_CURRENT_USER\\Software\\Classes\\Applications\\QtProject.QtCreator.pro\\shell\\Open\\Command] PATH)
# get root path so we can search for 5.3, 5.4, 5.5, etc # get root path so we can search for 5.3, 5.4, 5.5, etc
string(REPLACE "/Tools" ";" QT_BIN "${QT_BIN}") string(REPLACE "/Tools" ";" QT_BIN "${QT_BIN}")
@ -32,19 +32,19 @@ macro(msvc_registry_search)
SET(QT_MSVC "${QT_MSVC}_64") SET(QT_MSVC "${QT_MSVC}_64")
endif() endif()
set(QT_TOLLCHAIN "${QT_VERSION}/msvc${QT_MSVC}") set(QT_TOOLCHAIN "${QT_VERSION}/msvc${QT_MSVC}")
if(EXISTS ${QT_TOLLCHAIN}) if(EXISTS ${QT_TOOLCHAIN})
set(Qt5_DIR "${QT_TOLLCHAIN}/lib/cmake/Qt5") set(Qt5_DIR "${QT_TOOLCHAIN}/lib/cmake/Qt5")
elseif(QT_MSVC EQUAL "2017") elseif(QT_MSVC EQUAL "2017")
#2017 is ABI compatible with 2015 #2017 is ABI compatible with 2015
if(CMAKE_CL_64) if(CMAKE_CL_64)
set(QT_TOLLCHAIN "${QT_VERSION}/msvc2015_64") set(QT_TOOLCHAIN "${QT_VERSION}/msvc2015_64")
else() else()
set(QT_TOLLCHAIN "${QT_VERSION}/msvc2015") set(QT_TOOLCHAIN "${QT_VERSION}/msvc2015")
endif() endif()
if(EXISTS ${QT_TOLLCHAIN}) if(EXISTS ${QT_TOOLCHAIN})
set(Qt5_DIR "${QT_TOLLCHAIN}/lib/cmake/Qt5") set(Qt5_DIR "${QT_TOOLCHAIN}/lib/cmake/Qt5")
else() else()
message(WARNING "Required QT5 toolchain is not installed") message(WARNING "Required QT5 toolchain is not installed")
endif() endif()