view CMakeLists.txt @ 221:6a664378c5c4

Hash: add unit tests
author David Demelier <markand@malikania.fr>
date Thu, 08 May 2014 23:15:21 +0200
parents 8fc177bbc4a6
children 5a99711d52f9
line wrap: on
line source

#
# CMakeLists.txt -- code building for common code
#
# Copyright (c) 2014 David Demelier <markand@malikania.fr>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#

#
# This CMakeLists build system is primarily used for testing all
# modules.
#
cmake_minimum_required(VERSION 2.8.11)
project(code)

set(CMAKE_MODULE_PATH ${code_SOURCE_DIR}/cmake)

enable_testing()

include_directories(
	${code_SOURCE_DIR}/C++
)

# Cppunit is the unit tester
find_package(Cppunit REQUIRED)

function(define_test name sources)
# The executable
	add_executable(
		${name}
		${sources}
	)

	target_include_directories(${name} PRIVATE ${CPPUNIT_INCLUDE_DIR})
	target_link_libraries(${name} ${CPPUNIT_LIBRARY})
	add_test(${name}-test ${name})
endfunction()

option(WITH_CONVERTER "Enable converter tests" On)
option(WITH_DIRECTORY "Enable directory tests" On)
option(WITH_DRIVER "Enable SQL drivers tests" On)
option(WITH_DYNLIB "Enable DynLib tests" On)
option(WITH_HASH "Enable hash functions tests" On)
option(WITH_LUAE "Enable Luae tests" On)
option(WITH_PACK "Enable pack functions" On)
option(WITH_PARSER "Enable parser tests" On)
option(WITH_SOCKET "Enable sockets tests" On)
option(WITH_UTF8 "Enable Utf8 functions tests" On)
option(WITH_XMLPARSER "Enable XML tests" On)

if (WITH_DYNLIB)
	add_subdirectory(C++/Tests/DynLib)
endif ()

if (WITH_HASH)
	add_subdirectory(C++/Tests/Hash)
endif ()