Changes for Root6 (Mikolaj)
[u/mrichter/AliRoot.git] / cmake / FindCPack.cmake
1 # AliRoot Build System Module to find and configure ROOT
2 #
3 # Author: Johny Jose m(johny.jose@cern.ch)
4 #         Port of previous Makefile build to cmake
5
6 cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
7
8 get_filename_component(__cmake_path ${CMAKE_COMMAND} PATH)
9 find_program(CPACK_COMMAND cpack ${__cmake_path})
10 message(STATUS "Found CPack at: ${CPACK_COMMAND}")
11 if(NOT CPACK_COMMAND)
12   message(WARNING "CPack not found you will be unable to make packages!")
13 endif(NOT CPACK_COMMAND)
14
15 if(UNIX)
16   set(CPACK_GENERATOR "RPM")
17 endif(UNIX)
18 #if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
19 #  set(CPACK_GENERATOR "TBZ2;STGZ")
20 #endif(CMAKE_SYSTEM_NAME STREQUAL "Linux") 
21 if(WIN32)
22   set(CPACK_GENERATOR "NSIS;ZIP")
23 endif(WIN32)
24 add_custom_target(all_packages)
25
26 macro(add_component_package __component __targetname)
27   set(PACKAGE_COMPONENT ${__component})
28   set(__packageConfig CPackConfig-${PACKAGE_COMPONENT}.cmake)
29
30   configure_file(${PROJECT_SOURCE_DIR}/cmake/CPackConfig.in ${__packageConfig} @ONLY)
31   message(STATUS "Package ${__targetname} configured")
32   add_custom_target(${__targetname}
33     ${CPACK_COMMAND} --config "${__packageConfig}" 
34 #    WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
35     )
36   add_dependencies(all_packages ${__targetname})
37 endmacro(add_component_package)