Преглед изворни кода

Rebuild on compiler switch

Kajetan Johannes Hammerle пре 1 месец
родитељ
комит
585118c1b6
1 измењених фајлова са 10 додато и 1 уклоњено
  1. 10 1
      tasks

+ 10 - 1
tasks

@@ -45,9 +45,13 @@ stats=false
 
 export CMAKE_EXPORT_COMPILE_COMMANDS=true
 
+cleanFolders() {
+    rm -rf build_debug build_profile build_release install
+}
+
 # parsing
 if [ "$task" = "clean" ]; then
-    rm -rf build_debug build_profile build_release install
+    cleanFolders
 elif [ "$task" = "build" ]; then
     type=$2
     if [ "$type" = "debug" ]; then
@@ -125,6 +129,11 @@ fi
 buildProfile() {
     folder=$1
     shift 1
+    if [ -e "$folder" ]; then
+	if ! cat $folder/CMakeCache.txt | grep "CMAKE_C_COMPILER:" | grep $compiler > /dev/null; then
+	    cleanFolders
+	fi
+    fi
     if [ ! -e "$folder" ]; then
         cmake -B "$folder" -S . -G Ninja -DCMAKE_C_COMPILER="${compiler}" -DCMAKE_INSTALL_PREFIX=../install "$@"
     fi