File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,22 @@ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
92
92
set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY )
93
93
set (QT_TRANSLATIONS_DIR "${CMAKE_CURRENT_LIST_DIR} /translations" )
94
94
95
+ # The following is only necessary when using cmake from Nix or NixOS, because
96
+ # Nix patches cmake to remove the root directory `/` from
97
+ # CMAKE_SYSTEM_PREFIX_PATH. Adding it back is harmless on other platforms and
98
+ # necessary on Nix because without it cmake find_path, find_package, etc
99
+ # functions do not know where to look in CMAKE_FIND_ROOT_PATH for dependencies
100
+ # (https://github.com/bitcoin/bitcoin/issues/32428).
101
+ #
102
+ # TODO: longer term, it may be possible to use a dependency provider, which
103
+ # would bring the find_package calls completely under our control, making this
104
+ # patch unnecessary.
105
+ #
106
+ # Make sure we only append once, as this file may be called repeatedly.
107
+ if (NOT "/" IN_LIST CMAKE_PREFIX_PATH )
108
+ list (APPEND CMAKE_PREFIX_PATH "/" )
109
+ endif ()
110
+
95
111
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT CMAKE_HOST_APPLE )
96
112
# The find_package(Qt ...) function internally uses find_library()
97
113
# calls for all dependencies to ensure their availability.
You can’t perform that action at this time.
0 commit comments