From 36487b07d2e2149967a370a0f3fd0d081385366d Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Tue, 19 Feb 2019 11:19:38 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D1=82=D0=BE=D0=BB=D1=8C=D0=BA=D0=BE=20=D0=BA=D0=B0?= =?UTF-8?q?=D1=82=D0=B0=D0=BB=D0=BE=D0=B3=D0=B0=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=B4=D0=B0=D0=BD=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=B2?= =?UTF-8?q?=D0=B0=D1=80=D0=B8=D0=B0=D0=BD=D1=82=D0=B0=20=D1=81=D0=B1=D0=BE?= =?UTF-8?q?=D1=80=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake.sh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/cmake.sh b/cmake.sh index c350015..30b1397 100755 --- a/cmake.sh +++ b/cmake.sh @@ -94,15 +94,6 @@ CMAKE_ARGS=() [ ! -f "${SOURCE_DIR}/CMakeLists.txt" ] && { echo "Source directory does not contain CMakeLists.txt"; exit 4; } -if [ -d "${BUILD_DIR}" ]; then - if [ "x${FORCE}" == "xy" ]; then - rm -rf "${BUILD_DIR}" - else - echo "Build directory already exists. Use --force to remove this directory or do it manually" - exit 5 - fi -fi - if [ "x${SINGLE_TYPE}" != "xn" ]; then case "${SINGLE_TYPE}" in None|Debug|Release|Profile|RelWithDebInfo|MinSizeRel) @@ -123,6 +114,7 @@ export BUILD_DIR export OUTPUT_DIR export CMAKE_ARGS export SINGLE_TYPE +export FORCE CMAKE_BUILD_TYPES=(None Debug Release Profile RelWithDebInfo MinSizeRel) QTCREATOR_BUILD_TYPES=(qtNone qtDebug qtRelease qtProfile) @@ -158,7 +150,16 @@ generate_configuration() { else GEN_DIR="${BUILD_DIR}/${SINGLE_TYPE}" fi - [ -d "${GEN_DIR}" ] && return 0 + + if [ -d "${GEN_DIR}" ]; then + if [ "x${FORCE}" == "xy" ]; then + rm -rf "${GEN_DIR}" + else + echo "Build directory '${GEN_DIR}' already exists. Use --force to remove this directory or do it manually" + return + fi + fi + mkdir -p "${GEN_DIR}" pushd "${GEN_DIR}" 2>/dev/null cmake -G "${GENERATOR}" -DCMAKE_INSTALL_PREFIX="${OUTPUT_DIR}" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" "${CMAKE_ARGS[@]}" "${SOURCE_DIR}"