view CMakeLists.txt @ 253:a4770082e7d6

TreeNode: forget to return this
author David Demelier <markand@malikania.fr>
date Thu, 02 Oct 2014 11:45:24 +0200
parents 0b7566e27eaa
children 4ad3c85ab73e
line wrap: on
line source

#
# CMakeLists.txt -- code building for common code
#
# Copyright (c) 2013, 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++
)

# GoogleTest library
add_subdirectory(extern)

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

	target_link_libraries(${name} gtest)
	add_test(${name}-test ${name})
endfunction()

option(WITH_BASE64 "Enable base64 tests" On)
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_OPTIONPARSER "Enable option parser 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_TREENODE "Enable treenode tests" On)
option(WITH_UTF8 "Enable Utf8 functions tests" On)
option(WITH_XMLPARSER "Enable XML tests" On)

if (UNIX)
	option(WITH_XDG "Enable XDG standard directories tests" On)
endif ()

if (WITH_BASE64)
	add_subdirectory(C++/Tests/Base64)
endif ()

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

if (WITH_OPTIONPARSER)
	add_subdirectory(C++/Tests/OptionParser)
endif ()

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

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

if (WITH_TREENODE)
	add_subdirectory(C++/Tests/TreeNode)
endif ()

if (WITH_XDG AND UNIX)
	add_subdirectory(C++/Tests/Xdg)
endif ()