find_library(MYLIB_XCFRAMEWORK mylib NO_DEFAULT_PATH PATHS "${CMAKE_BINARY_DIR}/../create-xcframework-framework-build") get_filename_component(bin_parent "${CMAKE_BINARY_DIR}" PATH) set(expected_path "${bin_parent}/create-xcframework-framework-build/mylib.xcframework") if(NOT MYLIB_XCFRAMEWORK STREQUAL expected_path) message(FATAL_ERROR "Expected value of MYLIB_XCFRAMEWORK:\n ${expected_path}\nActual value:\n ${MYLIB_XCFRAMEWORK}") endif()