createLinuxPackages.cmake 2.36 KB
Newer Older
Pierre Aubert's avatar
Pierre Aubert committed
1 2 3

# Commands to create debian package with cmake

Pierre Aubert's avatar
Pierre Aubert committed
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 31
function(createLinuxPackages)
	if(NOT MODULE_MODE)
		set(CPACK_PACKAGE_NAME "${PROGRAM_NAME}" CACHE STRING "Name of the program")

		set(CPACK_PACKAGE_VERSION "${PROGRAM_VERSION}" CACHE STRING "Version of the program")
		set(CPACK_PACKAGE_VENDOR "Pierre Aubert" CACHE STRING "Vendor of the program")
		set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${PROGRAM_DESCRIPTION_NO_QUOTE} CACHE STRING "Description of the program")

		set(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/README.md CACHE STRING "DOC of the program")
		set(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_SOURCE_DIR}/README.md CACHE STRING "Welcome of the program")
		set(CPACK_PACKAGE_HOMEPAGE_URL ${PROGRAM_HOMEPAGE} CACHE STRING "Homepage of the program")
		set(CPACK_PACKAGE_CONTACT "pierre.aubert@lapp.in2p3.fr" CACHE STRING "Contact of the program")
		set(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/doc/icon.bmp CACHE STRING "Icon of the program")
		set(CPACK_PACKAGE_DESCRIPTION ${PROGRAM_DESCRIPTION_NO_QUOTE} CACHE STRING "Desription with quote of the program")

		if(CREATE_DEB)					#Ok for UBUNTU
			set(CPACK_GENERATOR "DEB" CACHE STRING "Package type of the program")
			set(CPACK_DEBIAN_PACKAGE_VERSION "${PROGRAM_VERSION}" CACHE STRING "Version of the program")
			set(CPACK_DEBIAN_PACKAGE_MAINTAINER "pierre.aubert@lapp.in2p3.fr" CACHE STRING "Package maintainer of the program") #required
			
			set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${PROGRAM_HOMEPAGE} CACHE STRING "Homepage of the program")	#For the debian installer only
			set(CPACK_DEBIAN_PACKAGE_DEPENDS "" CACHE STRING "Depends of the program")
		endif(CREATE_DEB)

		if(CREATE_RPM)	#Need to install rmp package on ubuntu which contains rpmbuild
			set(CPACK_GENERATOR "RPM" CACHE STRING "Package type of the program")
			set(CPACK_RPM_PACKAGE_AUTOREQ "NO" CACHE STRING "Caracteristics of the program")
			set(CPACK_RPM_PACKAGE_REQUIRES "" CACHE STRING "Depends of the program")
Pierre Aubert's avatar
Pierre Aubert committed
32
			set(LIBRARY_DIRECTORY "lib64" CACHE STRING "define the library directory (especially for Fedora with the wtf lib64)" FORCE)
Pierre Aubert's avatar
Pierre Aubert committed
33 34 35 36 37 38 39 40 41 42 43 44 45
		endif(CREATE_RPM)

		# if(CREATE_DMG)				#We should use DragNDrop or PackageMaker of osx
		# 	set(CPACK_GENERATOR "DMG")
		# endif(CREATE_DMG)

		include(CPack)
		# Has to be used :
		# cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCREATE_DEB=yes -DSSE4.2=yes # Or whatever extension
		# make -j 8
		# cpack
	endif()
endfunction(createLinuxPackages)
Pierre Aubert's avatar
Pierre Aubert committed
46 47