summaryrefslogtreecommitdiffstats
path: root/host/cmake/Modules
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-07-08 12:22:14 -0700
committerJosh Blum <josh@joshknows.com>2011-07-08 12:22:14 -0700
commit41e9ededc9ca0d33c67dd7f2051278d375386930 (patch)
treeae0e280c045bc0d848e355fd58f55ec01858dfbd /host/cmake/Modules
parent17fabccfe4be79f3a5a0a3d7ab14ea72a791ecd9 (diff)
downloaduhd-41e9ededc9ca0d33c67dd7f2051278d375386930.tar.gz
uhd-41e9ededc9ca0d33c67dd7f2051278d375386930.tar.bz2
uhd-41e9ededc9ca0d33c67dd7f2051278d375386930.zip
uhd: moved modules and some other files into cmake subdir
Diffstat (limited to 'host/cmake/Modules')
-rw-r--r--host/cmake/Modules/FindDocutils.cmake21
-rw-r--r--host/cmake/Modules/FindGit.cmake46
-rw-r--r--host/cmake/Modules/FindUSB1.cmake38
-rw-r--r--host/cmake/Modules/UHDComponent.cmake77
-rw-r--r--host/cmake/Modules/UHDPackage.cmake160
-rw-r--r--host/cmake/Modules/UHDPython.cmake86
-rw-r--r--host/cmake/Modules/UHDVersion.cmake60
7 files changed, 488 insertions, 0 deletions
diff --git a/host/cmake/Modules/FindDocutils.cmake b/host/cmake/Modules/FindDocutils.cmake
new file mode 100644
index 000000000..3a97d8643
--- /dev/null
+++ b/host/cmake/Modules/FindDocutils.cmake
@@ -0,0 +1,21 @@
+#
+# Copyright 2011-2011 Ettus Research LLC
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+########################################################################
+FIND_PROGRAM(RST2HTML_EXECUTABLE rst2html)
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Docutils DEFAULT_MSG RST2HTML_EXECUTABLE)
diff --git a/host/cmake/Modules/FindGit.cmake b/host/cmake/Modules/FindGit.cmake
new file mode 100644
index 000000000..2d8214287
--- /dev/null
+++ b/host/cmake/Modules/FindGit.cmake
@@ -0,0 +1,46 @@
+# The module defines the following variables:
+# GIT_EXECUTABLE - path to git command line client
+# GIT_FOUND - true if the command line client was found
+# Example usage:
+# find_package(Git)
+# if(GIT_FOUND)
+# message("git found: ${GIT_EXECUTABLE}")
+# endif()
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distributed this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# Look for 'git' or 'eg' (easy git)
+#
+set(git_names git eg)
+
+# Prefer .cmd variants on Windows unless running in a Makefile
+# in the MSYS shell.
+#
+if(WIN32)
+ if(NOT CMAKE_GENERATOR MATCHES "MSYS")
+ set(git_names git.cmd git eg.cmd eg)
+ endif()
+endif()
+
+find_program(GIT_EXECUTABLE
+ NAMES ${git_names}
+ DOC "git command line client"
+ )
+mark_as_advanced(GIT_EXECUTABLE)
+
+# Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if
+# all listed variables are TRUE
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Git DEFAULT_MSG GIT_EXECUTABLE)
diff --git a/host/cmake/Modules/FindUSB1.cmake b/host/cmake/Modules/FindUSB1.cmake
new file mode 100644
index 000000000..efb2e288b
--- /dev/null
+++ b/host/cmake/Modules/FindUSB1.cmake
@@ -0,0 +1,38 @@
+# - Try to find the freetype library
+# Once done this defines
+#
+# LIBUSB_FOUND - system has libusb
+# LIBUSB_INCLUDE_DIR - the libusb include directory
+# LIBUSB_LIBRARIES - Link these to use libusb
+
+# Copyright (c) 2006, 2008 Laurent Montel, <montel@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+if (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
+
+ # in cache already
+ set(LIBUSB_FOUND TRUE)
+
+else (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
+ # use pkg-config to get the directories and then use these values
+ # in the FIND_PATH() and FIND_LIBRARY() calls
+ find_package(PkgConfig)
+ IF(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_LIBUSB libusb-1.0)
+ ENDIF(PKG_CONFIG_FOUND)
+
+ FIND_PATH(LIBUSB_INCLUDE_DIR libusb.h
+ PATHS ${PC_LIBUSB_INCLUDEDIR} ${PC_LIBUSB_INCLUDE_DIRS})
+
+ FIND_LIBRARY(LIBUSB_LIBRARIES NAMES usb-1.0
+ PATHS ${PC_LIBUSB_LIBDIR} ${PC_LIBUSB_LIBRARY_DIRS})
+
+ include(FindPackageHandleStandardArgs)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBUSB DEFAULT_MSG LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIR)
+
+ MARK_AS_ADVANCED(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES)
+
+endif (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
diff --git a/host/cmake/Modules/UHDComponent.cmake b/host/cmake/Modules/UHDComponent.cmake
new file mode 100644
index 000000000..52b7450d5
--- /dev/null
+++ b/host/cmake/Modules/UHDComponent.cmake
@@ -0,0 +1,77 @@
+#
+# Copyright 2010-2011 Ettus Research LLC
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+########################################################################
+SET(_uhd_enabled_components "" CACHE INTERNAL "" FORCE)
+SET(_uhd_disabled_components "" CACHE INTERNAL "" FORCE)
+
+########################################################################
+# Register a component into the system
+# - name the component string name
+# - var the global enable variable
+# - enb the default enable setting
+# - deps a list of dependencies
+# - dis the default disable setting
+########################################################################
+MACRO(LIBUHD_REGISTER_COMPONENT name var enb deps dis)
+ MESSAGE(STATUS "")
+ MESSAGE(STATUS "Configuring ${name} support...")
+ FOREACH(dep ${deps})
+ MESSAGE(STATUS " Dependency ${dep} = ${${dep}}")
+ ENDFOREACH(dep)
+
+ #setup the dependent option for this component
+ INCLUDE(CMakeDependentOption)
+ CMAKE_DEPENDENT_OPTION(${var} "enable ${name} support" ${enb} "${deps}" ${dis})
+
+ #append the component into one of the lists
+ IF(${var})
+ MESSAGE(STATUS " Enabling ${name} support.")
+ LIST(APPEND _uhd_enabled_components ${name})
+ ELSE(${var})
+ MESSAGE(STATUS " Disabling ${name} support.")
+ LIST(APPEND _uhd_disabled_components ${name})
+ ENDIF(${var})
+ MESSAGE(STATUS " Override with -D${var}=ON/OFF")
+
+ #make components lists into global variables
+ SET(_uhd_enabled_components ${_uhd_enabled_components} CACHE INTERNAL "" FORCE)
+ SET(_uhd_disabled_components ${_uhd_disabled_components} CACHE INTERNAL "" FORCE)
+ENDMACRO(LIBUHD_REGISTER_COMPONENT)
+
+########################################################################
+# Print the registered component summary
+########################################################################
+FUNCTION(UHD_PRINT_COMPONENT_SUMMARY)
+ MESSAGE(STATUS "")
+ MESSAGE(STATUS "######################################################")
+ MESSAGE(STATUS "# UHD enabled components ")
+ MESSAGE(STATUS "######################################################")
+ FOREACH(comp ${_uhd_enabled_components})
+ MESSAGE(STATUS " * ${comp}")
+ ENDFOREACH(comp)
+
+ MESSAGE(STATUS "")
+ MESSAGE(STATUS "######################################################")
+ MESSAGE(STATUS "# UHD disabled components ")
+ MESSAGE(STATUS "######################################################")
+ FOREACH(comp ${_uhd_disabled_components})
+ MESSAGE(STATUS " * ${comp}")
+ ENDFOREACH(comp)
+
+ MESSAGE(STATUS "")
+ENDFUNCTION(UHD_PRINT_COMPONENT_SUMMARY)
diff --git a/host/cmake/Modules/UHDPackage.cmake b/host/cmake/Modules/UHDPackage.cmake
new file mode 100644
index 000000000..e36793d73
--- /dev/null
+++ b/host/cmake/Modules/UHDPackage.cmake
@@ -0,0 +1,160 @@
+#
+# Copyright 2010-2011 Ettus Research LLC
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+########################################################################
+INCLUDE(UHDVersion) #sets version information
+
+SET(UHD_RELEASE_MODE "${UHD_RELEASE_MODE}" CACHE BOOL "set UHD to release mode to build installers")
+
+########################################################################
+# Setup additional defines for OS types
+########################################################################
+IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ SET(LINUX TRUE)
+ENDIF()
+
+IF(LINUX AND EXISTS "/etc/debian_version")
+ SET(DEBIAN TRUE)
+ENDIF()
+
+IF(LINUX AND EXISTS "/etc/redhat-release")
+ SET(REDHAT TRUE)
+ENDIF()
+
+########################################################################
+# Set generator type for recognized systems
+########################################################################
+IF(CPACK_GENERATOR)
+ #already set
+ELSEIF(APPLE)
+ SET(CPACK_GENERATOR PackageMaker)
+ELSEIF(WIN32)
+ SET(CPACK_GENERATOR NSIS)
+ELSEIF(DEBIAN)
+ SET(CPACK_GENERATOR DEB)
+ELSEIF(REDHAT)
+ SET(CPACK_GENERATOR RPM)
+ELSE()
+ SET(CPACK_GENERATOR TGZ)
+ENDIF()
+
+########################################################################
+# Setup package file name
+########################################################################
+FIND_PROGRAM(LSB_RELEASE_EXECUTABLE lsb_release)
+IF((DEBIAN OR REDHAT) AND LSB_RELEASE_EXECUTABLE)
+
+ #extract system information by executing the commands
+ EXECUTE_PROCESS(
+ COMMAND ${LSB_RELEASE_EXECUTABLE} --short --id
+ OUTPUT_VARIABLE LSB_ID OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ EXECUTE_PROCESS(
+ COMMAND ${LSB_RELEASE_EXECUTABLE} --short --release
+ OUTPUT_VARIABLE LSB_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+
+ #set a more sensible package name for this system
+ SET(CPACK_PACKAGE_FILE_NAME "UHD-${UHD_VERSION}-${LSB_ID}-${LSB_RELEASE}-${CMAKE_SYSTEM_PROCESSOR}")
+
+ENDIF()
+
+IF(${CPACK_GENERATOR} STREQUAL NSIS)
+ SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_PROJECT_NAME}")
+ENDIF()
+
+########################################################################
+# Setup CPack General
+########################################################################
+SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ettus Research - Universal Hardware Driver")
+SET(CPACK_PACKAGE_VENDOR "Ettus Research LLC")
+SET(CPACK_PACKAGE_CONTACT "support@ettus.com")
+SET(CPACK_PACKAGE_VERSION_MAJOR ${UHD_VERSION_MAJOR})
+SET(CPACK_PACKAGE_VERSION_MINOR ${UHD_VERSION_MINOR})
+SET(CPACK_PACKAGE_VERSION_PATCH ${UHD_VERSION_PATCH})
+SET(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_SOURCE_DIR}/README.txt)
+SET(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/AUTHORS.txt)
+SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE.txt)
+
+########################################################################
+# Setup CPack Components
+########################################################################
+SET(CPACK_COMPONENT_LIBRARIES_GROUP "Development")
+SET(CPACK_COMPONENT_HEADERS_GROUP "Development")
+SET(CPACK_COMPONENT_UTILITIES_GROUP "Runtime")
+SET(CPACK_COMPONENT_EXAMPLES_GROUP "Runtime")
+SET(CPACK_COMPONENT_TESTS_GROUP "Runtime")
+SET(CPACK_COMPONENT_MANUAL_GROUP "Documentation")
+SET(CPACK_COMPONENT_DOXYGEN_GROUP "Documentation")
+SET(CPACK_COMPONENT_README_GROUP "Documentation")
+
+SET(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries")
+SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ Headers")
+SET(CPACK_COMPONENT_UTILITIES_DISPLAY_NAME "Utilities")
+SET(CPACK_COMPONENT_EXAMPLES_DISPLAY_NAME "Examples")
+SET(CPACK_COMPONENT_TESTS_DISPLAY_NAME "Unit Tests")
+SET(CPACK_COMPONENT_MANUAL_DISPLAY_NAME "Manual")
+SET(CPACK_COMPONENT_DOXYGEN_DISPLAY_NAME "Doxygen")
+SET(CPACK_COMPONENT_README_DISPLAY_NAME "Readme")
+SET(CPACK_COMPONENT_IMAGES_DISPLAY_NAME "Images")
+
+SET(CPACK_COMPONENT_LIBRARIES_DESCRIPTION "Dynamic link library")
+SET(CPACK_COMPONENT_HEADERS_DESCRIPTION "C++ development headers")
+SET(CPACK_COMPONENT_UTILITIES_DESCRIPTION "Utility executables and python scripts")
+SET(CPACK_COMPONENT_EXAMPLES_DESCRIPTION "Example executables")
+SET(CPACK_COMPONENT_TESTS_DESCRIPTION "Unit test executables")
+SET(CPACK_COMPONENT_MANUAL_DESCRIPTION "Manual/application notes (rst and html)")
+SET(CPACK_COMPONENT_DOXYGEN_DESCRIPTION "API documentation (html)")
+SET(CPACK_COMPONENT_README_DESCRIPTION "Readme files (txt)")
+SET(CPACK_COMPONENT_IMAGES_DESCRIPTION "FPGA and firmware images")
+
+SET(CPACK_COMPONENT_README_REQUIRED TRUE)
+
+SET(CPACK_COMPONENT_UTILITIES_DEPENDS libraries)
+SET(CPACK_COMPONENT_EXAMPLES_DEPENDS libraries)
+SET(CPACK_COMPONENT_TESTS_DEPENDS libraries)
+
+SET(CPACK_COMPONENTS_ALL libraries headers utilities examples tests manual doxygen readme images)
+
+########################################################################
+# Setup CPack Debian
+########################################################################
+SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libusb-1.0-0, libboost-dev")
+SET(CPACK_DEBIAN_PACKAGE_RECOMMENDS "python, python-tk")
+
+########################################################################
+# Setup CPack RPM
+########################################################################
+SET(CPACK_RPM_PACKAGE_REQUIRES "boost-devel, libusb1")
+
+########################################################################
+# Setup CPack NSIS
+########################################################################
+SET(CPACK_NSIS_MODIFY_PATH ON)
+
+SET(HLKM_ENV "\\\"SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment\\\"")
+
+SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
+ WriteRegStr HKLM ${HLKM_ENV} \\\"UHD_PKG_DATA_PATH\\\" \\\"$INSTDIR\\\\share\\\\uhd\\\"
+")
+
+SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "
+ DeleteRegValue HKLM ${HLKM_ENV} \\\"UHD_PKG_DATA_PATH\\\"
+")
+
+########################################################################
+INCLUDE(CPack) #include after setting vars
diff --git a/host/cmake/Modules/UHDPython.cmake b/host/cmake/Modules/UHDPython.cmake
new file mode 100644
index 000000000..fdcdccb4b
--- /dev/null
+++ b/host/cmake/Modules/UHDPython.cmake
@@ -0,0 +1,86 @@
+#
+# Copyright 2010-2011 Ettus Research LLC
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+IF(NOT DEFINED INCLUDED_UHD_PYTHON_CMAKE)
+SET(INCLUDED_UHD_PYTHON_CMAKE TRUE)
+
+########################################################################
+# Setup Python
+########################################################################
+MESSAGE(STATUS "")
+MESSAGE(STATUS "Configuring the python interpreter...")
+#this allows the user to override PYTHON_EXECUTABLE
+IF(PYTHON_EXECUTABLE)
+
+ SET(PYTHONINTERP_FOUND TRUE)
+
+#otherwise if not set, try to automatically find it
+ELSE(PYTHON_EXECUTABLE)
+
+ #use the built-in find script
+ FIND_PACKAGE(PythonInterp)
+
+ #and if that fails use the find program routine
+ IF(NOT PYTHONINTERP_FOUND)
+ FIND_PROGRAM(PYTHON_EXECUTABLE NAMES python python2.7 python2.6)
+ IF(PYTHON_EXECUTABLE)
+ SET(PYTHONINTERP_FOUND TRUE)
+ ENDIF(PYTHON_EXECUTABLE)
+ ENDIF(NOT PYTHONINTERP_FOUND)
+
+ENDIF(PYTHON_EXECUTABLE)
+
+#make the path to the executable appear in the cmake gui
+SET(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter")
+
+MESSAGE(STATUS "Python interpreter: ${PYTHON_EXECUTABLE}")
+MESSAGE(STATUS "Override with: -DPYTHON_EXECUTABLE=<path-to-python>")
+
+IF(NOT PYTHONINTERP_FOUND)
+ MESSAGE(FATAL_ERROR "Error: Python interpretor required by the build system.")
+ENDIF(NOT PYTHONINTERP_FOUND)
+
+MACRO(PYTHON_CHECK_MODULE desc mod cmd have)
+ MESSAGE(STATUS "")
+ MESSAGE(STATUS "Python checking for ${desc}")
+ EXECUTE_PROCESS(
+ COMMAND ${PYTHON_EXECUTABLE} -c "
+#########################################
+try: import ${mod}
+except: exit(1)
+try: assert ${cmd}
+except: exit(2)
+exit(0)
+#########################################"
+ RESULT_VARIABLE ${have}
+ )
+ IF(${have} EQUAL 0)
+ MESSAGE(STATUS "Python checking for ${desc} - found")
+ SET(${have} TRUE)
+ ELSEIF(${have} EQUAL 1)
+ MESSAGE(STATUS "Python checking for ${desc} - \"import ${mod}\" failed")
+ SET(${have} FALSE)
+ ELSEIF(${have} EQUAL 2)
+ MESSAGE(STATUS "Python checking for ${desc} - \"assert ${cmd}\" failed")
+ SET(${have} FALSE)
+ ELSE()
+ MESSAGE(STATUS "Python checking for ${desc} - unknown error")
+ SET(${have} FALSE)
+ ENDIF()
+ENDMACRO(PYTHON_CHECK_MODULE)
+
+ENDIF(NOT DEFINED INCLUDED_UHD_PYTHON_CMAKE)
diff --git a/host/cmake/Modules/UHDVersion.cmake b/host/cmake/Modules/UHDVersion.cmake
new file mode 100644
index 000000000..f5364941c
--- /dev/null
+++ b/host/cmake/Modules/UHDVersion.cmake
@@ -0,0 +1,60 @@
+#
+# Copyright 2010-2011 Ettus Research LLC
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+########################################################################
+INCLUDE(UHDPython) #requires python for parsing
+FIND_PACKAGE(Git QUIET)
+
+########################################################################
+# Setup Version Numbers
+# - increment major on api compatibility changes
+# - increment minor on feature-level changes
+# - increment patch on for bug fixes and docs
+########################################################################
+SET(UHD_VERSION_MAJOR 003)
+SET(UHD_VERSION_MINOR 001)
+SET(UHD_VERSION_PATCH 002)
+
+########################################################################
+# Version information discovery through git log
+########################################################################
+IF(UHD_RELEASE_MODE)
+ SET(UHD_BUILD_INFO_DISCOVERY FALSE)
+ SET(UHD_BUILD_INFO "release")
+ELSE()
+ SET(UHD_BUILD_INFO_DISCOVERY GIT_FOUND)
+ SET(UHD_BUILD_INFO "unknown")
+ENDIF()
+
+IF(UHD_BUILD_INFO_DISCOVERY)
+
+ #grab the git ref id for the current head
+ EXECUTE_PROCESS(
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
+ OUTPUT_VARIABLE _git_rev OUTPUT_STRIP_TRAILING_WHITESPACE
+ RESULT_VARIABLE _git_rev_result
+ )
+
+ #only set the build info on success
+ IF(_git_rev_result EQUAL 0)
+ SET(UHD_BUILD_INFO ${_git_rev})
+ ENDIF()
+ENDIF(UHD_BUILD_INFO_DISCOVERY)
+
+########################################################################
+SET(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_MINOR}.${UHD_VERSION_PATCH}")