aboutsummaryrefslogtreecommitdiffstats
path: root/host/CMakeLists.txt
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/CMakeLists.txt
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/CMakeLists.txt')
-rw-r--r--host/CMakeLists.txt26
1 files changed, 13 insertions, 13 deletions
diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt
index 3d60fa833..b741881d0 100644
--- a/host/CMakeLists.txt
+++ b/host/CMakeLists.txt
@@ -18,7 +18,7 @@ project(UHD CXX C)
enable_testing()
#make sure our local CMake Modules path comes first
-list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules)
+list(INSERT CMAKE_MODULE_PATH 0 ${UHD_SOURCE_DIR}/cmake/Modules)
########################################################################
# UHD Dependency Minimum Versions
@@ -171,8 +171,8 @@ endif(DEFINED UHD_IMAGES_DIR_WINREG_KEY)
########################################################################
# Local Include Dir
########################################################################
-include_directories(${CMAKE_BINARY_DIR}/include)
-include_directories(${CMAKE_SOURCE_DIR}/include)
+include_directories(${UHD_BINARY_DIR}/include)
+include_directories(${UHD_SOURCE_DIR}/include)
########################################################################
# Static Lib Configuration
@@ -250,7 +250,7 @@ if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR
endif()
if(MSVC)
- include_directories(${CMAKE_SOURCE_DIR}/cmake/msvc)
+ include_directories(${UHD_SOURCE_DIR}/cmake/msvc)
add_definitions( #stop all kinds of compatibility warnings
-DWIN32_LEAN_AND_MEAN
-DVC_EXTRALEAN
@@ -396,7 +396,7 @@ endif(ENABLE_QEMU_UNITTESTS)
# Create Uninstall Target
########################################################################
configure_file(
- ${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
+ ${UHD_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
@ONLY)
@@ -509,20 +509,20 @@ endif(ENABLE_USB)
set(UHD_RFNOC_FOUND "TRUE")
configure_file(
- ${CMAKE_SOURCE_DIR}/cmake/Modules/UHDConfigVersion.cmake.in
- ${CMAKE_BINARY_DIR}/cmake/Modules/UHDConfigVersion.cmake
+ ${UHD_SOURCE_DIR}/cmake/Modules/UHDConfigVersion.cmake.in
+ ${UHD_BINARY_DIR}/cmake/Modules/UHDConfigVersion.cmake
@ONLY
)
configure_file(
- ${CMAKE_SOURCE_DIR}/cmake/Modules/UHDConfig.cmake.in
- ${CMAKE_BINARY_DIR}/cmake/Modules/UHDConfig.cmake
+ ${UHD_SOURCE_DIR}/cmake/Modules/UHDConfig.cmake.in
+ ${UHD_BINARY_DIR}/cmake/Modules/UHDConfig.cmake
@ONLY
)
set(uhd_cmake_scripts
- ${CMAKE_BINARY_DIR}/cmake/Modules/UHDConfig.cmake
- ${CMAKE_BINARY_DIR}/cmake/Modules/UHDConfigVersion.cmake
- ${CMAKE_SOURCE_DIR}/cmake/Modules/UHDBoost.cmake
+ ${UHD_BINARY_DIR}/cmake/Modules/UHDConfig.cmake
+ ${UHD_BINARY_DIR}/cmake/Modules/UHDConfigVersion.cmake
+ ${UHD_SOURCE_DIR}/cmake/Modules/UHDBoost.cmake
)
UHD_INSTALL(
@@ -536,7 +536,7 @@ UHD_INSTALL(
########################################################################
if(DEFINED UHD_IMAGES_SRC_DIR AND EXISTS "${UHD_IMAGES_SRC_DIR}")
message(STATUS "Reading images from directory `${UHD_IMAGES_SRC_DIR}'")
- file(GLOB_RECURSE _image_files RELATIVE "${CMAKE_SOURCE_DIR}" "${UHD_IMAGES_SRC_DIR}/*")
+ file(GLOB_RECURSE _image_files RELATIVE "${UHD_SOURCE_DIR}" "${UHD_IMAGES_SRC_DIR}/*")
message(STATUS "These images files will be installed/packaged:")
foreach(_img ${_image_files})
message(STATUS " ${_img}")