Skip to content

Commit

Permalink
Fix FindRust setting Rust_Found=false in wrong scope
Browse files Browse the repository at this point in the history
The macro _find_rust_failed is not called from inside any functions in
FindRust. Find modules are `include`d, so variables need to be set
in local scope (which was already done in the successfull case).

Fixes #527
  • Loading branch information
jschwe committed Jun 1, 2024
1 parent 062e03c commit 58d83f0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cmake/FindRust.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@ include(FindPackageHandleStandardArgs)

list(APPEND CMAKE_MESSAGE_CONTEXT "FindRust")

# Print error message and return.
# Print error message and return. Should not be used from inside functions
macro(_findrust_failed)
if("${Rust_FIND_REQUIRED}")
message(FATAL_ERROR ${ARGN})
elseif(NOT "${Rust_FIND_QUIETLY}")
message(WARNING ${ARGN})
endif()
# Note: PARENT_SCOPE is the scope of the caller of the caller of this macro.
set(Rust_FOUND "" PARENT_SCOPE)
set(Rust_FOUND "")
return()
endmacro()

Expand Down

0 comments on commit 58d83f0

Please sign in to comment.