commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 01/03: cmake: FindUHD: add in checks to see


From: git
Subject: [Commit-gnuradio] [gnuradio] 01/03: cmake: FindUHD: add in checks to see whether UHDConfig*.cmake were used via the ENV variables; CACHE variables are unreliable from withing UHDConfig*.cmake for some reason. In the case where UHDConfig*.cmake were used, do not do checking for UHD here. Print out appropriate errors if REQUIRED is set.
Date: Mon, 13 Oct 2014 21:00:47 +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 037ddca197674da611f2a8ffceab45e9134eb9bc
Author: Michael Dickens <address@hidden>
Date:   Wed Sep 24 13:35:24 2014 -0400

    cmake: FindUHD: add in checks to see whether UHDConfig*.cmake were used via 
the ENV variables; CACHE variables are unreliable from withing UHDConfig*.cmake 
for some reason.  In the case where UHDConfig*.cmake were used, do not do 
checking for UHD here.  Print out appropriate errors if REQUIRED is set.
---
 cmake/Modules/FindUHD.cmake | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/cmake/Modules/FindUHD.cmake b/cmake/Modules/FindUHD.cmake
index cfb89b1..21cb094 100644
--- a/cmake/Modules/FindUHD.cmake
+++ b/cmake/Modules/FindUHD.cmake
@@ -2,7 +2,7 @@
 # Find the library for the USRP Hardware Driver
 ########################################################################
 
-# make this file non-reentrant
+# make this file non-reentrant within the current context
 if(__INCLUDED_FIND_UHD_CMAKE)
     return()
 endif()
@@ -20,6 +20,12 @@ unset(CMAKE_MODULE_PATH)
 # handle REQUIRED internally later
 unset(UHD_FOUND)
 
+# set that UHDConfig.cmake was not used. Have to use the ENV, since
+# UHDConfigVersion does not allow CACHE changes and UHDConfig might
+# not allow CACHE changes.
+set(ENV{UHD_CONFIG_USED} FALSE)
+set(ENV{UHD_CONFIG_VERSION_USED} FALSE)
+
 # was the version specified?
 unset(LOCAL_UHD_FIND_VERSION)
 if(UHD_FIND_VERSION)
@@ -42,10 +48,10 @@ find_package(
 # restore CMAKE_MODULE_PATH
 set(CMAKE_MODULE_PATH ${SAVED_CMAKE_MODULE_PATH})
 
-# check if UHD was found above
-if(NOT UHD_FOUND)
+# check if UHDConfig was used above
+if(NOT $ENV{UHD_CONFIG_VERSION_USED})
 
-  # Not found; try the "old" method (not as robust)
+  # Not used; try the "old" method (not as robust)
 
   include(FindPkgConfig)
   pkg_check_modules(PC_UHD uhd)
@@ -67,7 +73,7 @@ if(NOT UHD_FOUND)
     PATHS /usr/local/lib
           /usr/lib
   )
-endif(NOT UHD_FOUND)
+endif(NOT $ENV{UHD_CONFIG_VERSION_USED})
 
 if(UHD_LIBRARIES AND UHD_INCLUDE_DIRS)
 
@@ -79,7 +85,9 @@ if(UHD_LIBRARIES AND UHD_INCLUDE_DIRS)
   mark_as_advanced(UHD_LIBRARIES UHD_INCLUDE_DIRS)
 
 elseif(UHD_FIND_REQUIRED)
-
-  message(FATAL_ERROR "UHD is required, but was not found.")
-
+  if($ENV{UHD_CONFIG_VERSION_USED} AND NOT $ENV{UHD_CONFIG_USED})
+    message(FATAL_ERROR "The found UHD version ($ENV{UHD_PACKAGE_VERSION}) is 
not compatible with the version required (${UHD_FIND_VERSION}).")
+  else()
+    message(FATAL_ERROR "UHD is required, but was not found.")
+  endif()
 endif()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]