phoenix_base_project.cmake 1.91 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
	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")

		set(SELF_TESTS_MODE yes CACHE BOOL "Self test mode")
		message(STATUS "SELF_TESTS_MODE = ${SELF_TESTS_MODE}")
		
		
		set(PHOENIX_FORCE_PULL_MODULE no CACHE BOOL "Say if the submodule have to be pulled every time or not")
		
Pierre Aubert's avatar
Pierre Aubert committed
27 28 29 30
		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
31
			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
32
		else()
Pierre Aubert's avatar
Pierre Aubert committed
33
			set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -Wall -Werror -g -O2" PARENT_SCOPE)
Pierre Aubert's avatar
Pierre Aubert committed
34 35 36
		endif()
		
		add_definitions(-D__PROGRAM_VERSION__="${PROGRAM_VERSION}")
Pierre Aubert's avatar
Pierre Aubert committed
37 38 39 40 41 42 43 44 45
		
		if(DOC_MODE)
			add_subdirectory(doc)
		endif()
		createLinuxPackages()
	endif()
endfunction(phoenix_base_project)