Update control flow in cmake-build.sh
This commit is contained in:
		
							parent
							
								
									adba2ef142
								
							
						
					
					
						commit
						399bd179da
					
				@ -11,36 +11,17 @@ do
 | 
				
			|||||||
  printf "\nEnter 1 to build, 2 to cleanup previous build, 0 to exit.\n"
 | 
					  printf "\nEnter 1 to build, 2 to cleanup previous build, 0 to exit.\n"
 | 
				
			||||||
  read bChoice
 | 
					  read bChoice
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Build loop
 | 
					  if [ $bChoice -eq 1 ] # Build project
 | 
				
			||||||
  # If input read is == 1
 | 
					 | 
				
			||||||
  if [ $bChoice -eq 1 ]
 | 
					 | 
				
			||||||
  then
 | 
					  then
 | 
				
			||||||
    mkdir build
 | 
					    mkdir build
 | 
				
			||||||
    (cd build && cmake .. && cmake --build .)
 | 
					    (cd build && cmake .. && cmake --build .)
 | 
				
			||||||
  fi
 | 
					  elif [ $bChoice -eq 2 ] ; then # Cleanup build
 | 
				
			||||||
 | 
					 | 
				
			||||||
  # Clean-up loop
 | 
					 | 
				
			||||||
  # If input read is == 2
 | 
					 | 
				
			||||||
  if [ $bChoice -eq 2 ]
 | 
					 | 
				
			||||||
  then
 | 
					 | 
				
			||||||
    rm -Rv build/*
 | 
					    rm -Rv build/*
 | 
				
			||||||
  fi
 | 
					  elif [ $bChoice -eq 0 ] ; then # Exit script
 | 
				
			||||||
 | 
					    break
 | 
				
			||||||
  # Exit loops, all other input - 
 | 
					  else
 | 
				
			||||||
 | 
					    continue
 | 
				
			||||||
  # If input read is >= 3, exit
 | 
					 | 
				
			||||||
  if [ $bChoice -ge 3 ]
 | 
					 | 
				
			||||||
  then
 | 
					 | 
				
			||||||
    break 
 | 
					 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  # If input read is <= 0, exit
 | 
					 | 
				
			||||||
  if [ $bChoice -le 0 ]
 | 
					 | 
				
			||||||
  then
 | 
					 | 
				
			||||||
    break
 | 
					 | 
				
			||||||
  fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  # Bash will print an error if symbol or character input
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user