CMakeLists.txt 2.03 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
############################################################################
# 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(TEST_SOURCES
	bzrtpCryptoTest.c
	bzrtpParserTest.c
	bzrtpTest.c
	testUtils.c

29 30 31 32 33 34
	../src/bzrtp.c
	../src/cryptoUtils.c
	../src/packetParser.c
	../src/pgpwords.c
	../src/stateMachine.c
	../src/zidCache.c
35 36
)

johan's avatar
johan committed
37 38 39 40 41 42 43 44 45 46 47 48
if (POLARSSL_FOUND)
	set(TEST_SOURCES
		${TEST_SOURCES}
		../src/cryptoPolarssl.c
	)
elseif (MBEDTLS_FOUND)
	set(TEST_SOURCES
		${TEST_SOURCES}
		../src/cryptoMbedtls.c
	)
endif()

49 50
apply_compile_flags(TEST_SOURCES "CPP")

51 52
add_executable(bzrtpTest ${TEST_SOURCES})
set_target_properties(bzrtpTest PROPERTIES LINK_FLAGS "${LINK_FLAGS}")
53
target_include_directories(bzrtpTest PUBLIC ${CUNIT_INCLUDE_DIR})
54
target_link_libraries(bzrtpTest ${CUNIT_LIBRARIES} bzrtp)
55 56 57
if(HAVE_SQRT)
	target_link_libraries(bzrtpTest m)
endif()
johan's avatar
johan committed
58 59 60 61 62 63 64 65 66 67 68

unset(PATTERN_FILES_IN_TEST_DIR CACHE)
find_file(PATTERN_FILES_IN_TEST_DIR
	ZIDAlice.txt ${CMAKE_CURRENT_BINARY_DIR}
)
if (NOT PATTERN_FILES_IN_TEST_DIR)
	file(COPY ZIDAlice.txt DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
	file(COPY ZIDBob.txt DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
endif()


69
add_test(NAME bzrtpTest COMMAND bzrtpTest)