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. --- host/docs/CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'host/docs/CMakeLists.txt') diff --git a/host/docs/CMakeLists.txt b/host/docs/CMakeLists.txt index 37d67bb16..e9b35bdc2 100644 --- a/host/docs/CMakeLists.txt +++ b/host/docs/CMakeLists.txt @@ -22,16 +22,16 @@ set(ENABLE_MANUAL_OR_DOXYGEN false) LIBUHD_REGISTER_COMPONENT("Manual" ENABLE_MANUAL ON "DOXYGEN_FOUND" OFF OFF) if(ENABLE_MANUAL) - set(FPGA_SOURCE_DIR "${CMAKE_SOURCE_DIR}/../fpga") + set(FPGA_SOURCE_DIR "${UHD_SOURCE_DIR}/../fpga") set(ENABLE_MANUAL_OR_DOXYGEN true) file(GLOB manual_sources "*.dox") file(GLOB_RECURSE fpga_manual_sources "${FPGA_SOURCE_DIR}/docs/*.md") list(APPEND manual_sources ${fpga_manual_sources}) set(DOXYGEN_DEPENDENCIES ${manual_sources}) - set(DOXYGEN_INPUT_DIRS "${CMAKE_SOURCE_DIR}/docs ${CMAKE_CURRENT_BINARY_DIR} ${FPGA_SOURCE_DIR}/docs") + set(DOXYGEN_INPUT_DIRS "${UHD_SOURCE_DIR}/docs ${CMAKE_CURRENT_BINARY_DIR} ${FPGA_SOURCE_DIR}/docs") set(DOXYGEN_DEP_COMPONENT "manual") set(DOXYGEN_FPGA_MANUAL_REFERENCE "\\subpage md_fpga \"Part III: FPGA Manual\"") - set(DOXYGEN_STRIP_EXTRA "${CMAKE_SOURCE_DIR}/../fpga/docs") + set(DOXYGEN_STRIP_EXTRA "${UHD_SOURCE_DIR}/../fpga/docs") set(DOXYGEN_EXCLUDE_DIRS "") endif(ENABLE_MANUAL) @@ -50,14 +50,14 @@ endif(LIBUHDDEV_PKG) if(ENABLE_DOXYGEN) set(ENABLE_MANUAL_OR_DOXYGEN true) #make doxygen directory depend on the header files - file(GLOB_RECURSE header_files ${CMAKE_SOURCE_DIR}/include/*.hpp) - file(GLOB_RECURSE h_files ${CMAKE_SOURCE_DIR}/include/*.h) + file(GLOB_RECURSE header_files ${UHD_SOURCE_DIR}/include/*.hpp) + file(GLOB_RECURSE h_files ${UHD_SOURCE_DIR}/include/*.h) list(APPEND header_files ${h_files}) set(DOXYGEN_DEPENDENCIES ${DOXYGEN_DEPENDENCIES} ${header_files}) if(ENABLE_DOXYGEN_FULL) - set(DOXYGEN_INPUT_DIRS "${DOXYGEN_INPUT_DIRS} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/python") + set(DOXYGEN_INPUT_DIRS "${DOXYGEN_INPUT_DIRS} ${UHD_SOURCE_DIR}/include ${UHD_SOURCE_DIR}/lib ${UHD_SOURCE_DIR}/python") else(ENABLE_DOXYGEN_FULL) - set(DOXYGEN_INPUT_DIRS "${DOXYGEN_INPUT_DIRS} ${CMAKE_SOURCE_DIR}/include") + set(DOXYGEN_INPUT_DIRS "${DOXYGEN_INPUT_DIRS} ${UHD_SOURCE_DIR}/include") endif(ENABLE_DOXYGEN_FULL) set(DOXYGEN_DEP_COMPONENT "doxygen") @@ -90,7 +90,7 @@ if(ENABLE_MANUAL_OR_DOXYGEN) @ONLY) #make doxygen directory depend on the header files - file(GLOB_RECURSE header_files ${CMAKE_SOURCE_DIR}/include/*.hpp) + file(GLOB_RECURSE header_files ${UHD_SOURCE_DIR}/include/*.hpp) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR_DOXYGEN} DEPENDS ${DOXYGEN_DEPENDENCIES} COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile -- cgit v1.2.3