Revert "CMakePM: Fix compile for gcc 7"

This reverts commit ca04d9afcd.

GCC 9 or later is the minimum required version nowadays, so this piece
of code can be more readable.

Change-Id: I939ee6cd62572d23d5b1de8d113472136752a590
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Cristian Adam
2023-05-02 15:38:45 +02:00
parent a548587a0b
commit e2f83c74f4

View File

@@ -284,36 +284,35 @@ static FilePath qmakeFromCMakeCache(const CMakeConfig &config)
if (!cmakeListTxt.open(QIODevice::WriteOnly)) { if (!cmakeListTxt.open(QIODevice::WriteOnly)) {
return FilePath(); return FilePath();
} }
// FIXME replace by raw string when gcc 8+ is minimum cmakeListTxt.write(QByteArray(R"(
cmakeListTxt.write(QByteArray( cmake_minimum_required(VERSION 3.15)
"cmake_minimum_required(VERSION 3.15)\n"
"\n" project(qmake-probe LANGUAGES NONE)
"project(qmake-probe LANGUAGES NONE)\n"
"\n" # Bypass Qt6's usage of find_dependency, which would require compiler
"# Bypass Qt6's usage of find_dependency, which would require compiler\n" # and source code probing, which slows things unnecessarily
"# and source code probing, which slows things unnecessarily\n" file(WRITE "${CMAKE_SOURCE_DIR}/CMakeFindDependencyMacro.cmake"
"file(WRITE \"${CMAKE_SOURCE_DIR}/CMakeFindDependencyMacro.cmake\"\n" [=[
"[=[" macro(find_dependency dep)
" macro(find_dependency dep)\n" endmacro()
" endmacro()\n" ]=])
"]=])\n" set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
"set(CMAKE_MODULE_PATH \"${CMAKE_SOURCE_DIR}\")\n"
"\n" find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
"find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)\n" find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
"find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)\n"
"\n" if (CMAKE_CROSSCOMPILING)
"if (CMAKE_CROSSCOMPILING)\n" find_program(qmake_binary
" find_program(qmake_binary\n" NAMES qmake qmake.bat
" NAMES qmake qmake.bat\n" PATHS "${Qt${QT_VERSION_MAJOR}_DIR}/../../../bin"
" PATHS \"${Qt${QT_VERSION_MAJOR}_DIR}/../../../bin\"\n" NO_DEFAULT_PATH)
" NO_DEFAULT_PATH)\n" file(WRITE "${CMAKE_SOURCE_DIR}/qmake-location.txt" "${qmake_binary}")
" file(WRITE \"${CMAKE_SOURCE_DIR}/qmake-location.txt\" \"${qmake_binary}\")\n" else()
"else()\n" file(GENERATE
" file(GENERATE\n" OUTPUT "${CMAKE_SOURCE_DIR}/qmake-location.txt"
" OUTPUT \"${CMAKE_SOURCE_DIR}/qmake-location.txt\"\n" CONTENT "$<TARGET_PROPERTY:Qt${QT_VERSION_MAJOR}::qmake,IMPORTED_LOCATION>")
" CONTENT \"$<TARGET_PROPERTY:Qt${QT_VERSION_MAJOR}::qmake,IMPORTED_LOCATION>\")\n" endif()
"endif()\n" )"));
));
cmakeListTxt.close(); cmakeListTxt.close();
QtcProcess cmake; QtcProcess cmake;