From ad1ef1b64590b72a3286046f8baa79ac055f9923 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Fri, 9 Jan 2015 18:39:29 +0100 Subject: cmake: Added ENABLE_STATIC_LIBS option - Allows building static libraries - For users calling find_package(UHD), provides extra options for building apps statically linking UHD. - Updated the init_usrp example to link UHD statically. --- host/lib/CMakeLists.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'host/lib') diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index eed8b642c..5755a6c4c 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2010-2014 Ettus Research LLC +# Copyright 2010-2015 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 @@ -128,3 +128,14 @@ IF(NOT UHDHOST_PKG) #Syntax makes it unusable by UHD_INSTALL RUNTIME DESTINATION ${RUNTIME_DIR} COMPONENT libraries # .dll file ) ENDIF(NOT UHDHOST_PKG) + +####################################################### +# Setup libuhd library (static) +####################################################### +IF(ENABLE_STATIC_LIBS) + ADD_LIBRARY(uhd_static STATIC ${libuhd_sources}) + SET_TARGET_PROPERTIES(uhd_static PROPERTIES OUTPUT_NAME uhd) + INSTALL(TARGETS uhd_static + ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib or .a file + ) +ENDIF(ENABLE_STATIC_LIBS) -- cgit v1.2.3