diff options
Diffstat (limited to 'host/examples')
-rw-r--r-- | host/examples/init_usrp/CMakeLists.txt | 60 |
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} |