1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-16 14:08:35 +08:00

bootstrap: Add infrastructure to detect threading flags

In our loop to detect -std flags, add another layer to detect
threading flags.
This commit is contained in:
Brad King
2017-11-28 11:22:46 -05:00
parent 8b5ae1c1d3
commit 6e613ff399

View File

@@ -981,6 +981,8 @@ if [ -z "${CC}" -a -z "${CXX}" ]; then
cmake_toolchain_detect cmake_toolchain_detect
fi fi
thread_flags=''
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Test C compiler # Test C compiler
cmake_c_compiler= cmake_c_compiler=
@@ -1014,19 +1016,21 @@ int main(int argc, char* argv[])
} }
' > "${TMPFILE}.c" ' > "${TMPFILE}.c"
for std in 11 99 90; do for std in 11 99 90; do
try_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" C \"${std}\"`" std_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" C \"${std}\"`"
for compiler in ${cmake_c_compilers}; do for compiler in ${cmake_c_compilers}; do
for flag in '' $try_flags; do for std_flag in '' $std_flags; do
echo "Checking whether '${compiler} ${cmake_c_flags} ${flag}' works." >> cmake_bootstrap.log 2>&1 for thread_flag in '' $thread_flags; do
if cmake_try_run "${compiler}" "${cmake_c_flags} ${flag}" \ echo "Checking whether '${compiler} ${cmake_c_flags} ${std_flag} ${thread_flag}' works." >> cmake_bootstrap.log 2>&1
if cmake_try_run "${compiler}" "${cmake_c_flags} ${std_flag} ${thread_flag}" \
"${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
cmake_c_compiler="${compiler}" cmake_c_compiler="${compiler}"
cmake_c_flags="${cmake_c_flags} ${flag}" cmake_c_flags="${cmake_c_flags} ${std_flag} ${thread_flag}"
break 3 break 3
fi fi
done done
done done
done done
done
rm -f "${TMPFILE}.c" rm -f "${TMPFILE}.c"
if [ -z "${cmake_c_compiler}" ]; then if [ -z "${cmake_c_compiler}" ]; then
@@ -1081,19 +1085,21 @@ int main()
} }
' > "${TMPFILE}.cxx" ' > "${TMPFILE}.cxx"
for std in 17 14 11; do for std in 17 14 11; do
try_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" CXX \"${std}\"`" std_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" CXX \"${std}\"`"
for compiler in ${cmake_cxx_compilers}; do for compiler in ${cmake_cxx_compilers}; do
for flag in '' $try_flags; do for std_flag in '' $std_flags; do
echo "Checking whether '${compiler} ${cmake_cxx_flags} ${flag}' works." >> cmake_bootstrap.log 2>&1 for thread_flag in '' $thread_flags; do
if cmake_try_run "${compiler}" "${cmake_cxx_flags} ${flag}" \ echo "Checking whether '${compiler} ${cmake_cxx_flags} ${std_flag} ${thread_flag}' works." >> cmake_bootstrap.log 2>&1
if cmake_try_run "${compiler}" "${cmake_cxx_flags} ${std_flag} ${thread_flag}" \
"${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
cmake_cxx_compiler="${compiler}" cmake_cxx_compiler="${compiler}"
cmake_cxx_flags="${cmake_cxx_flags} ${flag} " cmake_cxx_flags="${cmake_cxx_flags} ${std_flag} ${thread_flag} "
break 3 break 3
fi fi
done done
done done
done done
done
rm -f "${TMPFILE}.cxx" rm -f "${TMPFILE}.cxx"
if [ -z "${cmake_cxx_compiler}" ]; then if [ -z "${cmake_cxx_compiler}" ]; then