aboutsummaryrefslogtreecommitdiffstats
path: root/host/cmake/Modules/UHDPackage.cmake
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/cmake/Modules/UHDPackage.cmake
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/cmake/Modules/UHDPackage.cmake')
-rw-r--r--host/cmake/Modules/UHDPackage.cmake24
1 files changed, 12 insertions, 12 deletions
diff --git a/host/cmake/Modules/UHDPackage.cmake b/host/cmake/Modules/UHDPackage.cmake
index 4d507493b..2ccbed6e5 100644
--- a/host/cmake/Modules/UHDPackage.cmake
+++ b/host/cmake/Modules/UHDPackage.cmake
@@ -110,8 +110,8 @@ set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ettus Research - USRP Hardware Driver")
set(CPACK_PACKAGE_VENDOR "Ettus Research (National Instruments)")
set(CPACK_PACKAGE_CONTACT "Ettus Research <support@ettus.com>")
set(CPACK_PACKAGE_VERSION "${UHD_VERSION}")
-set(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_SOURCE_DIR}/README.md)
-set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE)
+set(CPACK_RESOURCE_FILE_WELCOME ${UHD_SOURCE_DIR}/README.md)
+set(CPACK_RESOURCE_FILE_LICENSE ${UHD_SOURCE_DIR}/LICENSE)
########################################################################
# Setup CPack Source
@@ -165,16 +165,16 @@ set(CPACK_COMPONENTS_ALL libraries pythonapi headers utilities examples manual d
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-all-dev, python3-requests")
set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "python3, python3-tk")
foreach(filename preinst postinst prerm postrm)
- list(APPEND CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${CMAKE_BINARY_DIR}/debian/${filename})
- file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/debian)
+ list(APPEND CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${UHD_BINARY_DIR}/debian/${filename})
+ file(MAKE_DIRECTORY ${UHD_BINARY_DIR}/debian)
configure_file(
- ${CMAKE_SOURCE_DIR}/cmake/debian/${filename}.in
- ${CMAKE_BINARY_DIR}/debian/${filename}
+ ${UHD_SOURCE_DIR}/cmake/debian/${filename}.in
+ ${UHD_BINARY_DIR}/debian/${filename}
@ONLY)
endforeach(filename)
configure_file(
- ${CMAKE_SOURCE_DIR}/cmake/debian/watch
- ${CMAKE_BINARY_DIR}/debian/watch
+ ${UHD_SOURCE_DIR}/cmake/debian/watch
+ ${UHD_BINARY_DIR}/debian/watch
@ONLY)
########################################################################
@@ -185,11 +185,11 @@ set(CPACK_RPM_PACKAGE_REQUIRES "boost-devel, python3-requests")
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/share/man;/usr/share/man/man1;/usr/lib64/pkgconfig;/usr/lib64/cmake;/usr/lib64/python2.7;/usr/lib64/python2.7/site-packages")
foreach(filename post_install post_uninstall pre_install pre_uninstall)
string(TOUPPER ${filename} filename_upper)
- list(APPEND CPACK_RPM_${filename_upper}_SCRIPT_FILE ${CMAKE_BINARY_DIR}/redhat/${filename})
- file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/redhat)
+ list(APPEND CPACK_RPM_${filename_upper}_SCRIPT_FILE ${UHD_BINARY_DIR}/redhat/${filename})
+ file(MAKE_DIRECTORY ${UHD_BINARY_DIR}/redhat)
configure_file(
- ${CMAKE_SOURCE_DIR}/cmake/redhat/${filename}.in
- ${CMAKE_BINARY_DIR}/redhat/${filename}
+ ${UHD_SOURCE_DIR}/cmake/redhat/${filename}.in
+ ${UHD_BINARY_DIR}/redhat/${filename}
@ONLY)
endforeach(filename)