Skip to content

Commit ec58dfe

Browse files
committed
Merge bitcoin/bitcoin#31010: cmake: Avoid hardcoding Qt's major version in Find module / variable names
deacf3c cmake: Avoid hardcoding Qt's major version in Find module (Hennadii Stepanov) Pull request description: This PR facilitates future migration to Qt 6 and is a prerequisite for bitcoin/bitcoin#30997. No behaviour change. ACKs for top commit: l0rinc: utACK deacf3c promag: Code review ACK deacf3c. maflcko: lgtm ACK deacf3c Tree-SHA512: 6991f30e9cf6a7103bfe91f8958246b17360210bf695ab620ca1c8b59565bf6192cc366036cf54f860ccc4d782b9c28899970978de79392c88a45ef149c06a79
2 parents 5fe6878 + deacf3c commit ec58dfe

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ if(BUILD_GUI)
177177
if(BUILD_GUI_TESTS)
178178
list(APPEND qt_components Test)
179179
endif()
180-
find_package(Qt5 5.11.3 MODULE REQUIRED
180+
find_package(Qt 5.11.3 MODULE REQUIRED
181181
COMPONENTS ${qt_components}
182182
)
183183
unset(qt_components)

cmake/module/FindQt5.cmake renamed to cmake/module/FindQt.cmake

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
# file COPYING or https://opensource.org/license/mit/.
44

55
#[=======================================================================[
6-
FindQt5
7-
-------
6+
FindQt
7+
------
88
9-
Finds the Qt 5 headers and libraries.
9+
Finds the Qt headers and libraries.
1010
1111
This is a wrapper around find_package() command that:
1212
- facilitates searching in various build environments
@@ -19,7 +19,7 @@ if(CMAKE_HOST_APPLE)
1919
find_program(HOMEBREW_EXECUTABLE brew)
2020
if(HOMEBREW_EXECUTABLE)
2121
execute_process(
22-
COMMAND ${HOMEBREW_EXECUTABLE} --prefix qt@5
22+
COMMAND ${HOMEBREW_EXECUTABLE} --prefix qt@${Qt_FIND_VERSION_MAJOR}
2323
OUTPUT_VARIABLE _qt_homebrew_prefix
2424
ERROR_QUIET
2525
OUTPUT_STRIP_TRAILING_WHITESPACE
@@ -40,10 +40,10 @@ endif()
4040
# /usr/x86_64-w64-mingw32/lib/libm.a or /usr/arm-linux-gnueabihf/lib/libm.a.
4141
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
4242

43-
find_package(Qt5 ${Qt5_FIND_VERSION}
44-
COMPONENTS ${Qt5_FIND_COMPONENTS}
43+
find_package(Qt${Qt_FIND_VERSION_MAJOR} ${Qt_FIND_VERSION}
44+
COMPONENTS ${Qt_FIND_COMPONENTS}
4545
HINTS ${_qt_homebrew_prefix}
46-
PATH_SUFFIXES Qt5 # Required on OpenBSD systems.
46+
PATH_SUFFIXES Qt${Qt_FIND_VERSION_MAJOR} # Required on OpenBSD systems.
4747
)
4848
unset(_qt_homebrew_prefix)
4949

@@ -56,11 +56,11 @@ else()
5656
endif()
5757

5858
include(FindPackageHandleStandardArgs)
59-
find_package_handle_standard_args(Qt5
60-
REQUIRED_VARS Qt5_DIR
61-
VERSION_VAR Qt5_VERSION
59+
find_package_handle_standard_args(Qt
60+
REQUIRED_VARS Qt${Qt_FIND_VERSION_MAJOR}_DIR
61+
VERSION_VAR Qt${Qt_FIND_VERSION_MAJOR}_VERSION
6262
)
6363

64-
foreach(component IN LISTS Qt5_FIND_COMPONENTS ITEMS "")
65-
mark_as_advanced(Qt5${component}_DIR)
64+
foreach(component IN LISTS Qt_FIND_COMPONENTS ITEMS "")
65+
mark_as_advanced(Qt${Qt_FIND_VERSION_MAJOR}${component}_DIR)
6666
endforeach()

0 commit comments

Comments
 (0)