1 if(CMAKE_CLC_COMPILER_FORCED)
2 # The compiler configuration was forced by the user.
3 # Assume the user has configured all compiler information.
4 set(CMAKE_CLC_COMPILER_WORKS TRUE)
8 include(CMakeTestCompilerCommon)
10 # Remove any cached result from an older CMake version.
11 # We now store this in CMakeCCompiler.cmake.
12 unset(CMAKE_CLC_COMPILER_WORKS CACHE)
14 # This file is used by EnableLanguage in cmGlobalGenerator to
15 # determine that that selected CLC compiler 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_CLC_COMPILER_WORKS)
20 PrintTestCompilerStatus("CLC" "")
21 file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCLCCompiler.cl
22 "__kernel void test_k(global int * a)\n"
24 try_compile(CMAKE_CLC_COMPILER_WORKS ${CMAKE_BINARY_DIR}
25 ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCLCCompiler.cl
26 # We never generate executable so bypass the link step
27 CMAKE_FLAGS -DCMAKE_CLC_LINK_EXECUTABLE='echo'
28 OUTPUT_VARIABLE __CMAKE_CLC_COMPILER_OUTPUT)
29 # Move result from cache to normal variable.
30 set(CMAKE_CLC_COMPILER_WORKS ${CMAKE_CLC_COMPILER_WORKS})
31 unset(CMAKE_CLC_COMPILER_WORKS CACHE)
32 set(CLC_TEST_WAS_RUN 1)
35 if(NOT CMAKE_CLC_COMPILER_WORKS)
36 PrintTestCompilerStatus("CLC" " -- broken")
37 file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
38 "Determining if the CLC compiler works failed with "
39 "the following output:\n${__CMAKE_CLC_COMPILER_OUTPUT}\n\n")
40 message(FATAL_ERROR "The CLC compiler \"${CMAKE_CLC_COMPILER}\" "
41 "is not able to compile a simple test program.\nIt fails "
42 "with the following output:\n ${__CMAKE_CLC_COMPILER_OUTPUT}\n\n"
43 "CMake will not be able to correctly generate this project.")
46 PrintTestCompilerStatus("CLC" " -- works")
47 file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
48 "Determining if the CLC compiler works passed with "
49 "the following output:\n${__CMAKE_CLC_COMPILER_OUTPUT}\n\n")
52 include(${CMAKE_PLATFORM_INFO_DIR}/CMakeCLCCompiler.cmake)
56 unset(__CMAKE_CLC_COMPILER_OUTPUT)