Browse Source

Ability to override the compiler

Jorrit Rouwe 3 years ago
parent
commit
97f982b5e6
1 changed files with 11 additions and 4 deletions
  1. 11 4
      Build/cmake_linux_clang.sh

+ 11 - 4
Build/cmake_linux_clang.sh

@@ -1,6 +1,5 @@
 #!/bin/sh
 
-BUILD_TYPE=$1
 if [ -z $1 ] 
 then
 	BUILD_TYPE=Debug
@@ -8,12 +7,20 @@ else
 	BUILD_TYPE=$1
 fi
 
+if [ -z $2 ] 
+then
+	COMPILER=clang++
+else
+	COMPILER=$2
+fi
+
 BUILD_DIR=Linux_$BUILD_TYPE
 
-echo Usage: ./cmake_linux_clang.sh [Configuration]
+echo Usage: ./cmake_linux_clang.sh [Configuration] [Compiler]
 echo "Possible configurations: Debug (default), Release, Distribution, ReleaseUBSAN, ReleaseASAN, ReleaseCoverage"
-echo Generating Makefile for build type \"$BUILD_TYPE\" in folder \"$BUILD_DIR\"
+echo "Possible compilers: clang++, clang++-XX where XX is the version"
+echo Generating Makefile for build type \"$BUILD_TYPE\" and compiler \"$COMPILER\" in folder \"$BUILD_DIR\"
 
-cmake -S . -B $BUILD_DIR -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_COMPILER=clang++
+cmake -S . -B $BUILD_DIR -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_COMPILER=$COMPILER
 
 echo Compile by running \"make -j 8 \&\& ./UnitTests\" in folder \"$BUILD_DIR\"