File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -545,12 +545,35 @@ find_or_install()
545545 else # permission granted to build
546546 printf " n\n"
547547
548- if [[ -z " $CC " ]]; then
548+ # On OS X, CMake must be built with Apple LLVM gcc, which XCode command-line tools puts in /usr/bin
549+ if [[ ` uname` == " Darwin" && $package == " cmake" ]]; then
550+ if [[ -x " /usr/bin/gcc" ]]; then
551+ CC=/usr/bin/gcc
552+ else
553+ printf " $this_script : OS X detected. Please install XCode command-line tools and \n"
554+ printf " $this_script : ensure that /usr/bin/gcc exists and is executable. Aborting. [exit 75]\n"
555+ exit 75
556+ fi
557+ # Otherwise, if no CC has been defined yet, use the gcc in the user's PATH
558+ elif [[ -z " $CC " ]]; then
549559 CC=gcc
550560 fi
551- if [[ -z " $CXX " ]]; then
561+
562+ # On OS X, CMake must be built with Apple LLVM g++, which XCode command-line tools puts in /usr/bin
563+ if [[ ` uname` == " Darwin" && $package == " cmake" ]]; then
564+ if [[ -x " /usr/bin/gcc" ]]; then
565+ CXX=/usr/bin/g++
566+ else
567+ printf " $this_script : OS X detected. Please install XCode command-line tools \n"
568+ printf " $this_script : and ensure that /usr/bin/g++ exists and is executable. Aborting. [exit 76]\n"
569+ exit 76
570+ fi
571+ # Otherwise, if no CXX has been defined yet, use the g++ in the user's PATH
572+ elif [[ -z " $CC " ]]; then
552573 CXX=g++
553574 fi
575+
576+ # If no FC has been defined yet, use the gfortran in the user's PATH
554577 if [[ -z " $FC " ]]; then
555578 FC=gfortran
556579 fi
You can’t perform that action at this time.
0 commit comments