aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorMichael Dickens <michael.dickens@ettus.com>2021-06-25 15:41:57 -0400
committerMartin Braun <martin@gnuradio.org>2021-07-06 04:29:55 -0700
commitd922ad3d61abd8e0cfbcbf76a800093e6ba838b3 (patch)
treec19431bf2a7589d40d42f86794908fe4c4cfe5cc /host
parentc1c05e94b61eb4e6935bfb14ddc338afae9d96d1 (diff)
downloaduhd-d922ad3d61abd8e0cfbcbf76a800093e6ba838b3.tar.gz
uhd-d922ad3d61abd8e0cfbcbf76a800093e6ba838b3.tar.bz2
uhd-d922ad3d61abd8e0cfbcbf76a800093e6ba838b3.zip
cmake: correctly set and unset any CMAKE_REQUIRED variables
Diffstat (limited to 'host')
-rw-r--r--host/cmake/Modules/FindLIBUSB.cmake3
-rw-r--r--host/lib/convert/CMakeLists.txt4
-rw-r--r--host/lib/utils/CMakeLists.txt10
3 files changed, 10 insertions, 7 deletions
diff --git a/host/cmake/Modules/FindLIBUSB.cmake b/host/cmake/Modules/FindLIBUSB.cmake
index 9c404f68e..f574df916 100644
--- a/host/cmake/Modules/FindLIBUSB.cmake
+++ b/host/cmake/Modules/FindLIBUSB.cmake
@@ -57,6 +57,9 @@ if(HAVE_LIBUSB_STRERROR)
list(APPEND LIBUSB_DEFINITIONS "HAVE_LIBUSB_STRERROR=1")
endif(HAVE_LIBUSB_STRERROR)
+unset(CMAKE_REQUIRED_INCLUDES)
+unset(CMAKE_REQUIRED_LIBRARIES)
+
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LIBUSB DEFAULT_MSG LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIRS)
mark_as_advanced(LIBUSB_INCLUDE_DIRS LIBUSB_LIBRARIES)
diff --git a/host/lib/convert/CMakeLists.txt b/host/lib/convert/CMakeLists.txt
index f9128fe16..aee62c82f 100644
--- a/host/lib/convert/CMakeLists.txt
+++ b/host/lib/convert/CMakeLists.txt
@@ -23,12 +23,12 @@ endif()
set(CMAKE_REQUIRED_FLAGS ${EMMINTRIN_FLAGS})
CHECK_INCLUDE_FILE_CXX(emmintrin.h HAVE_EMMINTRIN_H)
-set(CMAKE_REQUIRED_FLAGS)
+unset(CMAKE_REQUIRED_FLAGS)
if(ENABLE_SSSE3)
set(CMAKE_REQUIRED_FLAGS ${TMMINTRIN_FLAGS})
CHECK_INCLUDE_FILE_CXX(tmmintrin.h HAVE_TMMINTRIN_H)
-set(CMAKE_REQUIRED_FLAGS)
+unset(CMAKE_REQUIRED_FLAGS)
endif(ENABLE_SSSE3)
if(HAVE_EMMINTRIN_H)
diff --git a/host/lib/utils/CMakeLists.txt b/host/lib/utils/CMakeLists.txt
index 7e95d8c28..fb796efba 100644
--- a/host/lib/utils/CMakeLists.txt
+++ b/host/lib/utils/CMakeLists.txt
@@ -43,8 +43,6 @@ CHECK_CXX_SOURCE_COMPILES("
" HAVE_WIN_SETTHREADPRIORITY
)
-
-
if(HAVE_PTHREAD_SETSCHEDPARAM)
message(STATUS " Priority scheduling supported through pthread_setschedparam.")
list(APPEND THREAD_PRIO_DEFS HAVE_PTHREAD_SETSCHEDPARAM)
@@ -62,7 +60,6 @@ endif()
########################################################################
set(CMAKE_REQUIRED_LIBRARIES "pthread")
-
CHECK_CXX_SOURCE_COMPILES("
#include <pthread.h>
int main(){
@@ -73,6 +70,7 @@ CHECK_CXX_SOURCE_COMPILES("
}
" HAVE_PTHREAD_SETNAME
)
+unset(CMAKE_REQUIRED_LIBRARIES)
if(CYGWIN)
#SCHED_RR non-operational on cygwin
@@ -92,6 +90,7 @@ endif()
# Setup defines for thread affinitizing
########################################################################
+set(CMAKE_REQUIRED_LIBRARIES "pthread")
CHECK_CXX_SOURCE_COMPILES("
#include <pthread.h>
int main(){
@@ -102,6 +101,7 @@ CHECK_CXX_SOURCE_COMPILES("
}
" HAVE_PTHREAD_SETAFFINITY_NP
)
+unset(CMAKE_REQUIRED_LIBRARIES)
if(CYGWIN)
set(HAVE_PTHREAD_SETAFFINITY_NP False)
@@ -115,6 +115,7 @@ CHECK_CXX_SOURCE_COMPILES("
}
" HAVE_WIN_SETTHREADAFFINITYMASK
)
+
if(HAVE_PTHREAD_SETAFFINITY_NP)
message(STATUS " Setting thread affinity is supported through pthread_setaffinity_np.")
list(APPEND THREAD_PRIO_DEFS HAVE_PTHREAD_SETAFFINITY_NP)
@@ -127,7 +128,6 @@ else()
list(APPEND THREAD_PRIO_DEFS HAVE_THREAD_SETAFFINITY_DUMMY)
endif()
-
set_source_files_properties(
${CMAKE_CURRENT_SOURCE_DIR}/thread.cpp
PROPERTIES COMPILE_DEFINITIONS "${THREAD_PRIO_DEFS}"
@@ -149,7 +149,7 @@ CHECK_CXX_SOURCE_COMPILES("
}
" HAVE_DLOPEN
)
-set(CMAKE_REQUIRED_LIBRARIES)
+unset(CMAKE_REQUIRED_LIBRARIES)
CHECK_CXX_SOURCE_COMPILES("
#define WIN32_LEAN_AND_MEAN