Files
swift-mirror/cmake/modules/SwiftImplicitImport.cmake
Rintaro Ishizaki 9c9010e5b7 [CMake] Support Macros in Linux
For compiling codes required for macro support, we now need swiftc
compiler in the build machine.

Unlike Darwin OSes, where swiftCore runtime is guaranteed to be present
in /usr/lib, Linux doesn't have ABI stability and the stdlib of the
build machine is not at the specific location. So the built compiler
cannot relies on the shared object in the toolchain.
2023-08-24 17:04:15 +00: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()