endif (WITH_DOCUMENTATION)
#===========================================================================================================
+build_flag (WITH_CPPCHECK "Run cppcheck during build (requires cppcheck)" OFF)
+# add build target 'cppcheck' to run pre-defined configuration of cppcheck
+#===========================================================================================================
+if (WITH_CPPCHECK)
+ set(CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}; cppcheck <SOURCE> ${CPPCHECK_CONFIG_STRING}")
+ set(CMAKE_CXX_COMPILE_OBJECT "${CMAKE_CXX_COMPILE_OBJECT}; cppcheck <SOURCE> ${CPPCHECK_CONFIG_STRING}")
+endif (WITH_CPPCHECK)
+add_custom_target(cppcheck COMMAND cppcheck ${CMAKE_SOURCE_DIR}/LayerManager*/ ${CPPCHECK_CONFIG})
+
+#===========================================================================================================
build_flag (WITH_TESTS "Build unit test binaries for all enabled components" OFF)
#===========================================================================================================
if (WITH_TESTS)
# store used build configuration
#===========================================================================================================
add_subdirectory_once(config)
+
set (BUILD_FLAG_LIST "" CACHE INTERNAL "list of build flag names")
set (BUILD_FLAG_ARRAY "" CACHE INTERNAL "array of build flags for logging")
+
+#==============================================================================
+# cppcheck configuration
+#==============================================================================
+set (CPPCHECK_CONFIG
+ --quiet
+ --enable=performance,portability
+ --template='{file}:{line}: warning: {message} [{severity}]'
+)
+
+FOREACH (ARG ${CPPCHECK_CONFIG})
+ set (CPPCHECK_CONFIG_STRING "${CPPCHECK_CONFIG_STRING} ${ARG}")
+ENDFOREACH(ARG)
+