From c24a18cbfd27603dc9d48aa6fe8f90e8be612fc1 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 19 Oct 2012 19:06:50 +0200 Subject: [PATCH] cmake: Cleanup testing and enable test target. --- CMakeLists.txt | 5 ++++- cmake/Modules/MacroAddCheckTest.cmake | 22 ---------------------- cmake/Modules/MacroCheckTest.cmake | 22 ---------------------- tests/CMakeLists.txt | 2 -- 4 files changed, 4 insertions(+), 47 deletions(-) delete mode 100644 cmake/Modules/MacroAddCheckTest.cmake delete mode 100644 cmake/Modules/MacroCheckTest.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 12903196c..7f4e2d310 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,10 @@ include(MacroAddPlugin) include(MacroCopyFile) find_package(Log4C) +find_package(CMocka) +if (CMOCKA_FOUND AND UNIT_TESTING) + include(AddCMockaTest) +endif (CMOCKA_FOUND AND UNIT_TESTING) include(ConfigureChecks.cmake) configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) @@ -57,7 +61,6 @@ add_subdirectory(client) add_subdirectory(config) add_subdirectory(doc) -find_package(CMocka) if (CMOCKA_FOUND AND UNIT_TESTING) add_subdirectory(tests) endif (CMOCKA_FOUND AND UNIT_TESTING) diff --git a/cmake/Modules/MacroAddCheckTest.cmake b/cmake/Modules/MacroAddCheckTest.cmake deleted file mode 100644 index 7068b94e1..000000000 --- a/cmake/Modules/MacroAddCheckTest.cmake +++ /dev/null @@ -1,22 +0,0 @@ -# - MACRO_ADD_CHECK_TEST(test_name test_source linklib1 ... linklibN) - -# Copyright (c) 2007, Daniel Gollub, -# Copyright (c) 2007, Andreas Schneider, -# -# 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") - -macro (MACRO_ADD_CHECK_TEST _testName _testSource) - add_executable(${_testName} ${_testSource}) - target_link_libraries(${_testName} ${ARGN}) - add_test(${_testName} ${CMAKE_CURRENT_BINARY_DIR}/${_testName}) -endmacro (MACRO_ADD_CHECK_TEST) - diff --git a/cmake/Modules/MacroCheckTest.cmake b/cmake/Modules/MacroCheckTest.cmake deleted file mode 100644 index 7068b94e1..000000000 --- a/cmake/Modules/MacroCheckTest.cmake +++ /dev/null @@ -1,22 +0,0 @@ -# - MACRO_ADD_CHECK_TEST(test_name test_source linklib1 ... linklibN) - -# Copyright (c) 2007, Daniel Gollub, -# Copyright (c) 2007, Andreas Schneider, -# -# 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") - -macro (MACRO_ADD_CHECK_TEST _testName _testSource) - add_executable(${_testName} ${_testSource}) - target_link_libraries(${_testName} ${ARGN}) - add_test(${_testName} ${CMAKE_CURRENT_BINARY_DIR}/${_testName}) -endmacro (MACRO_ADD_CHECK_TEST) - diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 716a062a6..565f2672a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,7 +1,5 @@ project(tests C) -include(AddCMockaTest) - set(TORTURE_LIBRARY torture) include_directories(