diff --git a/cmake.sh b/cmake.sh index 452584b..89d89b1 100755 --- a/cmake.sh +++ b/cmake.sh @@ -21,7 +21,8 @@ LONGOPTS=generator:,type:,qtcreator,cmake,force,source-dir:,build-dir:,output-di eval set -- "$PARSED" # Default generator -GENERATOR="Unix Makefiles" +[ -x "$(command -v make)" ] && GENERATOR="Unix Makefiles" +[ -x "$(command -v ninja)" ] && GENERATOR=Ninja # Generate single build type SINGLE_TYPE="n" @@ -89,6 +90,11 @@ while true; do esac done +if [ "x${GENERATOR}" = "x" ]; then + echo "Build command is not found" + exit 1 +fi + CMAKE_ARGS="" [ ${#@} -gt 0 ] && CMAKE_ARGS=("${@}") diff --git a/qtcreator-debug.sh b/qtcreator-debug.sh index 4bb2cfb..9343bb8 100755 --- a/qtcreator-debug.sh +++ b/qtcreator-debug.sh @@ -1,12 +1,6 @@ #!/bin/bash -[ -x "$(command -v make)" ] && GENERATOR="Unix Makefiles" -[ -x "$(command -v ninja)" ] && GENERATOR=Ninja -if [ "x${GENERATOR}" = "x" ]; then - echo "Build command is not found" - exit 1 -fi PROJECT=$(grep -i "^Project" "$(dirname -- "$(dirname -- "$(pwd)")")/CMakeLists.txt" | awk -F'[()]' '{print $2}') -"$(dirname $0)/cmake.sh" -g "${GENERATOR}" -f -t Debug +"$(dirname $0)/cmake.sh" -f -t Debug