xref: /llvm-project/cmake/Modules/EnableLanguageNolink.cmake (revision 7af584ed87cc6eddb6adbc451c90fb8867469e06)
1macro(llvm_enable_language_nolink)
2  # Set CMAKE_TRY_COMPILE_TARGET_TYPE to STATIC_LIBRARY to disable linking
3  # in the compiler sanity checks. When bootstrapping the toolchain,
4  # the toolchain itself is still incomplete and sanity checks that include
5  # linking may fail.
6  set(__SAVED_TRY_COMPILE_TARGET_TYPE ${CMAKE_TRY_COMPILE_TARGET_TYPE})
7  set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
8  enable_language(${ARGV})
9  set(CMAKE_TRY_COMPILE_TARGET_TYPE ${__SAVED_TRY_COMPILE_TARGET_TYPE})
10  unset(__SAVED_TRY_COMPILE_TARGET_TYPE)
11endmacro()
12