view CMakeLists.txt @ 224:ca69910b1407

Parser: add tests (and fix #270)
author David Demelier <markand@malikania.fr>
date Fri, 09 May 2014 09:15:52 +0200
parents c6513d9c696b
children e01ee0c72c43
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}
	)

	# Get rid of cppunit warning shit
	if (NOT WIN32)
		target_compile_options(${name} PRIVATE "-Wno-unused-parameter")
	endif()

	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_DIRECTORY)
	add_subdirectory(C++/Tests/Directory)
endif ()

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

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

if (WITH_PACK)
	add_subdirectory(C++/Tests/Pack)
endif ()

if (WITH_PARSER)
	add_subdirectory(C++/Tests/Parser)
endif ()