[release] Use threaded compression with xz
[llvm-project.git] / libclc / cmake / CMakeTestLLAsmCompiler.cmake
blob35948ee07a9406acc7442752ff063f1e5d2ade22
1 if(CMAKE_LLAsm_COMPILER_FORCED)
2   # The compiler configuration was forced by the user.
3   # Assume the user has configured all compiler information.
4   set(CMAKE_LLAsm_COMPILER_WORKS TRUE)
5   return()
6 endif()
8 include(CMakeTestCompilerCommon)
10 # Remove any cached result from an older CMake version.
11 # We now store this in CMakeCCompiler.cmake.
12 unset(CMAKE_LLAsm_COMPILER_WORKS CACHE)
14 # This file is used by EnableLanguage in cmGlobalGenerator to
15 # determine that that selected llvm assembler can actually compile
16 # and link the most basic of programs. If not, a fatal error
17 # is set and cmake stops processing commands and will not generate
18 # any makefiles or projects.
19 if(NOT CMAKE_LLAsm_COMPILER_WORKS)
20   PrintTestCompilerStatus("LLAsm" "")
21   file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testLLAsmCompiler.ll
22     "define i32 @test() {\n"
23     "ret i32 0 }\n" )
24   try_compile(CMAKE_LLAsm_COMPILER_WORKS ${CMAKE_BINARY_DIR}
25     ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testLLAsmCompiler.ll
26     # We never generate executable so bypass the link step
27     CMAKE_FLAGS -DCMAKE_LLAsm_LINK_EXECUTABLE='echo'
28     OUTPUT_VARIABLE __CMAKE_LLAsm_COMPILER_OUTPUT)
29   # Move result from cache to normal variable.
30   set(CMAKE_LLAsm_COMPILER_WORKS ${CMAKE_LLAsm_COMPILER_WORKS})
31   unset(CMAKE_LLAsm_COMPILER_WORKS CACHE)
32   set(LLAsm_TEST_WAS_RUN 1)
33 endif()
35 if(NOT CMAKE_LLAsm_COMPILER_WORKS)
36   PrintTestCompilerStatus("LLAsm" " -- broken")
37   file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
38     "Determining if the LLAsm compiler works failed with "
39     "the following output:\n${__CMAKE_LLAsm_COMPILER_OUTPUT}\n\n")
40   message(FATAL_ERROR "The LLAsm compiler \"${CMAKE_LLAsm_COMPILER}\" "
41     "is not able to compile a simple test program.\nIt fails "
42     "with the following output:\n ${__CMAKE_LLAsm_COMPILER_OUTPUT}\n\n"
43     "CMake will not be able to correctly generate this project.")
44 else()
45   if(LLAsm_TEST_WAS_RUN)
46     PrintTestCompilerStatus("LLAsm" " -- works")
47     file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
48       "Determining if the LLAsm compiler works passed with "
49       "the following output:\n${__CMAKE_LLAsm_COMPILER_OUTPUT}\n\n")
50   endif()
52   include(${CMAKE_PLATFORM_INFO_DIR}/CMakeLLAsmCompiler.cmake)
54 endif()
56 unset(__CMAKE_LLAsm_COMPILER_OUTPUT)