mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-26 08:08:24 -05:00
f61768107e
This implements a limited exception mechanism for find_package() via the UNWIND_INCLUDE keyword. When package discovery via find_package(UNWIND_INCLUDE) fails the StateSnapshot is updated to an UNWINDING state. In this state further calls to find_package() and include() are forbidden. While in the UNWINDING state, the include() command immediately calls SetReturnInvoked() whenever it is reached. The UNWINDING state is reset when a parent call to find_package() is reached. Fixes: #26897
15 lines
311 B
CMake
15 lines
311 B
CMake
set(RunCMake_TEST_FAILED "Failed to observe side effects of block() scopes during unwind")
|
|
|
|
block()
|
|
find_package(foo UNWIND_INCLUDE)
|
|
endblock()
|
|
|
|
block(PROPAGATE BLOCK_RUN PrimaryUnwind_FOUND)
|
|
set(BLOCK_RUN true)
|
|
set(PrimaryUnwind_FOUND false)
|
|
endblock()
|
|
|
|
if(BLOCK_RUN)
|
|
set(RunCMake_TEST_FAILED)
|
|
endif()
|