phoenix_base_project.cmake 2.11 KB
Newer Older
Pierre Aubert's avatar
Pierre Aubert committed
1

Pierre Aubert's avatar
Pierre Aubert committed
2
include(create_version.cmake)
Pierre Aubert's avatar
Pierre Aubert committed
3 4 5 6 7 8 9

# Define the base of a Phoenix project
# 	programName : name of the program/library
# 	programVersion : version of the program/library
# 	programDescritpion : description of the program/library
# 	programHomePage : home page of the program/library
function(phoenix_base_project programName programVersion programDescritpion programHomePage)
Pierre Aubert's avatar
Pierre Aubert committed
10
	create_version("${programName}" "${programVersion}")
Pierre Aubert's avatar
Pierre Aubert committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
	if(NOT MODULE_MODE)
		set(PROGRAM_NAME "${programName}" CACHE STRING "name of the current project" FORCE)
		set(PROGRAM_VERSION "${programVersion}" CACHE STRING "version of the current project" FORCE)
		set(PROGRAM_DESCRIPTION_NO_QUOTE "${programDescritpion}" CACHE STRING "description of the current project" FORCE)
		set(PROGRAM_DESCRIPTION "\"${PROGRAM_DESCRIPTION_NO_QUOTE}\"" CACHE STRING "description with double quotes of the current project" FORCE)
		set(PROGRAM_HOMEPAGE "${programHomePage}" CACHE STRING "home page of the current project" FORCE)
		set(LIBRARY_DIRECTORY "lib" CACHE STRING "define the library directory (especially for Fedora with the wtf lib64)" FORCE)

		set(DOC_MODE no CACHE BOOL "Doc mode")
		message(STATUS "DOC_MODE = ${DOC_MODE}")
		
		set(SELF_TESTS_MODE yes CACHE BOOL "Self test mode")
		message(STATUS "SELF_TESTS_MODE = ${SELF_TESTS_MODE}")
		set(VALGRIND_TEST yes CACHE BOOL "enable test with valgrind")
		message(STATUS "VALGRIND_TEST = ${VALGRIND_TEST}")
		
		
		set(PHOENIX_FORCE_PULL_MODULE no CACHE BOOL "Say if the submodule have to be pulled every time or not")
		
		add_definitions(--std=c++11 -Wall -Werror -g -O2 -D__PROGRAM_VERSION__="${PROGRAM_VERSION}")
		
		if(CMAKE_BUILD_TYPE STREQUAL "Coverage")
			message(STATUS "Build for tests COVERAGE")
			set(CTEST_COVERAGE_COMMAND "gcov")
			set(SELF_TESTS_MODE yes)
Pierre Aubert's avatar
Pierre Aubert committed
36
			set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -Wall -Werror -g -O0  -fprofile-arcs -ftest-coverage" PARENT_SCOPE)
Pierre Aubert's avatar
Pierre Aubert committed
37
		else()
Pierre Aubert's avatar
Pierre Aubert committed
38
			set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -Wall -Werror -g -O2" PARENT_SCOPE)
Pierre Aubert's avatar
Pierre Aubert committed
39 40 41 42 43 44 45 46 47
		endif()
		
		add_definitions(-D__PROGRAM_VERSION__="${PROGRAM_VERSION}")
		
		createLinuxPackages()
	endif()
endfunction(phoenix_base_project)