Compare commits

...

5 Commits

2 changed files with 11 additions and 15 deletions

View File

@@ -86,6 +86,15 @@ CMAKE_ARGS=""
[ ! -f "${SOURCE_DIR}/CMakeLists.txt" ] && { echo "Source directory does not contain CMakeLists.txt"; exit 4; }
if grep -i ^"project.*fortran" "${SOURCE_DIR}/CMakeLists.txt" >/dev/null 2>&1 ; then
if [ -x "$(command -v make)" ]; then
GENERATOR="Unix Makefiles"
else
echo "Projects with Fortran sources need Make to build"
exit 5
fi
fi
export GENERATOR
export SOURCE_DIR
export BUILD_DIR
@@ -127,20 +136,7 @@ generate_configuration() {
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}"
if [ "x$GENERATOR" == "xNinja" ]; then
# Generate fake Makefile, so make can run ninja build
cat > Makefile <<EOF
.PHONY: build
%:
@ninja \$@
build:
@ninja
EOF
fi
popd 2>/dev/null
cmake -B"${GEN_DIR}" -H"${SOURCE_DIR}" -G "${GENERATOR}" -DCMAKE_INSTALL_PREFIX="${OUTPUT_DIR}" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" ${CMAKE_ARGS}
}
export -f generate_configuration

View File

@@ -1,6 +1,6 @@
#!/bin/bash
PROJECT=$(grep -i "^Project" "$(dirname -- "$(dirname -- "$(pwd)")")/CMakeLists.txt" | awk -F'[()]' '{print $2}')
PROJECT=$(grep -i "^Project" "$(dirname -- "$(dirname -- "$(pwd)")")/CMakeLists.txt" | awk -F'[( )]' '{print $2}')
"$(dirname $0)/cmake.sh" -f -t qtDebug