diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2020-05-22 14:08:39 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2020-05-24 07:38:12 (GMT) |
commit | 57730818727420a23e63917e3d035df3926b958f (patch) | |
tree | d2e7d58a10416bff524059ac4027580089fc7dc7 /cmake | |
parent | e3470060b067bbb5d949de01758aff491fc804c3 (diff) | |
download | Doxygen-57730818727420a23e63917e3d035df3926b958f.zip Doxygen-57730818727420a23e63917e3d035df3926b958f.tar.gz Doxygen-57730818727420a23e63917e3d035df3926b958f.tar.bz2 |
Refactoring: Removed creation of MemberDef's for macro definitions from pre.l
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/CompilerWarnings.cmake | 4 | ||||
-rw-r--r-- | cmake/Coverage.cmake | 39 | ||||
-rw-r--r-- | cmake/SearchReplace.cmake | 4 |
3 files changed, 45 insertions, 2 deletions
diff --git a/cmake/CompilerWarnings.cmake b/cmake/CompilerWarnings.cmake index e6c1539..8137f6f 100644 --- a/cmake/CompilerWarnings.cmake +++ b/cmake/CompilerWarnings.cmake @@ -100,9 +100,9 @@ function(set_project_warnings project_name) if(MSVC) set(PROJECT_WARNINGS ${MSVC_WARNINGS}) - elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + elseif(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") # e.g. Clang or AppleClang set(PROJECT_WARNINGS ${CLANG_WARNINGS}) - else() + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "7.0.0") set(GCC_EXTRA_WARNINGS -Wno-implicit-fallthrough diff --git a/cmake/Coverage.cmake b/cmake/Coverage.cmake new file mode 100644 index 0000000..31f8341 --- /dev/null +++ b/cmake/Coverage.cmake @@ -0,0 +1,39 @@ +if(enable_coverage) + FIND_PROGRAM( LCOV_PATH lcov ) + FIND_PROGRAM( GENHTML_PATH genhtml ) + set(COVERAGE_COMPILER_FLAGS -g --coverage -O0 + CACHE INTERNAL "") + set(COVERAGE_LINKER_FLAGS --coverage + CACHE INTERNAL "") + add_custom_target(coverage-clean + COMMAND ${LCOV_PATH} --rc lcov_branch_coverage=1 --directory . --zerocounters + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + ) + add_custom_target(coverage + COMMAND ${LCOV_PATH} --rc lcov_branch_coverage=1 --directory . --capture --output-file cov.info + COMMAND ${LCOV_PATH} --rc lcov_branch_coverage=1 --remove cov.info '*/c++/*' '*/_ctype.h' '*/generated_src/*' --output-file cov.info.cleaned + COMMAND ${CMAKE_COMMAND} -Dsearch=${CMAKE_BINARY_DIR} + -Dreplace=${CMAKE_SOURCE_DIR} + -Dsrc=cov.info.cleaned + -Ddst=cov.info.final + -P ${CMAKE_SOURCE_DIR}/cmake/SearchReplace.cmake + COMMAND ${GENHTML_PATH} --rc genhtml_branch_coverage=1 + --function-coverage --branch-coverage + --title "Doxygen Coverage Report" --num-spaces 2 + --legend --prefix ${CMAKE_SOURCE_DIR} --demangle-cpp + --output-directory cov_output cov.info.final + COMMAND ${CMAKE_COMMAND} -E remove cov.info cov.info.cleaned cov.info.final + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + ) + add_custom_command(TARGET coverage POST_BUILD + COMMAND ; + COMMENT "Open ./cov_output/index.html in your browser to view the coverage report" + ) +endif() + +function(set_project_coverage project_name) + if(enable_coverage) + target_compile_options(${project_name} PRIVATE ${COVERAGE_COMPILER_FLAGS}) + endif() +endfunction() + diff --git a/cmake/SearchReplace.cmake b/cmake/SearchReplace.cmake new file mode 100644 index 0000000..116cd71 --- /dev/null +++ b/cmake/SearchReplace.cmake @@ -0,0 +1,4 @@ +message("Replacing ${search} by ${replace} in file ${src} and writing to ${dst}...") +file(READ ${src} file_contents) +string(REPLACE "${search}" "${replace}" file_contents ${file_contents}) +file(WRITE ${dst} ${file_contents}) |