diff options
author | Josh Blum <josh@joshknows.com> | 2011-03-22 19:21:59 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-03-22 19:21:59 -0700 |
commit | 585b0455e8176d8e1abc2722f2a0e56eb89e1c58 (patch) | |
tree | 8b5a5c1a3bd69f708d3a12a85684f658de5d3f35 /host/Modules/UHDPackage.cmake | |
parent | c7bd55e2e117173b643113282507ec3d4b227377 (diff) | |
download | uhd-585b0455e8176d8e1abc2722f2a0e56eb89e1c58.tar.gz uhd-585b0455e8176d8e1abc2722f2a0e56eb89e1c58.tar.bz2 uhd-585b0455e8176d8e1abc2722f2a0e56eb89e1c58.zip |
uhd: try to be smart when setting up cpack when UHD_PACKAGE_MODE=AUTO
Diffstat (limited to 'host/Modules/UHDPackage.cmake')
-rw-r--r-- | host/Modules/UHDPackage.cmake | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/host/Modules/UHDPackage.cmake b/host/Modules/UHDPackage.cmake index a4da03177..03483e042 100644 --- a/host/Modules/UHDPackage.cmake +++ b/host/Modules/UHDPackage.cmake @@ -21,10 +21,38 @@ INCLUDE(UHDVersion) #sets version information ######################################################################## # Setup package file name ######################################################################## -SET(CPACK_PACKAGE_FILE_NAME "UHD-${UHD_VERSION}") -IF(DEFINED UHD_PACKAGE_SUFFIX) #append optional suffix (usually system type) - SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${UHD_PACKAGE_SUFFIX}") -ENDIF(DEFINED UHD_PACKAGE_SUFFIX) +IF(UHD_PACKAGE_MODE STREQUAL AUTO) + FIND_PROGRAM(LSB_RELEASE_EXECUTABLE lsb_release) + FIND_PROGRAM(UNAME_EXECUTABLE uname) + IF(LSB_RELEASE_EXECUTABLE AND UNAME_EXECUTABLE) + + #extract system information by executing the commands + EXECUTE_PROCESS( + COMMAND ${LSB_RELEASE_EXECUTABLE} --short --id + OUTPUT_VARIABLE _os_name OUTPUT_STRIP_TRAILING_WHITESPACE + ) + EXECUTE_PROCESS( + COMMAND ${LSB_RELEASE_EXECUTABLE} --short --release + OUTPUT_VARIABLE _os_version OUTPUT_STRIP_TRAILING_WHITESPACE + ) + EXECUTE_PROCESS( + COMMAND ${UNAME_EXECUTABLE} --machine + OUTPUT_VARIABLE _machine OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + #set generator type for recognized systems + IF(${_os_name} STREQUAL Ubuntu) + SET(CPACK_GENERATOR DEB) + ENDIF() + IF(${_os_name} STREQUAL Fedora) + SET(CPACK_GENERATOR RPM) + ENDIF() + + #set a more sensible package name for this system + SET(CPACK_PACKAGE_FILE_NAME "UHD-${UHD_VERSION}-${_os_name}-${_os_version}-${_machine}") + + ENDIF(LSB_RELEASE_EXECUTABLE AND UNAME_EXECUTABLE) +ENDIF(UHD_PACKAGE_MODE STREQUAL AUTO) ######################################################################## # Setup CPack General |