aboutsummaryrefslogtreecommitdiffstats
path: root/host/CMakeLists.txt
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2015-01-09 18:39:29 +0100
committerMartin Braun <martin.braun@ettus.com>2015-01-19 09:07:16 +0100
commitad1ef1b64590b72a3286046f8baa79ac055f9923 (patch)
tree05950e99844a12c4c37a9a7a4f8b2cbbe6a59be4 /host/CMakeLists.txt
parent734180c44b438cf707c4ff48bf4b11a8c5a94136 (diff)
downloaduhd-ad1ef1b64590b72a3286046f8baa79ac055f9923.tar.gz
uhd-ad1ef1b64590b72a3286046f8baa79ac055f9923.tar.bz2
uhd-ad1ef1b64590b72a3286046f8baa79ac055f9923.zip
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.
Diffstat (limited to 'host/CMakeLists.txt')
-rw-r--r--host/CMakeLists.txt31
1 files changed, 30 insertions, 1 deletions
diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt
index 67a824c8f..c90c5de14 100644
--- a/host/CMakeLists.txt
+++ b/host/CMakeLists.txt
@@ -66,6 +66,14 @@ INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/include)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
########################################################################
+# Static Lib Configuration
+########################################################################
+OPTION(ENABLE_STATIC_LIBS "Enable building of static libraries" OFF)
+IF(ENABLE_STATIC_LIBS)
+ MESSAGE(STATUS "Building Static Libraries: ${ENABLE_STATIC_LIBS}")
+ENDIF(ENABLE_STATIC_LIBS)
+
+########################################################################
# On Apple only, set install name and use rpath correctly, if not already set
########################################################################
IF(APPLE)
@@ -315,14 +323,35 @@ IF(NOT CMAKE_MODULES_DIR)
SET(CMAKE_MODULES_DIR lib${LIB_SUFFIX}/cmake)
ENDIF(NOT CMAKE_MODULES_DIR)
+# UHDConfig.cmake needs UHD_LINK_LIST_STATIC set:
+LIST(APPEND UHD_LINK_LIST_STATIC "dl")
+LIST(APPEND UHD_LINK_LIST_STATIC "pthread")
+FOREACH(Boost_Comp ${BOOST_REQUIRED_COMPONENTS})
+ IF(NOT ${Boost_Comp} STREQUAL "unit_test_framework")
+ LIST(APPEND UHD_LINK_LIST_STATIC "boost_${Boost_Comp}")
+ ENDIF(NOT ${Boost_Comp} STREQUAL "unit_test_framework")
+ENDFOREACH(Boost_Comp)
+IF(ENABLE_USB)
+ LIST(APPEND UHD_LINK_LIST_STATIC "usb-1.0")
+ENDIF(ENABLE_USB)
+IF(ENABLE_ORC)
+ LIST(APPEND UHD_LINK_LIST_STATIC "orc-0.4")
+ENDIF(ENABLE_ORC)
+message(STATUS "libs: ${UHD_LINK_LIST_STATIC}")
+
CONFIGURE_FILE(
${CMAKE_SOURCE_DIR}/cmake/Modules/UHDConfigVersion.cmake.in
${CMAKE_BINARY_DIR}/cmake/Modules/UHDConfigVersion.cmake
@ONLY
)
+CONFIGURE_FILE(
+ ${CMAKE_SOURCE_DIR}/cmake/Modules/UHDConfig.cmake.in
+ ${CMAKE_BINARY_DIR}/cmake/Modules/UHDConfig.cmake
+ @ONLY
+)
SET(cmake_configs
- ${CMAKE_SOURCE_DIR}/cmake/Modules/UHDConfig.cmake
+ ${CMAKE_BINARY_DIR}/cmake/Modules/UHDConfig.cmake
${CMAKE_BINARY_DIR}/cmake/Modules/UHDConfigVersion.cmake
)