1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
#
# Copyright 2014-2015 Ettus Research LLC
# Copyright 2019 Ettus Research, a National Instruments Brand
#
# 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
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
cmake_minimum_required(VERSION 3.5.1)
project(NIRIO_PROGRAMMER CXX)
set(CMAKE_CXX_STANDARD 11)
### Set up build environment ##################################################
# Choose a static or shared-library build (shared is default, and static will
# probably need some special care!)
# Set this to ON in order to link a static build of UHD:
option(UHD_USE_STATIC_LIBS OFF)
# To add UHD as a dependency to this project, add a line such as this:
find_package(UHD 3.15.0.0 REQUIRED)
# The version in ^^^^^ here is a minimum version.
# To specify an exact version:
#find_package(UHD 3.8.1 EXACT REQUIRED)
# This example also requires Boost:
set(UHD_BOOST_REQUIRED_COMPONENTS
program_options
system
thread
regex
)
set(BOOST_MIN_VERSION "1.58")
include(UHDBoost)
### Configure Compiler ########################################################
include_directories(
"${CMAKE_CURRENT_SOURCE_DIR}/../../host/include"
${Boost_INCLUDE_DIRS}
${UHD_INCLUDE_DIRS}
)
link_directories(${Boost_LIBRARY_DIRS})
### Make the executable #######################################################
add_executable(nirio_programmer nirio_programmer.cpp)
set(CMAKE_BUILD_TYPE "Release")
# Shared library case: All we need to do is link against the library, and
# anything else we need (in this case, some Boost libraries):
if(NOT UHD_USE_STATIC_LIBS)
message(STATUS "Linking against shared UHD library.")
target_link_libraries(nirio_programmer ${UHD_LIBRARIES} ${Boost_LIBRARIES})
# Shared library case: All we need to do is link against the library, and
# anything else we need (in this case, some Boost libraries):
else(NOT UHD_USE_STATIC_LIBS)
message(STATUS "Linking against static UHD library.")
target_link_libraries(nirio_programmer
# We could use ${UHD_LIBRARIES}, but linking requires some extra flags,
# so we use this convenience variable provided to us
${UHD_STATIC_LIB_LINK_FLAG}
# Also, when linking statically, we need to pull in all the deps for
# UHD as well, because the dependencies don't get resolved automatically
${UHD_STATIC_LIB_DEPS}
)
endif(NOT UHD_USE_STATIC_LIBS)
### Once it's built... ########################################################
# Here, you would have commands to install your program.
# We will skip these in this example.
|