Commit 8ace78e2 authored by Ghislain MARY's avatar Ghislain MARY

Handle compilation of unit tests with CMake.

parent 0ffba34f
......@@ -55,6 +55,7 @@ cmake_dependent_option(ENABLE_ASSISTANT "Turn on assistant compiling." YES "ENAB
list(APPEND CMAKE_MODULE_PATH ${CMAKE_PREFIX_PATH}/share/cmake/Modules)
include(CheckIncludeFile)
include(CheckLibraryExists)
if(MSVC)
list(APPEND CMAKE_REQUIRED_INCLUDES ${CMAKE_PREFIX_PATH}/include/MSVC)
......@@ -63,6 +64,16 @@ endif()
find_package(BelleSIP REQUIRED)
find_package(MS2 REQUIRED)
find_package(XML2 REQUIRED)
if(ENABLE_UNIT_TESTS)
find_package(CUnit)
if(CUNIT_FOUND)
check_library_exists("cunit" "CU_get_suite" "" HAVE_CU_GET_SUITE)
check_library_exists("cunit" "CU_curses_run_tests" "" HAVE_CU_CURSES)
else()
message(WARNING "Could not find the cunit library!")
set(ENABLE_UNIT_TESTS OFF CACHE BOOL "Enable compilation of unit tests." FORCE)
endif()
endif()
if(ENABLE_TUNNEL)
find_package(Tunnel)
if(NOT TUNNEL_FOUND)
......@@ -114,6 +125,9 @@ endif()
if(ENABLE_TOOLS)
add_subdirectory(tools)
endif()
if(ENABLE_UNIT_TESTS)
add_subdirectory(tester)
endif()
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/FindLinphone.cmake
......
......@@ -35,3 +35,6 @@
#define PACKAGE_LOCALE_DIR "${PACKAGE_LOCALE_DIR}"
#define PACKAGE_DATA_DIR "${PACKAGE_DATA_DIR}"
#define PACKAGE_SOUND_DIR "${PACKAGE_SOUND_DIR}"
#cmakedefine HAVE_CU_GET_SUITE 1
#cmakedefine HAVE_CU_CURSES 1
\ No newline at end of file
......@@ -65,6 +65,7 @@ set(SOURCE_FILES
linphonefriend.h
linphone_tunnel_config.c
linphone_tunnel.h
localplayer.c
lpconfig.c
lpconfig.h
lsd.c
......@@ -84,7 +85,8 @@ set(SOURCE_FILES
sipsetup.h
xml2lpc.c
xml2lpc.h
xml.c)
xml.c
)
if(ENABLE_TUNNEL)
list(APPEND SOURCE_FILES
linphone_tunnel.cc
......
......@@ -20,7 +20,7 @@
#
############################################################################
find_package(GTK2 2.10 REQUIRED gtk)
find_package(GTK2 2.18 REQUIRED gtk)
set(UI_FILES
about.ui
......
############################################################################
# CMakeLists.txt
# Copyright (C) 2014 Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
############################################################################
set(SOURCE_FILES
call_tester.c
dtmf_tester.c
eventapi_tester.c
flexisip_tester.c
liblinphone_tester.c
log_collection_tester.c
message_tester.c
player_tester.c
presence_tester.c
quality_reporting_tester.c
register_tester.c
remote_provisioning_tester.c
setup_tester.c
stun_tester.c
tester.c
transport_tester.c
upnp_tester.c
)
add_executable(liblinphone_tester ${SOURCE_FILES})
target_include_directories(liblinphone_tester PUBLIC ${CUNIT_INCLUDE_DIRS})
target_link_libraries(liblinphone_tester linphone ${CUNIT_LIBRARIES})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment