diff options
Diffstat (limited to 'Modules/CMakeTestOBJCXXCompiler.cmake')
-rw-r--r-- | Modules/CMakeTestOBJCXXCompiler.cmake | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Modules/CMakeTestOBJCXXCompiler.cmake b/Modules/CMakeTestOBJCXXCompiler.cmake index 4f7185f..aceb939 100644 --- a/Modules/CMakeTestOBJCXXCompiler.cmake +++ b/Modules/CMakeTestOBJCXXCompiler.cmake @@ -38,7 +38,7 @@ endif() if(NOT CMAKE_OBJCXX_COMPILER_WORKS) PrintTestCompilerStatus("OBJCXX") __TestCompiler_setTryCompileTargetType() - file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testOBJCXXCompiler.mm + string(CONCAT __TestCompiler_testObjCXXCompilerSource "#ifndef __cplusplus\n" "# error \"The CMAKE_OBJCXX_COMPILER is set to a C compiler\"\n" "#endif\n" @@ -49,9 +49,10 @@ if(NOT CMAKE_OBJCXX_COMPILER_WORKS) # Clear result from normal variable. unset(CMAKE_OBJCXX_COMPILER_WORKS) # Puts test result in cache variable. - try_compile(CMAKE_OBJCXX_COMPILER_WORKS ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testOBJCXXCompiler.mm + try_compile(CMAKE_OBJCXX_COMPILER_WORKS + SOURCE_FROM_VAR testObjCXXCompiler.mm __TestCompiler_testObjCXXCompilerSource OUTPUT_VARIABLE __CMAKE_OBJCXX_COMPILER_OUTPUT) + unset(__TestCompiler_testObjCXXCompilerSource) # Move result from cache to normal variable. set(CMAKE_OBJCXX_COMPILER_WORKS ${CMAKE_OBJCXX_COMPILER_WORKS}) unset(CMAKE_OBJCXX_COMPILER_WORKS CACHE) |