summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-06-01 17:39:36 +0000
committerKitware Robot <kwrobot@kitware.com>2017-06-01 13:40:03 -0400
commitc80148c77e552a43b0648bad02de86e6b6d2b61d (patch)
tree09442f2e80aa18ced625dc0d1f86f798e6bd690d
parent59234fa2da4387fe9849d91fb9ad401d47a9b45c (diff)
parent6181a9e00ef50a44d873c771c028f2ca88fd6be5 (diff)
downloadcmake-c80148c77e552a43b0648bad02de86e6b6d2b61d.tar.gz
Merge topic 'bootstrap-std-flags'
6181a9e0 bootstrap: prefer to use standard flags for C and CXX Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !842
-rwxr-xr-xbootstrap65
1 files changed, 37 insertions, 28 deletions
diff --git a/bootstrap b/bootstrap
index daf405e58a..84285a808e 100755
--- a/bootstrap
+++ b/bootstrap
@@ -6,6 +6,17 @@ die() {
echo "$@" 1>&2 ; exit 1
}
+# Compile flag extraction function.
+cmake_extract_standard_flags()
+{
+ cd "${cmake_source_dir}/Modules/Compiler/"
+ for file in ${1:-*}-${2}.cmake; do
+ cat "${file}" \
+ | sed -n "s/ *set *( *CMAKE_${2}${3}_EXTENSION_COMPILE_OPTION *\"\{0,1\}\([^\")]*\).*/\1/p" \
+ | tr ';' ' '
+ done
+}
+
# Version number extraction function.
cmake_version_component()
{
@@ -954,6 +965,17 @@ for a in ${cmake_c_compilers}; do
cmake_c_compiler="${a}"
fi
done
+for std in 11 99 90; do
+ try_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" C \"${std}\"`"
+ for flag in $try_flags; do
+ echo "Checking whether ${cmake_c_compiler} supports ${flag}" >> cmake_bootstrap.log 2>&1
+ if cmake_try_run "${cmake_c_compiler}" "${cmake_c_flags} ${flag}" \
+ "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
+ cmake_c_flags="${cmake_c_flags} ${flag}"
+ break 2
+ fi
+ done
+done
rm -f "${TMPFILE}.c"
if [ -z "${cmake_c_compiler}" ]; then
@@ -988,6 +1010,10 @@ echo '
# include <iostream.h>
#endif
+#if __cplusplus >= 201103L && defined(__SUNPRO_CC) && __SUNPRO_CC < 0x5140
+#error "SunPro <= 5.13 C++ 11 mode not supported due to bug in move semantics."
+#endif
+
class NeedCXX
{
public:
@@ -1015,6 +1041,17 @@ for a in ${cmake_cxx_compilers}; do
fi
done
done
+for std in 14 11 98; do
+ try_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" CXX \"${std}\"`"
+ for flag in $try_flags; do
+ echo "Checking for wheter ${cmake_cxx_flags} supports ${flag}" >> cmake_bootstrap.log 2>&1
+ if cmake_try_run "${cmake_cxx_compiler}" "${cmake_cxx_flags} ${flag} -DTEST1" \
+ "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
+ cmake_cxx_flags="${cmake_cxx_flags} ${flag} "
+ break 2
+ fi
+ done
+done
rm -f "${TMPFILE}.cxx"
if [ -z "${cmake_cxx_compiler}" ]; then
@@ -1162,34 +1199,6 @@ if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then
fi
-if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then
- # Are we SolarisStudio?
-
- TMPFILE=`cmake_tmp_file`
- echo '
- #if defined(__SUNPRO_CC)
- #include <iostream>
- int main() { std::cout << "This is SolarisStudio" << std::endl; return 0;}
- #endif
- ' > ${TMPFILE}.cxx
- cmake_cxx_compiler_is_solarisstudio=0
- if cmake_try_run "${cmake_cxx_compiler}" \
- "${cmake_cxx_flags} " "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
- cmake_cxx_compiler_is_solarisstudio=1
- fi
- if [ "x${cmake_cxx_compiler_is_solarisstudio}" = "x1" ]; then
- echo "${cmake_cxx_compiler} is SolarisStudio compiler"
- else
- echo "${cmake_cxx_compiler} is not SolarisStudio compiler"
- fi
- rm -f "${TMPFILE}.cxx"
-
- if [ "x${cmake_cxx_compiler_is_solarisstudio}" = "x1" ]; then
- cmake_cxx_flags="${cmake_cxx_flags} -library=stlport4"
- fi
-fi
-
-
# Test for kwsys features
KWSYS_NAME_IS_KWSYS=0
KWSYS_BUILD_SHARED=0