|
|
@@ -1288,14 +1288,17 @@ cmake_cxx_compiler=
|
|
|
# If CC is set, use that for compiler, otherwise use list of known compilers
|
|
|
if test -n "${cmake_toolchain}"; then
|
|
|
eval cmake_cxx_compilers="\${cmake_toolchain_${cmake_toolchain}_CXX}"
|
|
|
-elif test -n "${CXX}"; then
|
|
|
- cmake_cxx_compilers="${CXX}"
|
|
|
else
|
|
|
cmake_cxx_compilers="${CMAKE_KNOWN_CXX_COMPILERS}"
|
|
|
fi
|
|
|
|
|
|
# Check if C++ compiler works
|
|
|
-TMPFILE=`cmake_tmp_file`
|
|
|
+cmake_cxx_compiler_try_set()
|
|
|
+{
|
|
|
+ test_compiler="$1"
|
|
|
+ test_thread_flags="$2"
|
|
|
+
|
|
|
+ TMPFILE=`cmake_tmp_file`
|
|
|
echo '
|
|
|
#include <iostream>
|
|
|
#include <memory>
|
|
|
@@ -1374,23 +1377,34 @@ int main()
|
|
|
return 0;
|
|
|
}
|
|
|
' > "${TMPFILE}.cxx"
|
|
|
-for std in 17 14 11; do
|
|
|
- std_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" CXX \"${std}\"`"
|
|
|
- for compiler in ${cmake_cxx_compilers}; do
|
|
|
+ for std in 17 14 11; do
|
|
|
+ std_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" CXX \"${std}\"`"
|
|
|
for std_flag in '' $std_flags; do
|
|
|
- for thread_flag in '' $thread_flags; do
|
|
|
- echo "Checking whether '${compiler} ${cmake_cxx_flags} ${cmake_ld_flags} ${std_flag} ${thread_flag}' works." >> cmake_bootstrap.log 2>&1
|
|
|
- if cmake_try_run "${compiler}" "${cmake_cxx_flags} ${cmake_ld_flags} ${std_flag} ${thread_flag}" \
|
|
|
+ for thread_flag in '' $test_thread_flags; do
|
|
|
+ echo "Checking whether '${test_compiler} ${cmake_cxx_flags} ${cmake_ld_flags} ${std_flag} ${thread_flag}' works." >> cmake_bootstrap.log 2>&1
|
|
|
+ if cmake_try_run "${test_compiler}" "${cmake_cxx_flags} ${cmake_ld_flags} ${std_flag} ${thread_flag}" \
|
|
|
"${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
|
|
|
- cmake_cxx_compiler="${compiler}"
|
|
|
+ cmake_cxx_compiler="${test_compiler}"
|
|
|
cmake_cxx_flags="${cmake_cxx_flags} ${std_flag} ${thread_flag} "
|
|
|
- break 4
|
|
|
+ rm -f "${TMPFILE}.cxx"
|
|
|
+ return 0
|
|
|
fi
|
|
|
done
|
|
|
done
|
|
|
done
|
|
|
-done
|
|
|
-rm -f "${TMPFILE}.cxx"
|
|
|
+ rm -f "${TMPFILE}.cxx"
|
|
|
+ return 1
|
|
|
+}
|
|
|
+
|
|
|
+if test -n "${CXX}"; then
|
|
|
+ cmake_cxx_compiler_try_set "${CXX}" "${thread_flags}"
|
|
|
+else
|
|
|
+ for compiler in ${cmake_cxx_compilers}; do
|
|
|
+ if cmake_cxx_compiler_try_set "${compiler}" "${thread_flags}"; then
|
|
|
+ break
|
|
|
+ fi
|
|
|
+ done
|
|
|
+fi
|
|
|
|
|
|
if test -z "${cmake_cxx_compiler}"; then
|
|
|
cmake_error 7 "Cannot find a C++ compiler that supports both C++11 and the specified C++ flags.
|