[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 01/05: cmake: fix FindUHD.cmake to work wit
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 01/05: cmake: fix FindUHD.cmake to work with UHDConfig*.cmake, not FindUHD.cmake, since that's what UHD will be installing. UHDConfig* is a more robust way to find packages, and works with default CMake internal paths. |
Date: |
Tue, 26 Aug 2014 18:02:40 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 13deb30aed1500b43916ea5f0b4ee056081dede7
Author: Michael Dickens <address@hidden>
Date: Mon Aug 25 13:19:17 2014 -0400
cmake: fix FindUHD.cmake to work with UHDConfig*.cmake, not FindUHD.cmake,
since that's what UHD will be installing. UHDConfig* is a more robust way to
find packages, and works with default CMake internal paths.
---
cmake/Modules/FindUHD.cmake | 118 +++++++++++++++++---------------------------
1 file changed, 44 insertions(+), 74 deletions(-)
diff --git a/cmake/Modules/FindUHD.cmake b/cmake/Modules/FindUHD.cmake
index 9f69699..d4d2069 100644
--- a/cmake/Modules/FindUHD.cmake
+++ b/cmake/Modules/FindUHD.cmake
@@ -2,84 +2,44 @@
# Find the library for the USRP Hardware Driver
########################################################################
-# First check to see if UHD installed its own version
-# of FindUHD, and if so use it.
+# First check to see if UHD installed its own CMake files
-unset(UHD_FOUND)
-
-# obvious locations for FindUHD.cmake to already be installed are:
-# ${prefix}/share/cmake-X.Y/Modules (${CMAKE_ROOT})
-# ${prefix}/share/cmake/Modules
-# ${prefix}/lib/cmake
-# ${prefix}/lib64/cmake
-
-get_filename_component(CMAKE_ROOT_PARENT "${CMAKE_ROOT}" PATH)
-
-find_path(
- LOCAL_FINDUHD_DIR
- NAMES FindUHD.cmake
- PATH_SUFFIXES cmake cmake/Modules Modules
- HINTS ${CMAKE_MODULES_DIR}
- PATHS ${CMAKE_ROOT}
- ${CMAKE_ROOT_PARENT}
- ${CMAKE_INSTALL_PREFIX}/lib
- ${CMAKE_INSTALL_PREFIX}/lib64
-)
+# save the current MODULE path
+set(SAVED_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
-if(LOCAL_FINDUHD_DIR)
-
- # save the current MODULE path
- set(SAVED_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
-
- # remove the current directory from the MODULE path
- list(REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
-
- # prepend the found directory to the MODULE path
- list(INSERT CMAKE_MODULE_PATH 0 ${LOCAL_FINDUHD_DIR})
-
- # "QUIET" works on CMake 2.8+ only
- unset(LOCAL_UHD_QUIET)
- if(NOT ${CMAKE_VERSION} VERSION_LESS "2.8.0")
- set(LOCAL_UHD_QUIET "QUIET")
- endif()
-
- # set REQUIRED, as directed
- unset(LOCAL_UHD_REQUIRED)
- if(UHD_FIND_REQUIRED)
- set(LOCAL_UHD_REQUIRED "REQUIRED")
- endif(UHD_FIND_REQUIRED)
-
- # set VERSION to be checking, as directed
- unset(LOCAL_UHD_VERSION)
- if(UHD_FIND_VERSION)
- set(LOCAL_UHD_VERSION "${UHD_FIND_VERSION}")
- endif(UHD_FIND_VERSION)
-
- # set EXACT, as directed, but only if VERSION was specified
- unset(LOCAL_UHD_VERSION_EXACT)
- if(UHD_FIND_VERSION_EXACT)
- if(LOCAL_UHD_VERSION)
- set(LOCAL_UHD_VERSION_EXACT "EXACT")
- endif(LOCAL_UHD_VERSION)
- endif(UHD_FIND_VERSION_EXACT)
-
- # try to find UHD using the already-installed FindUHD, as directed
- find_package(
- UHD ${LOCAL_UHD_VERSION} ${LOCAL_UHD_VERSION_EXACT}
- ${LOCAL_UHD_REQUIRED} ${LOCAL_UHD_QUIET}
- )
+# remove the current directory from the MODULE path
+list(REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
- # restore CMAKE_MODULE_PATH
-
- set(CMAKE_MODULE_PATH ${SAVED_CMAKE_MODULE_PATH})
+# try to find UHD via the provided parameters,
+# handle REQUIRED internally later
+unset(UHD_FOUND)
- # print the standard message iff UHD was found
- if(UHD_FOUND)
- include(FindPackageHandleStandardArgs)
- find_package_handle_standard_args(UHD DEFAULT_MSG UHD_LIBRARIES
UHD_INCLUDE_DIRS)
- endif(UHD_FOUND)
+# try quietly when possible (CMake 2.8+).
+if(NOT ${CMAKE_VERSION} VERSION_LESS "2.8.0")
+ set(UHD_QUIET "QUIET")
+endif()
+
+# was the version specified?
+unset(LOCAL_UHD_FIND_VERSION)
+if(UHD_FIND_VERSION)
+ set(LOCAL_UHD_FIND_VERSION ${UHD_FIND_VERSION})
+endif(UHD_FIND_VERSION)
+
+# was EXACT specified?
+unset(LOCAL_UHD_FIND_VERSION_EXACT)
+if(UHD_FIND_VERSION_EXACT)
+ set(LOCAL_UHD_FIND_VERSION_EXACT "EXACT")
+endif(UHD_FIND_VERSION_EXACT)
+
+# try to find UHDConfig using the desired parameters;
+# UHDConfigVersion will catch a pass-through version bug ...
+find_package(
+ UHD ${LOCAL_UHD_FIND_VERSION}
+ ${LOCAL_UHD_FIND_VERSION_EXACT} ${UHD_QUIET}
+)
-endif(LOCAL_FINDUHD_DIR)
+# restore CMAKE_MODULE_PATH
+set(CMAKE_MODULE_PATH ${SAVED_CMAKE_MODULE_PATH})
# check if UHD was found above
if(NOT UHD_FOUND)
@@ -106,9 +66,19 @@ if(NOT UHD_FOUND)
PATHS /usr/local/lib
/usr/lib
)
+endif(NOT UHD_FOUND)
+
+if(UHD_LIBRARIES AND UHD_INCLUDE_DIRS)
+
+ # if UHDConfig set UHD_FOUND==TRUE, then these have already been
+ # done, but done quietly. It does not hurt to redo them here.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(UHD DEFAULT_MSG UHD_LIBRARIES
UHD_INCLUDE_DIRS)
mark_as_advanced(UHD_LIBRARIES UHD_INCLUDE_DIRS)
-endif(NOT UHD_FOUND)
+elseif(UHD_FIND_REQUIRED)
+
+ message(FATAL_ERROR "UHD is required, but was not found.")
+
+endif()
- [Commit-gnuradio] [gnuradio] branch master updated (df693a9 -> 99e0c0a), git, 2014/08/26
- [Commit-gnuradio] [gnuradio] 01/05: cmake: fix FindUHD.cmake to work with UHDConfig*.cmake, not FindUHD.cmake, since that's what UHD will be installing. UHDConfig* is a more robust way to find packages, and works with default CMake internal paths.,
git <=
- [Commit-gnuradio] [gnuradio] 05/05: Merge branch 'maint', git, 2014/08/26
- [Commit-gnuradio] [gnuradio] 04/05: Merge remote-tracking branch 'michaelld/refix_findUHD', git, 2014/08/26
- [Commit-gnuradio] [gnuradio] 03/05: qtgui: fixup GRC XML for new QT Vector Sink, git, 2014/08/26
- [Commit-gnuradio] [gnuradio] 02/05: qtgui: Added a 'vector sink'., git, 2014/08/26