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; } [ ! -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 GENERATOR
export SOURCE_DIR export SOURCE_DIR
export BUILD_DIR export BUILD_DIR
@@ -127,20 +136,7 @@ generate_configuration() {
fi fi
fi fi
mkdir -p "${GEN_DIR}" cmake -B"${GEN_DIR}" -H"${SOURCE_DIR}" -G "${GENERATOR}" -DCMAKE_INSTALL_PREFIX="${OUTPUT_DIR}" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" ${CMAKE_ARGS}
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
} }
export -f generate_configuration export -f generate_configuration