Files
CMake/Tests/RunCMake/FileAPI/InterfaceIncludesNoLanguages-check.cmake

25 lines
1.0 KiB
CMake

file(GLOB replies "${RunCMake_TEST_BINARY_DIR}/.cmake/api/v1/reply/target-headers-*.json")
if(NOT replies)
set(RunCMake_TEST_FAILED "No File API reply for headers")
return()
endif()
validate_json_schema("${RunCMake_SOURCE_DIR}/../../../Help/manual/file_api/schema_target.json" "${replies}")
foreach(reply IN LISTS replies)
file(READ "${reply}" contents)
string(JSON count ERROR_VARIABLE error LENGTH "${contents}" interfaceIncludes)
if(error OR NOT count EQUAL 1)
set(RunCMake_TEST_FAILED "Expected one language-independent interface include in ${reply}")
return()
endif()
string(JSON path GET "${contents}" interfaceIncludes 0 path)
string(JSON languages ERROR_VARIABLE error GET "${contents}" interfaceIncludes 0 languages)
if(NOT error)
set(RunCMake_TEST_FAILED "Unexpected languages for a project with no enabled languages: ${languages}")
return()
endif()
if(NOT path STREQUAL RunCMake_SOURCE_DIR)
set(RunCMake_TEST_FAILED "Unexpected language-independent interface include: ${path}")
return()
endif()
endforeach()