diff options
author | Martin Braun <martin.braun@ettus.com> | 2021-09-02 11:38:05 +0200 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-09-10 15:08:10 -0500 |
commit | 09d94529e5dbfa992cb6012cc0dc38d6f3e7d57d (patch) | |
tree | f632274ec4af60e1559a361bd2b607cc65e9d5f7 /mpm/CMakeLists.txt | |
parent | e64d3e28316f642c1203722b6f5f2af710a7e281 (diff) | |
download | uhd-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 'mpm/CMakeLists.txt')
-rw-r--r-- | mpm/CMakeLists.txt | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mpm/CMakeLists.txt b/mpm/CMakeLists.txt index 731e2ba13..7596529dc 100644 --- a/mpm/CMakeLists.txt +++ b/mpm/CMakeLists.txt @@ -18,8 +18,8 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules) -set(UHD_HOST_ROOT ${CMAKE_SOURCE_DIR}/../host) -list(INSERT CMAKE_MODULE_PATH 0 ${UHD_HOST_ROOT}/cmake/Modules) +set(UHD_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../host) +list(INSERT CMAKE_MODULE_PATH 0 ${UHD_SOURCE_DIR}/cmake/Modules) ######################################################################## # Setup Python API ######################################################################## @@ -167,7 +167,7 @@ if(NOT ENABLE_SIM) include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include - ${UHD_HOST_ROOT}/include + ${UHD_SOURCE_DIR}/include ) add_subdirectory(lib) |