summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikolai Merinov <n.merinov@samsung.com>2019-01-24 19:11:32 +0300
committerNikolai Merinov <n.merinov@samsung.com>2019-01-25 11:12:41 +0300
commit2e1b98b7de9a95652e6b61c9116a49e963b2a891 (patch)
treeae96e536cb61fc3b13a5752099ffad51134f6efc
parentf40a94b4da18da0a39189ef168dd47893a27af19 (diff)
downloadcmake-2e1b98b7de9a95652e6b61c9116a49e963b2a891.tar.gz
cmake-2e1b98b7de9a95652e6b61c9116a49e963b2a891.tar.bz2
cmake-2e1b98b7de9a95652e6b61c9116a49e963b2a891.zip
Support build with CC and CXX with spacessandbox/nmerinov/llvm
In order to compile with clang we should call "clang --target=target-name". Best way is pass whole this command as CC value. Support such definition in cmake bootstrap script.
-rwxr-xr-xbootstrap22
1 files changed, 11 insertions, 11 deletions
diff --git a/bootstrap b/bootstrap
index b5effd640..158f31657 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
@@ -674,7 +674,7 @@ cmake_try_run ()
echo "---------- file -----------------------"
cat "${TESTFILE}"
echo "------------------------------------------"
- "${COMPILER}" ${FLAGS} "${TESTFILE}" -o "${TMPFILE}"
+ ${COMPILER} ${FLAGS} "${TESTFILE}" -o "${TMPFILE}"
RES=$?
if [ "${RES}" -ne "0" ]; then
echo "Test failed to compile"
@@ -937,11 +937,11 @@ cmake_c_compiler=
# If CC is set, use that for compiler, otherwise use list of known compilers
if [ -n "${cmake_toolchain}" ]; then
- eval cmake_c_compilers="\${cmake_toolchain_${cmake_toolchain}_CC}"
+ eval cmake_c_compilers=("\${cmake_toolchain_${cmake_toolchain}_CC}")
elif [ -n "${CC}" ]; then
- cmake_c_compilers="${CC}"
+ cmake_c_compilers=("${CC}")
else
- cmake_c_compilers="${CMAKE_KNOWN_C_COMPILERS}"
+ cmake_c_compilers=(${CMAKE_KNOWN_C_COMPILERS})
fi
# Check if C compiler works
@@ -965,7 +965,7 @@ int main(int argc, char* argv[])
return argc-1;
}
' > "${TMPFILE}.c"
-for a in ${cmake_c_compilers}; do
+for a in "${cmake_c_compilers[@]}"; do
if [ -z "${cmake_c_compiler}" ] && \
cmake_try_run "${a}" "${cmake_c_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then
cmake_c_compiler="${a}"
@@ -1000,11 +1000,11 @@ cmake_cxx_compiler=
# If CC is set, use that for compiler, otherwise use list of known compilers
if [ -n "${cmake_toolchain}" ]; then
- eval cmake_cxx_compilers="\${cmake_toolchain_${cmake_toolchain}_CXX}"
+ eval cmake_cxx_compilers=("\${cmake_toolchain_${cmake_toolchain}_CXX}")
elif [ -n "${CXX}" ]; then
- cmake_cxx_compilers="${CXX}"
+ cmake_cxx_compilers=("${CXX}")
else
- cmake_cxx_compilers="${CMAKE_KNOWN_CXX_COMPILERS}"
+ cmake_cxx_compilers=(${CMAKE_KNOWN_CXX_COMPILERS})
fi
# Check if C++ compiler works
@@ -1039,7 +1039,7 @@ int main()
return 0;
}
' > "${TMPFILE}.cxx"
-for a in ${cmake_cxx_compilers}; do
+for a in "${cmake_cxx_compilers[@]}"; do
for b in 1 2 3; do
if [ -z "${cmake_cxx_compiler}" ] && \
cmake_try_run "${a}" "${cmake_cxx_flags} -DTEST${b}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
@@ -1086,7 +1086,7 @@ mkdir "${cmake_bootstrap_dir}/${TMPFILE}"
cd "${cmake_bootstrap_dir}/${TMPFILE}"
echo '
test: test.c
- "'"${cmake_c_compiler}"'" '"${cmake_ld_flags} ${cmake_c_flags}"' -o test test.c
+ '"${cmake_c_compiler}"' '"${cmake_ld_flags} ${cmake_c_flags}"' -o test test.c
'>"Makefile"
echo '
#include <stdio.h>