Files
swift-mirror/cmake/modules/SwiftImplicitImport.cmake
Eric Miotto 5aaaae5177 [CMake] Ensure module tracing is off during configuration
Such module usages are not relevant for the final build, they are used
only to detect the capabilities of the compiler.

This generalizes #68453, and would be needed for Apple internal
configurations that set `SWIFT_LOADED_MODULE_TRACE_FILE` when building
the compiler.

Addresses rdar://124954349
2024-03-18 14:56:20 -07:00

22 lines
670 B
CMake

# Test if the Swift compiler supports -disable-implicit-<module>-module-import
function(swift_supports_implicit_module module_name out_var)
file(WRITE "${CMAKE_BINARY_DIR}/tmp/empty-check-${module_name}.swift" "")
execute_process(
COMMAND
"${CMAKE_Swift_COMPILER}"
-Xfrontend -disable-implicit-${module_name}-module-import
-Xfrontend -parse-stdlib
-parse -
INPUT_FILE
"${CMAKE_BINARY_DIR}/tmp/empty-check-${module_name}.swift"
OUTPUT_QUIET ERROR_QUIET
RESULT_VARIABLE
result
)
if(NOT result)
set("${out_var}" "TRUE" PARENT_SCOPE)
else()
set("${out_var}" "FALSE" PARENT_SCOPE)
endif()
endfunction()