diff options
author | Andreas Schneider <mail@cynapses.org> | 2010-03-02 13:47:14 +0100 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2010-03-02 13:54:14 +0100 |
commit | 464176d5111676161d809ac3f5aeaa0f9fb2ff5b (patch) | |
tree | f9ca2912faa6b68e23603438fc5f13ad19702789 /cmake/Modules/AddCheckTest.cmake | |
parent | e8a1d135e21721426851312dc2a9180e5c38273f (diff) | |
download | libssh-464176d5111676161d809ac3f5aeaa0f9fb2ff5b.tar.gz libssh-464176d5111676161d809ac3f5aeaa0f9fb2ff5b.tar.xz libssh-464176d5111676161d809ac3f5aeaa0f9fb2ff5b.zip |
Added unit testing support using check.
Diffstat (limited to 'cmake/Modules/AddCheckTest.cmake')
-rw-r--r-- | cmake/Modules/AddCheckTest.cmake | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cmake/Modules/AddCheckTest.cmake b/cmake/Modules/AddCheckTest.cmake new file mode 100644 index 0000000..089a09c --- /dev/null +++ b/cmake/Modules/AddCheckTest.cmake @@ -0,0 +1,22 @@ +# - ADD_CHECK_TEST(test_name test_source linklib1 ... linklibN) + +# Copyright (c) 2007, Daniel Gollub, <dgollub@suse.de> +# Copyright (c) 2007, Andreas Schneider, <mail@cynapses.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +enable_testing() +include(CTest) + +set(CMAKE_C_FLAGS_PROFILING "-g -O0 -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wwrite-strings -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Compiler Flags") +set(CMAKE_SHARED_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags") +set(CMAKE_MODULE_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags") +set(CMAKE_EXEC_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags") + +function (ADD_CHECK_TEST _testName _testSource) + add_executable(${_testName} ${_testSource}) + target_link_libraries(${_testName} ${ARGN}) + add_test(${_testName} ${CMAKE_CURRENT_BINARY_DIR}/${_testName}) +endfunction (ADD_CHECK_TEST) + |