aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2021-09-02 11:38:05 +0200
committerAaron Rossetto <aaron.rossetto@ni.com>2021-09-10 15:08:10 -0500
commit09d94529e5dbfa992cb6012cc0dc38d6f3e7d57d (patch)
treef632274ec4af60e1559a361bd2b607cc65e9d5f7 /host/lib
parente64d3e28316f642c1203722b6f5f2af710a7e281 (diff)
downloaduhd-09d94529e5dbfa992cb6012cc0dc38d6f3e7d57d.tar.gz
uhd-09d94529e5dbfa992cb6012cc0dc38d6f3e7d57d.tar.bz2
uhd-09d94529e5dbfa992cb6012cc0dc38d6f3e7d57d.zip
cmake: Replace CMAKE_{SOURCE,BINARY}_DIR with UHD_*_DIR
See the CMake 3.8 documentation on these two variables: https://cmake.org/cmake/help/v3.8/variable/PROJECT-NAME_SOURCE_DIR.html https://cmake.org/cmake/help/v3.8/variable/CMAKE_SOURCE_DIR.html Under normal circumstances, these two are identical. For sub-projects (i.e., when building UHD as part of something else that is also a CMake project), only the former is useful. There is no discernible downside of using UHD_SOURCE_DIR over CMAKE_SOURCE_DIR. This was changed using sed: $ sed -i "s/CMAKE_SOURCE_DIR/UHD_SOURCE_DIR/g" \ `ag -l CMAKE_SOURCE_DIR **/{CMakeLists.txt,*.cmake}` $ sed -i "s/CMAKE_BINARY_DIR/UHD_BINARY_DIR/g" \ `ag -l CMAKE_BINARY_DIR **/{CMakeLists.txt,*.cmake}` At the same time, we also replace the CMake variable UHD_HOST_ROOT (used in MPM) with UHD_SOURCE_DIR. There's no reason to have two variables with the same meaning and different names, but more importantly, this means that UHD_SOURCE_DIR is defined even in those cases where MPM calls into CMake files from UHD without any additional patches. Shoutout to GitHub user marcobergamin for bringing this up.
Diffstat (limited to 'host/lib')
-rw-r--r--host/lib/CMakeLists.txt4
-rw-r--r--host/lib/cal/CMakeLists.txt2
-rw-r--r--host/lib/transport/nirio/lvbitx/CMakeLists.txt2
3 files changed, 4 insertions, 4 deletions
diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt
index 910fe3c70..fd316221c 100644
--- a/host/lib/CMakeLists.txt
+++ b/host/lib/CMakeLists.txt
@@ -152,7 +152,7 @@ if(MSVC)
if(IS_ABSOLUTE "${CUSTOM_RC_FILE}")
set(UHD_RC_IN "${CUSTOM_RC_FILE}")
else()
- set(UHD_RC_IN "${CMAKE_BINARY_DIR}/${CUSTOM_RC_FILE}")
+ set(UHD_RC_IN "${UHD_BINARY_DIR}/${CUSTOM_RC_FILE}")
endif(IS_ABSOLUTE "${CUSTOM_RC_FILE}")
message(STATUS "")
message(STATUS "Using custom RC template: ${UHD_RC_IN}")
@@ -193,7 +193,7 @@ if(ENABLE_SIM)
# Get python include dirs
include_directories(${PYTHON_INCLUDE_DIRS})
set(PYBIND11_INCLUDE_DIR
- "${CMAKE_SOURCE_DIR}/lib/deps/pybind11/include"
+ "${UHD_SOURCE_DIR}/lib/deps/pybind11/include"
CACHE
STRING
"Location of PyBind11 includes"
diff --git a/host/lib/cal/CMakeLists.txt b/host/lib/cal/CMakeLists.txt
index da6bdf1a2..a39aac06c 100644
--- a/host/lib/cal/CMakeLists.txt
+++ b/host/lib/cal/CMakeLists.txt
@@ -7,7 +7,7 @@
########################################################################
# This file included, use CMake directory variables
########################################################################
-include_directories(${CMAKE_SOURCE_DIR}/lib/deps/flatbuffers/include)
+include_directories(${UHD_SOURCE_DIR}/lib/deps/flatbuffers/include)
LIBUHD_APPEND_SOURCES(
${CMAKE_CURRENT_SOURCE_DIR}/database.cpp
${CMAKE_CURRENT_SOURCE_DIR}/iq_cal.cpp
diff --git a/host/lib/transport/nirio/lvbitx/CMakeLists.txt b/host/lib/transport/nirio/lvbitx/CMakeLists.txt
index a68bef6fe..ea55409c9 100644
--- a/host/lib/transport/nirio/lvbitx/CMakeLists.txt
+++ b/host/lib/transport/nirio/lvbitx/CMakeLists.txt
@@ -12,7 +12,7 @@ macro(LIBUHD_LVBITX_GEN_SOURCE_AND_BITSTREAM lvbitx binfile)
set( GEN_OPTIONS )
message( STATUS " Using ${lvbitx} for codegen" )
else( ${binfile} STREQUAL "OFF" )
- set( GEN_OPTIONS --merge-bin=${CMAKE_SOURCE_DIR}/../binaries/${binfile} --output-lvbitx-path=${CMAKE_SOURCE_DIR}/../binaries )
+ set( GEN_OPTIONS --merge-bin=${UHD_SOURCE_DIR}/../binaries/${binfile} --output-lvbitx-path=${UHD_SOURCE_DIR}/../binaries )
message( STATUS " Merging ${lvbitx} with ${binfile} for codegen" )
endif( ${binfile} STREQUAL "OFF" )