aboutsummaryrefslogtreecommitdiffstats
path: root/host/examples/init_usrp
diff options
context:
space:
mode:
authorMichael Dickens <michael.dickens@ettus.com>2019-10-15 11:36:24 -0700
committerMartin Braun <martin.braun@ettus.com>2019-10-15 11:44:38 -0700
commitf520573c3dd103b2e409d1edc4b960985aa2e1eb (patch)
tree58aa13f3ec8e97ee4b9b218f8527d74526e9d8b2 /host/examples/init_usrp
parent90f8cbc12fe674d373652657b61b8466dcbc3469 (diff)
downloaduhd-f520573c3dd103b2e409d1edc4b960985aa2e1eb.tar.gz
uhd-f520573c3dd103b2e409d1edc4b960985aa2e1eb.tar.bz2
uhd-f520573c3dd103b2e409d1edc4b960985aa2e1eb.zip
cmake: Use new UHDBoost.cmake in init_usrp and tools
Modifies the CMake for the following utilities: - init_usrp (example) - kitchen_sink - nirio_programmer
Diffstat (limited to 'host/examples/init_usrp')
-rw-r--r--host/examples/init_usrp/CMakeLists.txt60
1 files changed, 22 insertions, 38 deletions
diff --git a/host/examples/init_usrp/CMakeLists.txt b/host/examples/init_usrp/CMakeLists.txt
index 3260ce542..40fcf9016 100644
--- a/host/examples/init_usrp/CMakeLists.txt
+++ b/host/examples/init_usrp/CMakeLists.txt
@@ -5,7 +5,16 @@
# SPDX-License-Identifier: GPL-3.0-or-later
#
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.5.1)
+project(INIT_USRP CXX)
+
+### Configure Compiler ########################################################
+set(CMAKE_CXX_STANDARD 11)
+
+if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
+ set(CMAKE_EXE_LINKER_FLAGS "-lthr ${CMAKE_EXE_LINKER_FLAGS}")
+ set(CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}")
+endif()
### Set up build environment ##################################################
# Choose a static or shared-library build (shared is default, and static will
@@ -13,48 +22,23 @@ cmake_minimum_required(VERSION 2.8)
# Set this to ON in order to link a static build of UHD:
option(UHD_USE_STATIC_LIBS OFF)
-# This example also requires Boost:
-set(BOOST_REQUIRED_COMPONENTS
- program_options
- 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:
-find_package(UHD "3.8.0" REQUIRED)
+find_package(UHD 3.15.0 REQUIRED)
# The version in ^^^^^ here is a minimum version.
# To specify an exact version:
-#find_package(UHD 3.8.1 EXACT REQUIRED)
+#find_package(UHD 3.15.0 EXACT REQUIRED)
-### Configure Compiler ########################################################
-if(CMAKE_VERSION VERSION_LESS "3.1")
- if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
- set(CMAKE_CXX_FLAGS "--std=gnu++11 ${CMAKE_CXX_FLAGS}")
- elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
- if("${IS_APPLE}" STREQUAL "")
- set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
- else()
- set(CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++ ${CMAKE_CXX_FLAGS}")
- endif()
- endif()
-else()
- set(CMAKE_CXX_STANDARD 11)
-endif()
-
-if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
- set(CMAKE_EXE_LINKER_FLAGS "-lthr ${CMAKE_EXE_LINKER_FLAGS}")
- set(CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}")
-endif()
+# This example also requires Boost.
+# Set components here, then include UHDBoost to do the actual finding
+set(UHD_BOOST_REQUIRED_COMPONENTS
+ program_options
+ system
+ thread
+)
+set(BOOST_MIN_VERSION 1.58)
+include(UHDBoost)
+# need these include and link directories for the build
include_directories(
${Boost_INCLUDE_DIRS}
${UHD_INCLUDE_DIRS}