From 09d94529e5dbfa992cb6012cc0dc38d6f3e7d57d Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Thu, 2 Sep 2021 11:38:05 +0200 Subject: 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. --- mpm/lib/catalina/CMakeLists.txt | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'mpm/lib/catalina/CMakeLists.txt') diff --git a/mpm/lib/catalina/CMakeLists.txt b/mpm/lib/catalina/CMakeLists.txt index 7780b738e..d04b4d93e 100644 --- a/mpm/lib/catalina/CMakeLists.txt +++ b/mpm/lib/catalina/CMakeLists.txt @@ -15,7 +15,7 @@ macro(CATALINA_APPEND_SOURCES) endmacro(CATALINA_APPEND_SOURCES) set (CMAKE_CATALINA_SOURCE_DIR - ${UHD_HOST_ROOT}/lib/usrp/common + ${UHD_SOURCE_DIR}/lib/usrp/common ) ######################################################################## @@ -26,7 +26,7 @@ message(STATUS " Priority scheduling disabled.") set(THREAD_PRIO_DEFS HAVE_THREAD_PRIO_DUMMY) set_source_files_properties( - ${UHD_HOST_ROOT}/lib/utils/thread.cpp + ${UHD_SOURCE_DIR}/lib/utils/thread.cpp PROPERTIES COMPILE_DEFINITIONS "${THREAD_PRIO_DEFS}" ) @@ -34,11 +34,11 @@ set_source_files_properties( # Setup UHD_VERSION and UHD_COMPONENT for version.cpp ######################################################################## configure_file( - ${UHD_HOST_ROOT}/include/uhd/version.hpp.in + ${UHD_SOURCE_DIR}/include/uhd/version.hpp.in ${CMAKE_BINARY_DIR}/include/uhd/version.hpp ) configure_file( - ${UHD_HOST_ROOT}/lib/version.cpp + ${UHD_SOURCE_DIR}/lib/version.cpp ${CMAKE_BINARY_DIR}/lib/version.cpp ) @@ -47,24 +47,24 @@ set(catalina_sources ${CMAKE_CATALINA_SOURCE_DIR}/ad9361_ctrl.cpp ${CMAKE_CATALINA_SOURCE_DIR}/ad936x_manager.cpp ${CMAKE_CATALINA_SOURCE_DIR}/ad9361_driver/ad9361_device.cpp - ${UHD_HOST_ROOT}/lib/types/filters.cpp - ${UHD_HOST_ROOT}/lib/types/ranges.cpp - ${UHD_HOST_ROOT}/lib/types/sensors.cpp - ${UHD_HOST_ROOT}/lib/types/serial.cpp - ${UHD_HOST_ROOT}/lib/property_tree.cpp - ${UHD_HOST_ROOT}/lib/utils/log.cpp - ${UHD_HOST_ROOT}/lib/utils/thread.cpp + ${UHD_SOURCE_DIR}/lib/types/filters.cpp + ${UHD_SOURCE_DIR}/lib/types/ranges.cpp + ${UHD_SOURCE_DIR}/lib/types/sensors.cpp + ${UHD_SOURCE_DIR}/lib/types/serial.cpp + ${UHD_SOURCE_DIR}/lib/property_tree.cpp + ${UHD_SOURCE_DIR}/lib/utils/log.cpp + ${UHD_SOURCE_DIR}/lib/utils/thread.cpp ${CMAKE_BINARY_DIR}/lib/version.cpp ) USRP_PERIPHS_ADD_OBJECT(catalina ${catalina_sources}) target_include_directories(catalina PUBLIC - $) + $) target_include_directories(catalina PUBLIC - $) + $) target_include_directories(catalina PUBLIC - $) + $) target_include_directories(dboards PUBLIC - $) + $) -- cgit v1.2.3