1- # - ADD_CHECK_TEST (test_name test_source linklib1 ... linklibN)
1+ # - add_cmocka_test (test_name test_source linklib1 ... linklibN)
22
33# Copyright (c) 2007 Daniel Gollub <dgollub@suse.de>
4- # Copyright (c) 2007-2010 Andreas Schneider <asn@cryptomilk.org>
4+ # Copyright (c) 2007-2018 Andreas Schneider <asn@cryptomilk.org>
55#
66# Redistribution and use is allowed according to the terms of the BSD license.
77# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
88
99enable_testing ()
1010include (CTest )
1111
12- if (CMAKE_COMPILER_IS_GNUCC AND NOT MINGW)
13- # Profiling
14- 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" )
15- set (CMAKE_SHARED_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags" )
16- set (CMAKE_MODULE_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags" )
17- set (CMAKE_EXEC_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags" )
18-
19- # Address Sanitizer
20- set (CMAKE_C_FLAGS_ADDRESSSANITIZER "-g -O1 -fsanitize=address -fno-omit-frame-pointer" CACHE STRING "Address sanitizer compiler flags" )
21- set (CMAKE_SHARED_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address" CACHE STRING "Address sanitizer shared linker flags" )
22- set (CMAKE_MODULE_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address" CACHE STRING "Address sanitizer module linker flags" )
23- set (CMAKE_EXEC_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address" CACHE STRING "Address sanitizer executable linker flags" )
24- endif (CMAKE_COMPILER_IS_GNUCC AND NOT MINGW )
25-
2612if (CMAKE_CROSSCOMPILING )
2713 if (WIN32 )
2814 find_program (WINE_EXECUTABLE
@@ -31,8 +17,10 @@ if (CMAKE_CROSSCOMPILING)
3117 endif ()
3218endif ()
3319
34- function (ADD_CMOCKA_TEST _testName _testSource )
20+ function (ADD_CMOCKA_TEST _testName _testSource )
3521 add_executable (${_testName} ${_testSource} )
22+
3623 target_link_libraries (${_testName} ${ARGN} )
24+
3725 add_test (${_testName} ${TARGET_SYSTEM_EMULATOR} ${CMAKE_CURRENT_BINARY_DIR} /${_testName}${CMAKE_EXECUTABLE_SUFFIX} )
3826endfunction (ADD_CMOCKA_TEST )
0 commit comments