1
0
Fork 0
mirror of https://github.com/TheLartians/ModernCppStarter.git synced 2025-09-01 06:30:52 +02:00

clenup GNUmakefile to work with clang-tidy

This commit is contained in:
ClausKlein 2021-03-03 10:52:56 +01:00
parent c122dc042f
commit 7d95486a55

View file

@ -4,7 +4,7 @@
GENERATOR?=Ninja GENERATOR?=Ninja
STAGEDIR?="${CURDIR}/stage" STAGEDIR?="${CURDIR}/stage"
CMAKE_PRESET:=-G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=${STAGEDIR} CMAKE_PRESET:=-G "${GENERATOR}" -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=${STAGEDIR}
#XXX export CXX=clang++ #XXX export CXX=clang++
@ -14,7 +14,7 @@ export CPM_SOURCE_CACHE=${HOME}/.cache/CPM
.PHONY: update format all test standalone doc check clean distclean lock .PHONY: update format all test standalone doc check clean distclean lock
# the default target does just all, but neither standalone nor doc # the default target does just all, but neither standalone nor doc
all: test:
clean: clean:
find . -type d -name build | xargs rm -rf find . -type d -name build | xargs rm -rf
@ -35,9 +35,9 @@ lock: all standalone doc
# install the library to stagedir # install the library to stagedir
install: install:
cmake -S . -B build/$@ ${CMAKE_PRESET} -DCMAKE_INSTALL_PREFIX=${STAGEDIR} -DCMAKE_CXX_STANDARD=20 # --trace-expand cmake -S . -B build/$@ ${CMAKE_PRESET} -DCMAKE_INSTALL_PREFIX=${STAGEDIR} -DCMAKE_CXX_STANDARD=20 #NO! -DCMAKE_CXX_CLANG_TIDY=clang-tidy # --trace-expand
cmake --build build/$@ --target $@ cmake --build build/$@ --target $@
perl -i.bak -pe 's#$$CPM_SOURCE_CACHE-I#-isystem $$1#g' build/install/compile_commands.json perl -i.bak -pe 's#-I($$CPM_SOURCE_CACHE)#-isystem $$1#g' build/install/compile_commands.json
run-clang-tidy.py -p build/$@ source run-clang-tidy.py -p build/$@ source
# test the library # test the library
@ -47,11 +47,11 @@ test: install
cmake --build build/$@ --target $@ cmake --build build/$@ --target $@
# all together # all together
all: test all: #XXX test
cmake -S $@ -B build/$@ ${CMAKE_PRESET} -DENABLE_TEST_COVERAGE=1 -DUSE_STATIC_ANALYZER=clang-tidy cmake -S $@ -B build/$@ ${CMAKE_PRESET} -DENABLE_TEST_COVERAGE=1 -DUSE_STATIC_ANALYZER=clang-tidy
cmake --build build/$@ cmake --build build/$@
cmake --build build/$@ --target test cmake --build build/$@ --target test
# cmake --build build/$@ --target check-format #XXX cmake --build build/$@ --target check-format
# GenerateDocs # GenerateDocs
doc: doc: