CMake: Allow to pass a custom target mkspec name

It's now possible to pass -DQT_QMAKE_TARGET_MKSPEC=foo to cmake. If the
value is not passed, then we will guess the mkspec like we did before.

Change-Id: If6e8324654cb8bd83d3cba9eb6ee1e4ad2692a2c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Joerg Bornemann 2020-06-26 16:33:26 +02:00
parent 5ccecd3a89
commit 8df4caf554

View File

@ -253,18 +253,17 @@ endfunction()
qt_setup_tool_path_command()
# Platform define path, etc.
set(QT_QMAKE_TARGET_MKSPEC "")
if(WIN32)
set(QT_DEFAULT_PLATFORM_DEFINITIONS UNICODE _UNICODE WIN32 _ENABLE_EXTENDED_ALIGNED_STORAGE)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
list(APPEND QT_DEFAULT_PLATFORM_DEFINITIONS WIN64 _WIN64)
endif()
if(MSVC)
set(QT_QMAKE_TARGET_MKSPEC win32-msvc)
set(QT_DEFAULT_MKSPEC win32-msvc)
elseif(CLANG AND MINGW)
set(QT_QMAKE_TARGET_MKSPEC win32-clang-g++)
set(QT_DEFAULT_MKSPEC win32-clang-g++)
elseif(MINGW)
set(QT_QMAKE_TARGET_MKSPEC win32-g++)
set(QT_DEFAULT_MKSPEC win32-g++)
endif()
if (MINGW)
@ -272,27 +271,31 @@ if(WIN32)
endif()
elseif(LINUX)
if(GCC)
set(QT_QMAKE_TARGET_MKSPEC linux-g++)
set(QT_DEFAULT_MKSPEC linux-g++)
elseif(CLANG)
set(QT_QMAKE_TARGET_MKSPEC linux-clang)
set(QT_DEFAULT_MKSPEC linux-clang)
elseif(ICC)
set(QT_QMAKE_TARGET_MKSPEC linux-icc-64)
set(QT_DEFAULT_MKSPEC linux-icc-64)
endif()
elseif(ANDROID)
if(GCC)
set(QT_QMAKE_TARGET_MKSPEC android-g++)
set(QT_DEFAULT_MKSPEC android-g++)
elseif(CLANG)
set(QT_QMAKE_TARGET_MKSPEC android-clang)
set(QT_DEFAULT_MKSPEC android-clang)
endif()
elseif(APPLE)
set(QT_QMAKE_TARGET_MKSPEC macx-clang)
set(QT_DEFAULT_MKSPEC macx-clang)
if(MACOS)
list(APPEND QT_DEFAULT_PLATFORM_DEFINITIONS GL_SILENCE_DEPRECATION)
elseif(UIKIT)
list(APPEND QT_DEFAULT_PLATFORM_DEFINITIONS GLES_SILENCE_DEPRECATION)
endif()
elseif(EMSCRIPTEN)
set(QT_QMAKE_TARGET_MKSPEC wasm-emscripten)
set(QT_DEFAULT_MKSPEC wasm-emscripten)
endif()
if(NOT QT_QMAKE_TARGET_MKSPEC)
set(QT_QMAKE_TARGET_MKSPEC "${QT_DEFAULT_MKSPEC}" CACHE STRING "QMake target mkspec")
endif()
if(CMAKE_CROSSCOMPILING)