Files
CMake/Tests/RunCMake/include/ParentVariableScript.cmake
Benjamin Buch a9ea55f0d7 Fix CMAKE_PARENT_LIST_FILE after return from include() or find_package()
Fix the implementation, clarify the documentation, and add tests.

Fixes: #25026
Co-authored-by: Brad King <brad.king@kitware.com>
2025-04-12 09:40:37 -04:00

10 lines
467 B
CMake

if(DEFINED CMAKE_PARENT_LIST_FILE)
message(SEND_ERROR "`CMAKE_PARENT_LIST_FILE` is not expected to be set here")
endif()
message(STATUS "ParentVariableScript.cmake: '${CMAKE_PARENT_LIST_FILE}'")
include("${CMAKE_CURRENT_LIST_DIR}/ParentVariableScript/include1.cmake")
if(DEFINED CMAKE_PARENT_LIST_FILE)
message(SEND_ERROR "`CMAKE_PARENT_LIST_FILE` is not expected to be set here")
endif()
message(STATUS "ParentVariableScript.cmake: '${CMAKE_PARENT_LIST_FILE}'")