Skip to content

Commit

Permalink
build: Fix CMake compatibility (closes #2884)
Browse files Browse the repository at this point in the history
  • Loading branch information
zuckschwerdt committed Mar 24, 2024
1 parent afb5b34 commit 7751b57
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ if("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
endif()

# Enable Static analysis on GCC13.2.0+
if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "13.2.0")
if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" AND NOT "13.2.0" VERSION_GREATER CMAKE_C_COMPILER_VERSION)
message(STATUS "Using GCC Static analysis")
add_definitions(-fanalyzer)
endif()
Expand Down
2 changes: 2 additions & 0 deletions cmake/Modules/FindLibRTLSDR.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ set(LibRTLSDR_VERSION ${PC_LibRTLSDR_VERSION})
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LibRTLSDR_FOUND to TRUE
# if all listed variables are TRUE
# Note that `FOUND_VAR LibRTLSDR_FOUND` is needed for cmake 3.2 and older.
find_package_handle_standard_args(LibRTLSDR
FOUND_VAR LibRTLSDR_FOUND
REQUIRED_VARS LibRTLSDR_LIBRARY LibRTLSDR_INCLUDE_DIR
VERSION_VAR LibRTLSDR_VERSION)

Expand Down
2 changes: 2 additions & 0 deletions cmake/Modules/FindLibUSB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ set(LibUSB_VERSION ${PC_LibUSB_VERSION})
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LibUSB_FOUND to TRUE
# if all listed variables are TRUE
# Note that `FOUND_VAR LibRTLSDR_FOUND` is needed for cmake 3.2 and older.
find_package_handle_standard_args(LibUSB
FOUND_VAR LibUSB_FOUND
REQUIRED_VARS LibUSB_LIBRARY LibUSB_INCLUDE_DIR
VERSION_VAR LibUSB_VERSION)

Expand Down
4 changes: 2 additions & 2 deletions cmake/Modules/GetGitRevisionDescription.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function(git_describe _var)
if(NOT GIT_FOUND AND CMAKE_HOST_WIN32)
# fallback to VS bundled Git
find_program(GIT_EXECUTABLE NAMES git PATH_SUFFIXES Git/cmd Git/bin)
find_package_handle_standard_args(Git REQUIRED_VARS GIT_EXECUTABLE)
find_package_handle_standard_args(Git FOUND_VAR GIT_FOUND REQUIRED_VARS GIT_EXECUTABLE)
endif()
if(NOT GIT_FOUND)
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
Expand Down Expand Up @@ -156,7 +156,7 @@ function(git_timestamp _var)
if(NOT GIT_FOUND AND CMAKE_HOST_WIN32)
# fallback to VS bundled Git
find_program(GIT_EXECUTABLE NAMES git PATH_SUFFIXES Git/cmd Git/bin)
find_package_handle_standard_args(Git REQUIRED_VARS GIT_EXECUTABLE)
find_package_handle_standard_args(Git FOUND_VAR GIT_FOUND REQUIRED_VARS GIT_EXECUTABLE)
endif()
if(NOT GIT_FOUND)
return()
Expand Down
8 changes: 8 additions & 0 deletions docs/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ E.g. use:

cmake -DENABLE_SOAPYSDR=ON ..

::: tip
If you use CMake older than 3.13 (check `cmake --version`), you need to build using e.g. `mkdir build ; cd build ; cmake .. && cmake --build .`
:::

::: tip
In CMake 3.6 or older the OpenSSL search seems broken, you need to use `cmake -DENABLE_OPENSSL=NO ..`
:::

::: warning
If you experience trouble with SoapySDR when compiling or running: you likely mixed version 0.7 and version 0.8 headers and libs.
Purge all SoapySDR packages and source installation from /usr/local.
Expand Down

0 comments on commit 7751b57

Please sign in to comment.