Debian Codegraph @

cmake/Modules/MacroAddUnitTest.cmake

raw
1 # - MACRO_ADD_UNIT_TEST(test_name test_source linklib1 ... linklibN)
2
3 # Copyright (c) 2007, Daniel Gollub, <[email protected]>
4 # Copyright (c) 2007, Andreas Schneider, <[email protected]>
5 #
6 # Redistribution and use is allowed according to the terms of the BSD license.
7 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
8
9 enable_testing()
10 include(CTest)
11
12 #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")
13 #set(CMAKE_SHARED_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags")
14 #set(CMAKE_MODULE_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags")
15 #set(CMAKE_EXEC_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags")
16
17 # custom options
18 configure_file(tests/CTestCustom.cmake ${PROJECT_BINARY_DIR}/CTestCustom.cmake COPYONLY)
19
20 macro (MACRO_ADD_UNIT_TEST _testName _testSource)
21 add_executable(${_testName} ${_testSource})
22 target_link_libraries(${_testName} ${ARGN})
23 macro_add_test(NAME ${_testName} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${_testName})
24 endmacro (MACRO_ADD_UNIT_TEST)