diff options
Diffstat (limited to 'cmake/Modules')
-rw-r--r-- | cmake/Modules/FindUHD.cmake | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/cmake/Modules/FindUHD.cmake b/cmake/Modules/FindUHD.cmake index cfb89b11ce..21cb0942c3 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() |