Merge bitcoin/bitcoin#31360: depends: Avoid using helper variables in toolchain file
7343a1846cdepends: Avoid using helper variables in toolchain file (Hennadii Stepanov) Pull request description: Using helper variables has two issues: 1. They contaminate the global namespace of the main build script. 2. They can be used as `set(var)`, effectively [exposing](https://cmake.org/cmake/help/latest/command/set.html) a cache variable `var`, which makes the toolchain file susceptible to the build environment. The [`depends/Makefile`](https://github.com/bitcoin/bitcoin/blob/master/depends/Makefile) can generate values with "not-set" semantics as empty strings or strings containing only spaces. For example:https://github.com/bitcoin/bitcoin/blob/2638fdb4f934be96b7c798dbac38ea5ab8a6374a/depends/Makefile#L157 Therefore, [`MATCHES`](https://cmake.org/cmake/help/latest/command/if.html#matches) must be used rather than [`STREQUAL`](https://cmake.org/cmake/help/latest/command/if.html#strequal). ACKs for top commit: purpleKarrot: ACK7343a1846cTree-SHA512: f2235321ac13daee8e82fa1ae9d02b95097a696265ad3a31fbda9cbc3c387c1dc7d01951154f99828468e50b73ed2889a6fa2720007f519dd11fe25ee5303d23
This commit is contained in:
1 file changed
+8
-10
@@ -115,37 +115,35 @@ endif()
|
|||||||
|
|
||||||
|
|
||||||
# Set configuration options for the main build system.
|
# Set configuration options for the main build system.
|
||||||
set(qt_packages @qt_packages@)
|
# The depends/Makefile can generate values with "not-set"
|
||||||
if("${qt_packages}" STREQUAL "")
|
# semantics as empty strings or strings containing only spaces.
|
||||||
|
# Therefore, MATCHES must be used rather than STREQUAL.
|
||||||
|
if("@qt_packages@" MATCHES "^[ ]*$")
|
||||||
set(BUILD_GUI OFF CACHE BOOL "")
|
set(BUILD_GUI OFF CACHE BOOL "")
|
||||||
else()
|
else()
|
||||||
set(BUILD_GUI ON CACHE BOOL "")
|
set(BUILD_GUI ON CACHE BOOL "")
|
||||||
set(Qt6_ROOT "${CMAKE_CURRENT_LIST_DIR}" CACHE PATH "")
|
set(Qt6_ROOT "${CMAKE_CURRENT_LIST_DIR}" CACHE PATH "")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(qrencode_packages @qrencode_packages@)
|
if("@qrencode_packages@" MATCHES "^[ ]*$")
|
||||||
if("${qrencode_packages}" STREQUAL "")
|
|
||||||
set(WITH_QRENCODE OFF CACHE BOOL "")
|
set(WITH_QRENCODE OFF CACHE BOOL "")
|
||||||
else()
|
else()
|
||||||
set(WITH_QRENCODE ON CACHE BOOL "")
|
set(WITH_QRENCODE ON CACHE BOOL "")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(zmq_packages @zmq_packages@)
|
if("@zmq_packages@" MATCHES "^[ ]*$")
|
||||||
if("${zmq_packages}" STREQUAL "")
|
|
||||||
set(WITH_ZMQ OFF CACHE BOOL "")
|
set(WITH_ZMQ OFF CACHE BOOL "")
|
||||||
else()
|
else()
|
||||||
set(WITH_ZMQ ON CACHE BOOL "")
|
set(WITH_ZMQ ON CACHE BOOL "")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(wallet_packages @wallet_packages@)
|
if("@wallet_packages@" MATCHES "^[ ]*$")
|
||||||
if("${wallet_packages}" STREQUAL "")
|
|
||||||
set(ENABLE_WALLET OFF CACHE BOOL "")
|
set(ENABLE_WALLET OFF CACHE BOOL "")
|
||||||
else()
|
else()
|
||||||
set(ENABLE_WALLET ON CACHE BOOL "")
|
set(ENABLE_WALLET ON CACHE BOOL "")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(usdt_packages @usdt_packages@)
|
if("@usdt_packages@" MATCHES "^[ ]*$")
|
||||||
if("${usdt_packages}" STREQUAL "")
|
|
||||||
set(WITH_USDT OFF CACHE BOOL "")
|
set(WITH_USDT OFF CACHE BOOL "")
|
||||||
else()
|
else()
|
||||||
set(WITH_USDT ON CACHE BOOL "")
|
set(WITH_USDT ON CACHE BOOL "")
|
||||||
|
|||||||
Reference in new issue
Block a user