diff --git a/cmake/clang-cpp-tools.cmake b/cmake/clang-cpp-tools.cmake index 5121f1b9..74f4010b 100644 --- a/cmake/clang-cpp-tools.cmake +++ b/cmake/clang-cpp-tools.cmake @@ -2,14 +2,15 @@ # Additional targets to perform clang-format/clang-tidy # -file(GLOB_RECURSE SOURCE_FILES *.[chi]pp) +file(GLOB_RECURSE header_files ${PROJECT_SOURCE_DIR}/include/*.hpp) +file(GLOB_RECURSE source_files ${PROJECT_SOURCE_DIR}/src/*.cpp) # Add clang-format target if executable is found # -------------------------------------------------- find_program(CLANG_FORMAT "clang-format") if(CLANG_FORMAT) - add_custom_target(clang-format COMMAND - ${CLANG_FORMAT} -i -style=file ${SOURCE_FILES}) + add_custom_target(clang-format COMMAND ${CLANG_FORMAT} + -i -style=file ${header_files} ${source_files}) endif() # Add clang-tidy target if executable is found @@ -17,6 +18,5 @@ endif() find_program(CLANG_TIDY "clang-tidy") if(CLANG_TIDY) add_custom_target(clang-tidy COMMAND ${CLANG_TIDY} - ${SOURCE_FILES} -config='' -- -std=c++11 - ${INCLUDE_DIRECTORIES}) + -p ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/src/main.cpp) endif()