1
0
Fork 0
mirror of https://github.com/TheLartians/ModernCppStarter.git synced 2025-10-31 10:11:34 +01:00

cleanup build files

use strict -std=c++20
update cmake-format config file
This commit is contained in:
ClausKlein 2021-02-13 21:56:31 +01:00
parent 1aad14a6fa
commit 7f36b7cb86
12 changed files with 70 additions and 164 deletions

View file

@ -1,8 +1,11 @@
#
# CURDIR=$(/bin/pwd)
#
# GENERATOR="Unix Makefiles"
GENERATOR=Ninja
# On UNIX one can use the DESTDIR mechanism in order to relocate the whole installation.
DESTDIR?=${CURDIR}/stagedir
export DESTDIR
# GENERATOR?="Unix Makefiles"
GENERATOR?=Ninja
export CPM_SOURCE_CACHE=${HOME}/.cache/CPM
export CPM_USE_LOCAL_PACKAGES=1
@ -12,8 +15,11 @@ export CPM_USE_LOCAL_PACKAGES=1
# the default target does just all
all:
clean:
find . -type d -name build | xargs rm -rf
distclean: clean
rm -rf build root
rm -rf build ${DESTDIR}
# update CPM.cmake
update:
@ -27,18 +33,18 @@ lock: standalone all
# install the library
install:
cmake -S . -B build/install -G "${GENERATOR}" -DCMAKE_PREFIX_PATH=${CURDIR}/root -DCMAKE_INSTALL_PREFIX=${CURDIR}/root -DCMAKE_CXX_STANDARD=20 # --trace-expand
cmake -S . -B build/install -G "${GENERATOR}" -DCMAKE_PREFIX_PATH=${DESTDIR} # --trace-expand
cmake --build build/install --target install
# test the library
test: install
cmake -S test -B build/test -G "${GENERATOR}" -DCMAKE_PREFIX_PATH=${CURDIR}/root -DTEST_INSTALLED_VERSION=1
cmake -S test -B build/test -G "${GENERATOR}" -DCMAKE_PREFIX_PATH=${DESTDIR} -DTEST_INSTALLED_VERSION=1
cmake --build build/test
cmake --build build/test --target test
# all together
all: test
cmake -S all -B build/all -G "${GENERATOR}" -DCMAKE_PREFIX_PATH=${CURDIR}/root -DTEST_INSTALLED_VERSION=1 -DENABLE_TEST_COVERAGE=1
cmake -S all -B build/all -G "${GENERATOR}" -DCMAKE_PREFIX_PATH=${DESTDIR} -DTEST_INSTALLED_VERSION=1 -DENABLE_TEST_COVERAGE=1
cmake --build build/all
cmake --build build/all --target test
cmake --build build/all --target GenerateDocs
@ -51,7 +57,7 @@ format: distclean
find . -name '*.h' | xargs clang-format -i
standalone:
cmake -S standalone -B build/standalone -G "${GENERATOR}" -DCMAKE_PREFIX_PATH=${CURDIR}/root -DCMAKE_EXPORT_COMPILE_COMMANDS=1
cmake -S standalone -B build/standalone -G "${GENERATOR}" -DCMAKE_PREFIX_PATH=${DESTDIR} -DCMAKE_EXPORT_COMPILE_COMMANDS=1
cmake --build build/standalone --target all
# check the library