Sfoglia il codice sorgente

Rebuild on compiler switch

Kajetan Johannes Hammerle 1 mese fa
parent
commit
585118c1b6
1 ha cambiato i file con 10 aggiunte e 1 eliminazioni
  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