2016-09-27 22:01:08 +03:00
|
|
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
2005-12-14 21:51:08 +03:00
|
|
|
|
2009-09-28 19:46:51 +04:00
|
|
|
|
2012-08-24 17:10:34 +04:00
|
|
|
if(CMAKE_CXX_COMPILER_FORCED)
|
|
|
|
# The compiler configuration was forced by the user.
|
|
|
|
# Assume the user has configured all compiler information.
|
|
|
|
set(CMAKE_CXX_COMPILER_WORKS TRUE)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
include(CMakeTestCompilerCommon)
|
2010-02-12 22:32:20 +03:00
|
|
|
|
2012-08-24 17:10:34 +04:00
|
|
|
# Remove any cached result from an older CMake version.
|
|
|
|
# We now store this in CMakeCXXCompiler.cmake.
|
|
|
|
unset(CMAKE_CXX_COMPILER_WORKS CACHE)
|
|
|
|
|
2003-01-21 20:50:48 +03:00
|
|
|
# This file is used by EnableLanguage in cmGlobalGenerator to
|
|
|
|
# determine that that selected C++ compiler can actually compile
|
2003-08-28 00:02:37 +04:00
|
|
|
# and link the most basic of programs. If not, a fatal error
|
2003-01-21 20:50:48 +03:00
|
|
|
# is set and cmake stops processing commands and will not generate
|
|
|
|
# any makefiles or projects.
|
2012-08-13 21:47:32 +04:00
|
|
|
if(NOT CMAKE_CXX_COMPILER_WORKS)
|
2010-02-12 22:32:20 +03:00
|
|
|
PrintTestCompilerStatus("CXX" "")
|
2012-08-13 21:47:32 +04:00
|
|
|
file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx
|
2004-10-11 19:55:39 +04:00
|
|
|
"#ifndef __cplusplus\n"
|
|
|
|
"# error \"The CMAKE_CXX_COMPILER is set to a C compiler\"\n"
|
|
|
|
"#endif\n"
|
|
|
|
"int main(){return 0;}\n")
|
2012-08-13 21:47:32 +04:00
|
|
|
try_compile(CMAKE_CXX_COMPILER_WORKS ${CMAKE_BINARY_DIR}
|
2006-06-14 20:28:32 +04:00
|
|
|
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx
|
2011-12-15 17:29:43 +04:00
|
|
|
OUTPUT_VARIABLE __CMAKE_CXX_COMPILER_OUTPUT)
|
2012-08-24 17:10:34 +04:00
|
|
|
# Move result from cache to normal variable.
|
|
|
|
set(CMAKE_CXX_COMPILER_WORKS ${CMAKE_CXX_COMPILER_WORKS})
|
|
|
|
unset(CMAKE_CXX_COMPILER_WORKS CACHE)
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CXX_TEST_WAS_RUN 1)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2003-12-01 21:06:35 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if(NOT CMAKE_CXX_COMPILER_WORKS)
|
2010-02-12 22:32:20 +03:00
|
|
|
PrintTestCompilerStatus("CXX" " -- broken")
|
2012-08-13 21:47:32 +04:00
|
|
|
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
2003-12-01 21:06:35 +03:00
|
|
|
"Determining if the CXX compiler works failed with "
|
2011-12-15 17:29:43 +04:00
|
|
|
"the following output:\n${__CMAKE_CXX_COMPILER_OUTPUT}\n\n")
|
2012-08-13 21:47:32 +04:00
|
|
|
message(FATAL_ERROR "The C++ compiler \"${CMAKE_CXX_COMPILER}\" "
|
2003-08-05 01:08:41 +04:00
|
|
|
"is not able to compile a simple test program.\nIt fails "
|
2011-12-15 17:29:43 +04:00
|
|
|
"with the following output:\n ${__CMAKE_CXX_COMPILER_OUTPUT}\n\n"
|
2003-07-11 22:14:03 +04:00
|
|
|
"CMake will not be able to correctly generate this project.")
|
2012-08-13 21:50:14 +04:00
|
|
|
else()
|
2012-08-13 21:47:32 +04:00
|
|
|
if(CXX_TEST_WAS_RUN)
|
2010-02-12 22:32:20 +03:00
|
|
|
PrintTestCompilerStatus("CXX" " -- works")
|
2012-08-13 21:47:32 +04:00
|
|
|
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
2005-01-20 20:30:03 +03:00
|
|
|
"Determining if the CXX compiler works passed with "
|
2011-12-15 17:29:43 +04:00
|
|
|
"the following output:\n${__CMAKE_CXX_COMPILER_OUTPUT}\n\n")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2008-01-22 02:30:17 +03:00
|
|
|
|
2012-08-24 17:10:34 +04:00
|
|
|
# Try to identify the ABI and configure it into CMakeCXXCompiler.cmake
|
|
|
|
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake)
|
|
|
|
CMAKE_DETERMINE_COMPILER_ABI(CXX ${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp)
|
2013-10-17 13:47:29 +04:00
|
|
|
# Try to identify the compiler features
|
|
|
|
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompileFeatures.cmake)
|
|
|
|
CMAKE_DETERMINE_COMPILE_FEATURES(CXX)
|
2012-08-24 17:10:34 +04:00
|
|
|
|
|
|
|
# Re-configure to save learned information.
|
|
|
|
configure_file(
|
|
|
|
${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in
|
|
|
|
${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXCompiler.cmake
|
2013-11-13 12:50:56 +04:00
|
|
|
@ONLY
|
2012-08-24 17:10:34 +04:00
|
|
|
)
|
|
|
|
include(${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXCompiler.cmake)
|
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if(CMAKE_CXX_SIZEOF_DATA_PTR)
|
|
|
|
foreach(f ${CMAKE_CXX_ABI_FILES})
|
|
|
|
include(${f})
|
|
|
|
endforeach()
|
|
|
|
unset(CMAKE_CXX_ABI_FILES)
|
|
|
|
endif()
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2011-12-15 17:29:43 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
unset(__CMAKE_CXX_COMPILER_OUTPUT)
|