summaryrefslogtreecommitdiff
path: root/cmake/Modules/EnableLanguageNolink.cmake
blob: 18668c6d0476f1f52de48073c2b0d6422967afb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
macro(llvm_enable_language_nolink)
  # Set CMAKE_TRY_COMPILE_TARGET_TYPE to STATIC_LIBRARY to disable linking
  # in the compiler sanity checks. When bootstrapping the toolchain,
  # the toolchain itself is still incomplete and sanity checks that include
  # linking may fail.
  set(__SAVED_TRY_COMPILE_TARGET_TYPE ${CMAKE_TRY_COMPILE_TARGET_TYPE})
  set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
  enable_language(${ARGV})
  set(CMAKE_TRY_COMPILE_TARGET_TYPE ${__SAVED_TRY_COMPILE_TARGET_TYPE})
  unset(__SAVED_TRY_COMPILE_TARGET_TYPE)
endmacro()