From eb8c6aec5500afdb16c9ea36010e3f5c01f5b760 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Sun, 20 Dec 2009 11:16:56 +0200 Subject: [PATCH] CMake - add 'make check' -target. Tests are now excluded from normal targets to make compiling faster. 'make check' -target will compile and run tests. --- CMakeLists.txt | 6 +++++- test/CMakeLists.txt | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 95dea3cce..1e1d1c211 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,9 +16,13 @@ PROJECT(CPPCHECK) ADD_SUBDIRECTORY(lib) ADD_SUBDIRECTORY(cli) -ADD_SUBDIRECTORY(test) + +# Exclude tests from normal targets +# There is 'make check' -target for compiling and running tests +ADD_SUBDIRECTORY(test EXCLUDE_FROM_ALL) # Don't build GUI for Cygwin (most installations don't have QT) IF (NOT CYGWIN) ADD_SUBDIRECTORY(gui) endif (NOT CYGWIN) + diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b0d722c97..c29472fa9 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -52,3 +52,8 @@ include_directories (${CPPCHECK_SOURCE_DIR}/lib) ADD_EXECUTABLE(test ${CHECKTEST_SRCS}) TARGET_LINK_LIBRARIES(test ${CHECK_LIBS}) +# Add custom 'make check' -target +# It compiles and runs tests +add_custom_target(check COMMAND test) +add_dependencies(check test checklib) +