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 | |
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
-rw-r--r-- | host/Modules/UHDPackage.cmake | 36 | ||||
-rw-r--r-- | host/Modules/UHDVersion.cmake | 4 |
2 files changed, 35 insertions, 5 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 diff --git a/host/Modules/UHDVersion.cmake b/host/Modules/UHDVersion.cmake index 0061dffbc..9b20bb98a 100644 --- a/host/Modules/UHDVersion.cmake +++ b/host/Modules/UHDVersion.cmake @@ -24,7 +24,6 @@ INCLUDE(UHDPython) #requires python for parsing SET(UHD_VERSION_MAJOR 003) #API compatibility number SET(UHD_VERSION_MINOR 0) #Timestamp of git commit SET(UHD_VERSION_PATCH 0) #Short hash of git commit -SET(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_MINOR}.${UHD_VERSION_PATCH}") ######################################################################## # Find GIT to get repo information @@ -61,3 +60,6 @@ IF(GIT_FOUND) ) SET(UHD_VERSION_PATCH ${_git_rev}) ENDIF(GIT_FOUND) + +######################################################################## +SET(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_MINOR}.${UHD_VERSION_PATCH}") |