[Lldb-commits] [lldb] c51ad1f - [lldb/CMake] Don't use return() from macro()
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Fri Dec 20 20:54:26 PST 2019
Author: Jonas Devlieghere
Date: 2019-12-20T20:53:33-08:00
New Revision: c51ad1f836bffb4e431eb9f948ee3a32902ba6d2
URL: https://github.com/llvm/llvm-project/commit/c51ad1f836bffb4e431eb9f948ee3a32902ba6d2
DIFF: https://github.com/llvm/llvm-project/commit/c51ad1f836bffb4e431eb9f948ee3a32902ba6d2.diff
LOG: [lldb/CMake] Don't use return() from macro()
> A macro is executed as if the macro body were pasted in place of the
> calling statement. This has the consequence that a return() in a macro
> body does not just terminate execution of the macro
After converting from a function() to a macro(), the return() became
invalid. This modifies the control flow to elude the return.
Added:
Modified:
lldb/cmake/modules/LLDBConfig.cmake
Removed:
################################################################################
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index 3fc466b8f35c..c34ef76cb652 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -29,16 +29,19 @@ macro(add_optional_dependency variable description package found)
string(TOUPPER "${${variable}}" ${variable})
if("${${variable}}" STREQUAL "AUTO")
+ set(find_package TRUE)
set(maybe_required)
elseif(${${variable}})
+ set(find_package TRUE)
set(maybe_required REQUIRED)
else()
- set(${variable} OFF PARENT_SCOPE)
- return()
+ set(${variable} FALSE PARENT_SCOPE)
endif()
- find_package(${package} ${maybe_required})
- set(${variable} "${${found}}")
+ if(${find_package})
+ find_package(${package} ${maybe_required})
+ set(${variable} "${${found}}")
+ endif()
endmacro()
add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support." LibEdit libedit_FOUND)
More information about the lldb-commits
mailing list