phoenix_base_project.cmake 2.15 KB
Newer Older
Pierre Aubert's avatar
Pierre Aubert committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30


# 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)
	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_INSTALL_PREFIX "$ENV{HOME}/usr" CACHE STRING "Install prefix")
		
		if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
			set(CMAKE_INSTALL_PREFIX "${PHOENIX_INSTALL_PREFIX}" CACHE PATH "cmake install prefix" FORCE)
		endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
		
		set(CMAKE_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/share/cmake CACHE STRING "cmake module path")
		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
31 32 33 34 35 36 37 38 39 40
		if(CMAKE_BUILD_TYPE STREQUAL "Coverage")
			message(STATUS "Build for tests COVERAGE")
			set(CTEST_COVERAGE_COMMAND "gcov")
			set(SELF_TESTS_MODE yes)
			set(CMAKE_CXX_FLAGS "--std=c++11 -Wall -Werror -g -O0  -fprofile-arcs -ftest-coverage" PARENT_SCOPE)
		else()
			set(CMAKE_CXX_FLAGS "--std=c++11 -Wall -Werror -g -O2" PARENT_SCOPE)
		endif()
		
		add_definitions(-D__PROGRAM_VERSION__="${PROGRAM_VERSION}")
Pierre Aubert's avatar
Pierre Aubert committed
41 42 43 44 45 46 47 48 49
		
		if(DOC_MODE)
			add_subdirectory(doc)
		endif()
		createLinuxPackages()
	endif()
endfunction(phoenix_base_project)