aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2015-01-08 00:10:48 +0100
committerMartin Braun <martin.braun@ettus.com>2015-01-13 11:49:03 +0100
commit73e324cda00d62dbf52ed5b53ccabdf6feabf819 (patch)
tree643559a7a7546525dfba66c5b491395ddef0b533
parent56081fe4d671c9d58dea2d594f4aa6b35c9d6f3d (diff)
downloaduhd-73e324cda00d62dbf52ed5b53ccabdf6feabf819.tar.gz
uhd-73e324cda00d62dbf52ed5b53ccabdf6feabf819.tar.bz2
uhd-73e324cda00d62dbf52ed5b53ccabdf6feabf819.zip
cmake: Added a version macro for compile-time version checks
-rw-r--r--host/include/uhd/CMakeLists.txt7
-rw-r--r--host/include/uhd/version.hpp.in (renamed from host/include/uhd/version.hpp)7
2 files changed, 13 insertions, 1 deletions
diff --git a/host/include/uhd/CMakeLists.txt b/host/include/uhd/CMakeLists.txt
index 318577b7c..f6123aa90 100644
--- a/host/include/uhd/CMakeLists.txt
+++ b/host/include/uhd/CMakeLists.txt
@@ -21,6 +21,11 @@ ADD_SUBDIRECTORY(usrp)
ADD_SUBDIRECTORY(usrp_clock)
ADD_SUBDIRECTORY(utils)
+CONFIGURE_FILE(
+ ${CMAKE_CURRENT_SOURCE_DIR}/version.hpp.in
+ ${CMAKE_CURRENT_BINARY_DIR}/version.hpp
+)
+
UHD_INSTALL(FILES
config.hpp
convert.hpp
@@ -31,7 +36,7 @@ UHD_INSTALL(FILES
property_tree.ipp
property_tree.hpp
stream.hpp
- version.hpp
+ ${CMAKE_CURRENT_BINARY_DIR}/version.hpp
DESTINATION ${INCLUDE_DIR}/uhd
COMPONENT headers
)
diff --git a/host/include/uhd/version.hpp b/host/include/uhd/version.hpp.in
index 998765899..725a655c4 100644
--- a/host/include/uhd/version.hpp
+++ b/host/include/uhd/version.hpp.in
@@ -29,6 +29,13 @@
*/
#define UHD_VERSION_ABI_STRING "3.8.0-0"
+/*!
+ * A macro to check UHD version at compile-time.
+ * The value of this macro is MAJOR * 10000 + MINOR * 100 + PATCH
+ * (e.g., for UHD 3.8.1 this is 30801).
+ */
+#cmakedefine UHD_VERSION @UHD_VERSION_ADDED@
+
namespace uhd{
//! Get the version string (dotted version number + build info)