Skip to content

Commit

Permalink
CMake: Fix detection of the ltcg feature
Browse files Browse the repository at this point in the history
When checking the value of CMAKE_INTERPROCEDURAL_OPTIMIZATION_<CONFIG>,
then <CONFIG> must be the upper case configuration name.

Also, we must not unset __qt_ltcg_detected, because the feature
condition evaluation happens way after the feature definition, and
__qt_ltcg_detected was not available anymore there.

This commit amends 96bdcda.

Fixes: QTBUG-87874
Change-Id: I2b555bd1d7fbc8973e1d9493045c27d61b0d2c1b
Reviewed-by: Alexandru Croitor <[email protected]>
  • Loading branch information
jobor committed Nov 6, 2020
1 parent e31c6c7 commit e559da3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
5 changes: 3 additions & 2 deletions .prev_configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -621,18 +621,19 @@ if(CMAKE_INTERPROCEDURAL_OPTIMIZATION)
set(__qt_ltcg_detected TRUE)
else()
foreach(config ${CMAKE_BUILD_TYPE} ${CMAKE_CONFIGURATION_TYPES})
if(CMAKE_INTERPROCEDURAL_OPTIMIZATION_${config})
string(TOUPPER "${config}" __qt_uc_config)
if(CMAKE_INTERPROCEDURAL_OPTIMIZATION_${__qt_uc_config})
set(__qt_ltcg_detected TRUE)
break()
endif()
endforeach()
unset(__qt_uc_config)
endif()
qt_feature("ltcg"
LABEL "Using LTCG"
AUTODETECT ON
CONDITION __qt_ltcg_detected
)
unset(__qt_ltcg_detected)
qt_feature_config("ltcg" QMAKE_PRIVATE_CONFIG)
qt_feature("enable_gdb_index"
LABEL "Generating GDB index"
Expand Down
5 changes: 3 additions & 2 deletions configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -634,18 +634,19 @@ if(CMAKE_INTERPROCEDURAL_OPTIMIZATION)
set(__qt_ltcg_detected TRUE)
else()
foreach(config ${CMAKE_BUILD_TYPE} ${CMAKE_CONFIGURATION_TYPES})
if(CMAKE_INTERPROCEDURAL_OPTIMIZATION_${config})
string(TOUPPER "${config}" __qt_uc_config)
if(CMAKE_INTERPROCEDURAL_OPTIMIZATION_${__qt_uc_config})
set(__qt_ltcg_detected TRUE)
break()
endif()
endforeach()
unset(__qt_uc_config)
endif()
qt_feature("ltcg"
LABEL "Using LTCG"
AUTODETECT ON
CONDITION __qt_ltcg_detected
)
unset(__qt_ltcg_detected)
qt_feature_config("ltcg" QMAKE_PRIVATE_CONFIG)
qt_feature("enable_gdb_index"
LABEL "Generating GDB index"
Expand Down
7 changes: 4 additions & 3 deletions util/cmake/configurejson2cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -920,14 +920,15 @@ def get_feature_mapping():
set(__qt_ltcg_detected TRUE)
else()
foreach(config ${CMAKE_BUILD_TYPE} ${CMAKE_CONFIGURATION_TYPES})
if(CMAKE_INTERPROCEDURAL_OPTIMIZATION_${config})
string(TOUPPER "${config}" __qt_uc_config)
if(CMAKE_INTERPROCEDURAL_OPTIMIZATION_${__qt_uc_config})
set(__qt_ltcg_detected TRUE)
break()
endif()
endforeach()
unset(__qt_uc_config)
endif()""",
"condition": "__qt_ltcg_detected",
"cmakeEpilogue": "unset(__qt_ltcg_detected)"
"condition": "__qt_ltcg_detected"
},
"msvc_mp": None,
"simulator_and_device": {"condition": "UIKIT AND NOT QT_UIKIT_SDK"},
Expand Down

0 comments on commit e559da3

Please sign in to comment.