From 12e86cc384b150a8fbc1ce22533df62cba58df10 Mon Sep 17 00:00:00 2001
From: Martin Braun <martin.braun@ettus.com>
Date: Mon, 12 Jan 2015 15:23:13 +0100
Subject: examples: Fixed init_usrp for building with MSVC

---
 host/examples/init_usrp/CMakeLists.txt | 9 +++++++++
 1 file changed, 9 insertions(+)

(limited to 'host')

diff --git a/host/examples/init_usrp/CMakeLists.txt b/host/examples/init_usrp/CMakeLists.txt
index afbf73027..420e79993 100644
--- a/host/examples/init_usrp/CMakeLists.txt
+++ b/host/examples/init_usrp/CMakeLists.txt
@@ -24,6 +24,14 @@ set(BOOST_REQUIRED_COMPONENTS
     system
     thread
 )
+if(MSVC)
+    set(BOOST_ALL_DYN_LINK "${BOOST_ALL_DYN_LINK}" CACHE BOOL "boost enable dynamic linking")
+    if(BOOST_ALL_DYN_LINK)
+        add_definitions(-DBOOST_ALL_DYN_LINK) #setup boost auto-linking in msvc
+    else(BOOST_ALL_DYN_LINK)
+        set(BOOST_REQUIRED_COMPONENTS) #empty components list for static link
+    endif(BOOST_ALL_DYN_LINK)
+endif(MSVC)
 find_package(Boost "1.46" REQUIRED ${BOOST_REQUIRED_COMPONENTS})
 
 # To add UHD as a dependency to this project, add a line such as this:
@@ -37,6 +45,7 @@ include_directories(
     ${Boost_INCLUDE_DIRS}
     ${UHD_INCLUDE_DIRS}
 )
+link_directories(${Boost_LIBRARY_DIRS})
 
 ### Make the executable #######################################################
 add_executable(init_usrp init_usrp.cpp)
-- 
cgit v1.2.3