Skip to content

Commit

Permalink
CMake: Simplify feature calculation
Browse files Browse the repository at this point in the history
Since configure doesn't translate -feature-foo to INPUT_foo=ON anymore,
we can remove the code that tries to calculate the feature value from
INPUT_foo.

Task-number: QTBUG-120529
Change-Id: I4829bb634ca8c3f08b489469532b65541d76fa70
Reviewed-by: Alexandru Croitor <[email protected]>
  • Loading branch information
jobor committed Feb 13, 2024
1 parent 55d81b3 commit 53eb8dd
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions cmake/QtFeature.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ endmacro()
#
#
# `FEATURE_foo` stores the user provided feature value for the current configuration run.
# It can be set directly by the user, or derived from INPUT_foo (also set by the user).
# It can be set directly by the user.
#
# If a value is not provided on initial configuration, the value will be auto-computed based on the
# various conditions of the feature.
Expand Down Expand Up @@ -883,18 +883,6 @@ function(qt_internal_detect_dirty_features)
"to ${FEATURE_${feature}}")
set(dirty_build TRUE)
set_property(GLOBAL APPEND PROPERTY _qt_dirty_features "${feature}")

# If the user changed the value of the feature directly (e.g by editing
# CMakeCache.txt), and not via its associated INPUT variable, unset the INPUT cache
# variable before it is used in feature evaluation, to ensure a stale value doesn't
# influence other feature values, especially when QT_INTERNAL_CALLED_FROM_CONFIGURE
# is TRUE and the INPUT_foo variable is not passed.
# e.g. first configure -no-gui, then manually toggle FEATURE_gui to ON in
# CMakeCache.txt, then reconfigure (with the configure script) without -no-gui.
# Without this unset(), we'd have switched FEATURE_gui to OFF again.
if(NOT FEATURE_${feature}_computed_from_input)
unset("INPUT_${feature}" CACHE)
endif()
endif()
unset("QT_FEATURE_${feature}" CACHE)
endforeach()
Expand Down Expand Up @@ -1079,7 +1067,7 @@ function(qt_config_compile_test name)
set(CMAKE_REQUIRED_FLAGS ${arg_COMPILE_OPTIONS})

# Pass -stdlib=libc++ on if necessary
if (INPUT_stdlib_libcpp OR QT_FEATURE_stdlib_libcpp)
if (QT_FEATURE_stdlib_libcpp)
list(APPEND CMAKE_REQUIRED_FLAGS "-stdlib=libc++")
endif()

Expand Down Expand Up @@ -1149,7 +1137,7 @@ function(qt_get_platform_try_compile_vars out_var)
list(APPEND flags "CMAKE_CXX_STANDARD_REQUIRED")

# Pass -stdlib=libc++ on if necessary
if (INPUT_stdlib_libcpp OR QT_FEATURE_stdlib_libcpp)
if (QT_FEATURE_stdlib_libcpp)
if(CMAKE_CXX_FLAGS)
string(APPEND CMAKE_CXX_FLAGS " -stdlib=libc++")
else()
Expand Down

0 comments on commit 53eb8dd

Please sign in to comment.