Удаление только каталога для заданного варианта сборки

This commit is contained in:
Andrei Astafev 2019-02-19 11:19:38 +03:00
parent e15e1fb505
commit 36487b07d2

View File

@ -94,15 +94,6 @@ CMAKE_ARGS=()
[ ! -f "${SOURCE_DIR}/CMakeLists.txt" ] && { echo "Source directory does not contain CMakeLists.txt"; exit 4; } [ ! -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 if [ "x${SINGLE_TYPE}" != "xn" ]; then
case "${SINGLE_TYPE}" in case "${SINGLE_TYPE}" in
None|Debug|Release|Profile|RelWithDebInfo|MinSizeRel) None|Debug|Release|Profile|RelWithDebInfo|MinSizeRel)
@ -123,6 +114,7 @@ export BUILD_DIR
export OUTPUT_DIR export OUTPUT_DIR
export CMAKE_ARGS export CMAKE_ARGS
export SINGLE_TYPE export SINGLE_TYPE
export FORCE
CMAKE_BUILD_TYPES=(None Debug Release Profile RelWithDebInfo MinSizeRel) CMAKE_BUILD_TYPES=(None Debug Release Profile RelWithDebInfo MinSizeRel)
QTCREATOR_BUILD_TYPES=(qtNone qtDebug qtRelease qtProfile) QTCREATOR_BUILD_TYPES=(qtNone qtDebug qtRelease qtProfile)
@ -158,7 +150,16 @@ generate_configuration() {
else else
GEN_DIR="${BUILD_DIR}/${SINGLE_TYPE}" GEN_DIR="${BUILD_DIR}/${SINGLE_TYPE}"
fi 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}" mkdir -p "${GEN_DIR}"
pushd "${GEN_DIR}" 2>/dev/null pushd "${GEN_DIR}" 2>/dev/null
cmake -G "${GENERATOR}" -DCMAKE_INSTALL_PREFIX="${OUTPUT_DIR}" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" "${CMAKE_ARGS[@]}" "${SOURCE_DIR}" cmake -G "${GENERATOR}" -DCMAKE_INSTALL_PREFIX="${OUTPUT_DIR}" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" "${CMAKE_ARGS[@]}" "${SOURCE_DIR}"