CMakeLists.txt 2.87 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
############################################################################
# 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.
#
############################################################################

23
cmake_minimum_required(VERSION 2.8.12)
24 25 26 27 28
project(CUNIT C)


set(PACKAGE "CUnit")
set(PACKAGE_NAME "${PACKAGE}")
François Grisez's avatar
François Grisez committed
29 30 31
set(VERSION "2.1")
set(RELEASE "2")
set(PACKAGE_VERSION "${VERSION}-${RELEASE}")
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "")
set(PACKAGE_TARNAME "cunit")
set(PACKAGE_URL "")


option(ENABLE_AUTOMATED "Compile CUnit automated interface" ON)
option(ENABLE_BASIC "Compile CUnit basic interface" ON)
option(ENABLE_CONSOLE "Compile CUnit console interface" ON)
option(ENABLE_CURSES "Compile CUnit curses interface" OFF)
option(ENABLE_EXAMPLES "Compile CUnit example programs" OFF)
option(ENABLE_TEST "Compile CUnit internal test program" OFF)
option(ENABLE_MEMTRACE "Enable CUnit internal memory tracking" OFF)
option(ENABLE_DEPRECATED "Enable use of deprecated v1.1 names" OFF)

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)


set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix ${prefix}/bin)
set(libdir ${prefix}/lib)
set(includedir ${prefix}/include)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cunit.pc.in ${CMAKE_CURRENT_BINARY_DIR}/cunit.pc)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cunit.pc DESTINATION lib/pkgconfig)


Ghislain MARY's avatar
Ghislain MARY committed
58 59
if(MSVC)
	add_definitions("/W3")
60
else()
Ghislain MARY's avatar
Ghislain MARY committed
61
	add_definitions("-Wall -W -pedantic -Wshadow -ansi -std=c99")
62
endif()
63

64
if(ENABLE_MEMTRACE)
65
	add_definitions(-DMEMTRACE)
66
endif()
67
if(ENABLE_DEPRECATED)
68
	add_definitions(-DUSE_DEPRECATED_CUNIT_NAMES)
69
endif()
70
if(ENABLE_CURSES)
71 72
	set(CURSES_NEED_NCURSES 1)
	find_package(Curses)
73
	if(NOT CURSES_FOUND)
74 75
		message("Disabling curses as it has not been found!")
		set(ENABLE_CURSES 0)
76 77
	endif()
endif()
78 79 80 81

include_directories(
	CUnit/Headers
	${CMAKE_CURRENT_BINARY_DIR}
François Grisez's avatar
François Grisez committed
82
	${CMAKE_CURRENT_BINARY_DIR}/CUnit/Headers
83 84 85 86 87 88 89
)


add_subdirectory(CUnit)
add_subdirectory(doc)
add_subdirectory(Man)
add_subdirectory(Share)
90
if(ENABLE_EXAMPLES)
91
	add_subdirectory(Examples)
92
endif()