Skip to content

Commit 5265f74

Browse files
committed
build: allow pattern matching for BITCOINKERNEL_LIB
This simplifies ci/build system setup by not having to specify the exact filename, which can vary across platforms.
1 parent 14571c5 commit 5265f74

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ set(BITCOIN_TARGET "" CACHE STRING "Host triple for cross compilation, enables d
1212

1313
add_library(bitcoinkernel SHARED IMPORTED)
1414
if(DEFINED ENV{BITCOINKERNEL_LIB})
15-
message(STATUS "Using bitcoinkernel library from BITCOINKERNEL_LIB: $ENV{BITCOINKERNEL_LIB}")
16-
set(BITCOINKERNEL_PATH "$ENV{BITCOINKERNEL_LIB}")
15+
file(GLOB BITCOINKERNEL_MATCHES "$ENV{BITCOINKERNEL_LIB}")
16+
list(LENGTH BITCOINKERNEL_MATCHES MATCH_COUNT)
17+
if(NOT MATCH_COUNT EQUAL 1)
18+
message(FATAL_ERROR "Expected exactly one match for $ENV{BITCOINKERNEL_LIB}, found ${MATCH_COUNT}")
19+
endif()
20+
list(GET BITCOINKERNEL_MATCHES 0 BITCOINKERNEL_PATH)
1721
else()
1822
set(BITCOIN_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/depend/bitcoin")
1923
message(STATUS "Building bitcoinkernel from source in ${BITCOIN_SOURCE_DIR}")

0 commit comments

Comments
 (0)