Skip to content
Snippets Groups Projects
Commit d7549655 authored by Jens Georg's avatar Jens Georg
Browse files

Ignore files generated by CMake during configure

There are a couple of files in the CMakeFiles folder that will match the
search patterns. This is problematic during package build, since debian
builds in a subfolder of the source folder, so we hit those files and
tests fail
parent d5deebbc
No related branches found
No related tags found
1 merge request!3update project template
......@@ -4,9 +4,15 @@ ERRFILE=`mktemp`
export ERRFILE
echo 0 > "${ERRFILE}"
# This is necessary to get the two paths to match up, since we get a full path from cmake
mypath=$(pwd)
mypath=$(realpath $mypath)
exclude_path=${1:-justignoreme}
exclude_pattern="$exclude_path/*"
# check clang-format formatting
if which clang-format-14 > /dev/null; then
find \( -name *.cc -o -name *.cpp -o -name *.h \) -exec clang-format-14 --output-replacements-xml \{\} \; | grep "^<replacement " > /dev/null
find $mypath \( -name *.cc -o -name *.cpp -o -name *.h \) -not -path "$exclude_pattern" -exec clang-format-14 --output-replacements-xml \{\} \; | grep "^<replacement " > /dev/null
if [ $? -ne 1 ]; then
echo 1 > "${ERRFILE}"
echo "Code formatting incorrect!"
......@@ -30,7 +36,7 @@ checkCopyrightComment() {
fi
}
export -f checkCopyrightComment
find \( -name *.cc -o -name *.cpp -o -name *.h \) -exec bash -c 'checkCopyrightComment {}' \;
find $mypath \( -name *.cc -o -name *.cpp -o -name *.h \) -not -path "$exclude_pattern" -exec bash -c 'checkCopyrightComment {}' \;
# check all header files for "#pragma once" in 3rd line
checkPramgaOnce() {
......@@ -40,7 +46,7 @@ checkPramgaOnce() {
fi
}
export -f checkPramgaOnce
find -name *.h -exec bash -c 'checkPramgaOnce {}' \;
find $mypath -name *.h -not -path "$exclude_pattern" -exec bash -c 'checkPramgaOnce {}' \;
ERROR=`cat "${ERRFILE}"`
rm -f "${ERRFILE}"
......
......@@ -18,5 +18,5 @@
#######################################################################################################################
enable_testing()
add_test(NAME coding_style COMMAND ${CMAKE_SOURCE_DIR}/cmake/check-coding-style.sh
add_test(NAME coding_style COMMAND ${CMAKE_SOURCE_DIR}/cmake/check-coding-style.sh ${CMAKE_BINARY_DIR}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment