CMakeLists.txt 2.24 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
############################################################################
# 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
19
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 21 22 23 24 25
#
############################################################################

set(TEST_SOURCES
	bzrtpCryptoTest.c
	bzrtpParserTest.c
johan's avatar
johan committed
26
	bzrtpConfigsTest.c
johan's avatar
johan committed
27
	bzrtpZidCacheTest.c
28 29 30 31
	bzrtpTest.c
	testUtils.c
)

32 33 34 35
add_definitions(
	-DBCTBX_LOG_DOMAIN="bzrtp"
)

36
bc_apply_compile_flags(TEST_SOURCES STRICT_OPTIONS_CPP)
37

38
add_executable(bzrtpTest ${TEST_SOURCES})
39
set_target_properties(bzrtpTest PROPERTIES LINK_FLAGS "${LINK_FLAGS}")
Ghislain MARY's avatar
Ghislain MARY committed
40
set_target_properties(bzrtpTest PROPERTIES LINKER_LANGUAGE CXX)
41
target_include_directories(bzrtpTest PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIR})
Ghislain MARY's avatar
Ghislain MARY committed
42 43 44 45 46
if(ENABLE_STATIC)
	target_link_libraries(bzrtpTest bzrtp-static)
else()
	target_link_libraries(bzrtpTest bzrtp)
endif()
Ghislain MARY's avatar
Ghislain MARY committed
47
target_link_libraries(bzrtpTest ${BCTOOLBOX_LIBRARIES})
johan's avatar
johan committed
48
if(SQLITE3_FOUND)
Ghislain MARY's avatar
Ghislain MARY committed
49
	target_include_directories(bzrtpTest PUBLIC ${SQLITE3_INCLUDE_DIRS})
johan's avatar
johan committed
50
	target_link_libraries(bzrtpTest ${SQLITE3_LIBRARIES})
51 52 53
if(XML2_FOUND)
	target_link_libraries(bzrtpTest ${XML2_LIBRARIES})
endif()
54
endif()
Ghislain MARY's avatar
Ghislain MARY committed
55 56 57
if(HAVE_SQRT)
	target_link_libraries(bzrtpTest m)
endif()
johan's avatar
johan committed
58 59

unset(PATTERN_FILES_IN_TEST_DIR CACHE)
jehan's avatar
jehan committed
60 61 62 63 64 65
find_file(PATTERN_FILES_IN_TEST_DIR
       patternZIDAlice.sqlite ${CMAKE_CURRENT_BINARY_DIR}
)
if (NOT PATTERN_FILES_IN_TEST_DIR)
       file(COPY patternZIDAlice.sqlite DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
endif()
Johan Pascal's avatar
Johan Pascal committed
66 67

add_test(NAME bzrtpTest COMMAND bzrtpTest --resource-dir .)