How to solve the CMake warning for Volk and UHD package? - cmake

I am trying to create a custom block in GNU Radio which also needs to use UHD. As mentioned at this link, I added the following line to gr-module/CMakeLists.txt:
find_package(UHD "3.10.0")
But when I call the cmake../ command, I get the following two warnings:
1.The first one is for Volk.
CMake Warning (dev) at /usr/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (VOLK) does
not match the name of the calling package (Volk). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/home/sohaib/prefix-3.8/lib/cmake/volk/VolkConfig.cmake:32 (find_package_handle_standard_args)
/usr/share/cmake-3.21/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
/home/sohaib/prefix-3.8/lib/cmake/gnuradio/GnuradioConfig.cmake:46 (find_dependency)
CMakeLists.txt:89 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
2.The second one is for UHD.
CMake Warning (dev) at /usr/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (PkgConfig)
does not match the name of the calling package (UHD). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/usr/share/cmake-3.21/Modules/FindPkgConfig.cmake:70 (find_package_handle_standard_args)
/home/sohaib/prefix-3.8/lib/cmake/uhd/UHDConfig.cmake:42 (include)
/home/sohaib/prefix-3.8/lib/cmake/gnuradio/FindUHD.cmake:43 (find_package)
CMakeLists.txt:90 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
I built a custom block in GNU Radio a few weeks ago, and was not getting any warnings at that time. If I remove the find_package(UHD "3.10.0") line from CMakeLists.txt, I only get the warning for Volk.
How can this warning be solved?

You can't them (you could look for Volk instead of VOLK, but it might break things in other places) - you also don't have to, it's just warnings, so no action is needed.

Related

Could not find OpenSSL ... missing: OPENSSL_CRYPTO_LIBRARY

I am trying to cross-compile the aws-sdk-cpp and I am getting the following error just the very first time I run CMAKE. If I run it a second time it compiles and links and I have tested the application and I can indeed use the aws-sdk-cpp functionality. I have searched and searched for days and tried all kinds of things:
Setting environment variable for OPENSSL_ROOT_DIR
Setting it in a cmake variable, etc.
I print the OPENSSL_ROOT_DIR variable right before the call to
find_package(OpenSSL REQUIRED)
and it prints the right PATH.
I have also set the variable OPENSSL_USE_STATIC_LIBS to TRUE without any difference.
I honestly don't understand what is going on since if I run it a second time it builds and links just fine.
CMake Error at /snap/cmake/1035/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY
OPENSSL_INCLUDE_DIR) (found version "1.1.1n")
Call Stack (most recent call first):
/snap/cmake/1035/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
/snap/cmake/1035/share/cmake-3.22/Modules/FindOpenSSL.cmake:574 (find_package_handle_standard_args)
Projects/libraries/aws/s3/crt/aws-crt-cpp/crt/aws-c-cal/CMakeLists.txt:89 (find_package)
Ok so I have figured what was going on.
the issue was that I was setting the values for
OPENSSL_INCLUDE_DIR
OPENSSL_CRYPTO_LIBRARY
OPENSSL_SSL_LIBRARY
Once I deleted them it worked.

Why does find_package(MPI) generate a warning message?

I'm using CMake 3.22.0-rc2. When I run:
find_package(MPI)
I get the warning:
CMake Warning (dev) at /opt/versions/cmake/3.22.0-rc2/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (PkgConfig)
does not match the name of the calling package (MPI). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/opt/versions/cmake/3.22.0-rc2/share/cmake-3.22/Modules/FindPkgConfig.cmake:88 (find_package_handle_standard_args)
/opt/versions/cmake/3.22.0-rc2/share/cmake-3.22/Modules/FindMPI.cmake:270 (include)
examples/multi-gpu-programming-models/CMakeLists.txt:2 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
I realize I can suppress this error, but - does it have anything to do with what I've got in my CMakeLists.txt or is this some sort of internal CMake (semi-)bug?
This warning has recently been fixed in https://github.com/Kitware/CMake/commit/56d949f05f37c65401825a30be0d39bd152cc33c.
It was incorrect inclusion of module FindPkgConfig.cmake via
include(${CMAKE_CURRENT_LIST_DIR}/FindPkgConfig.cmake)
With such inclusion the call to find_package_handle_standard_args performed inside FindPkgConfig.cmake is interpreted as from the FindMPI.cmake module, because the latest find_package call has MPI argument instead of PkgConfig.
All modules like FindXXX.cmake should be included via find_package:
find_package(PkgConfig)

CMake on Linux: missing wxWidgets_LIBRARIES

I'm compiling a program from sources, which uses wxWidgets on Linux.
I have set the following variables in CMakeLists.txt:
SET(wxWidgets_ROOT_DIR ~/Downloads/wxWidgets-3.1.3)
SET(wxWidgets_LIBRARIES ~/Downloads/wxWidgets-3.1.3/lib)
SET(wxWidgets_LIB_DIR ~/Downloads/wxWidgets-3.1.3/lib)
SET(wxWidgets_INCLUDE_DIRS ~/Downloads/wxWidgets-3.1.3/include/wx)
#SET(wxWidgets_VERSION_STRING "3.1.3")
SET(wxWidgets_CONFIGURATION mswu)
SET(WX_ROOT_DIR ~/Downloads/wxWidgets-3.1.3)
And get an error:
Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES)
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.10/Modules/FindwxWidgets.cmake:953 (find_package_handle_standard_args)
CMakeLists.txt:173 (FIND_PACKAGE)
CMakeLists.txt:173 contains the following:
FIND_PACKAGE(wxWidgets REQUIRED base core aui xrc html xml adv gl net qa)
Any idea what I need to do?

CMake find_package() Eclipse, OS X

I managed to create Make Target in Eclipse and add a CMakeListst.txt to a very simple project and it worked.
Now, my next step is to use two external libraries, Boost and Eigen.
My project is in /Users/MyUser/Documents/workspace/Test
The libraries are /Users/MyUser/Documents/MyLib/Libraries
Now, in the CMakeLists.txt file I try to find Boost and Eigen, which are in the libraries folder, but always the returned message is
CMake Error at CMake/TPLs/FindBoost.cmake:1126 (message): Unable to
find the requested Boost libraries.
Unable to find the Boost header files. Please set BOOST_ROOT to the
root directory containing Boost or BOOST_INCLUDEDIR to the directory
containing Boost's headers. Call Stack (most recent call first):
CMakeLists.txt:23 (FIND_PACKAGE)
-- Configuring incomplete, errors occurred! CMake Error at /Applications/CMake
2.8-11.app/Contents/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108
(message): Could NOT find Eigen3 (missing: EIGEN3_INCLUDE_DIRS
EIGEN3_VERSION_OK) (Required is at least version "2.91.0") Call
Stack (most recent call first): /Applications/CMake
2.8-11.app/Contents/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315
(_FPHSA_FAILURE_MESSAGE) CMake/TPLs/FindEigen3.cmake:76
(find_package_handle_standard_args) CMakeLists.txt:30 (FIND_PACKAGE)
I am new to CMake, so I must be missing some way to tell CMake to search in my library folder. How can I find the packages with CMake when building the project?
BTW I'm working under Mac OS X Mavericks.
EDIT
Reading through the file FindEigen3.cmake there should be a variable called EIGEN3_INCLUDE_DIRS that points to the include directory of Eigen, is this true?
Now, from the following message
Could NOT find Eigen3 (missing: EIGEN3_INCLUDE_DIRS EIGEN3_VERSION_OK)
I would think that cmake is actually finding that directory as it says EIGEN3_VERSION_OK but then why can't cmake find the rest of the include files?
Am I still missing something? I created the environment variable within Eclipse and then add a line to the FindEigen3.cmake to test the value of the environment variable EIGEN3_INCLUDE_DIRS
message(STATUS "Eigen version: ${EIGEN3_INCLUDE_DIRS}")
But the message I'm getting is
--Eigen version: EIGEN3_INCLUDE_DIRS-NOTFOUND
Any advise?
EDIT
I tried with the question-related answers but none was able to make Eclipse+CMake find Boost and Eigen libraries. I guess the problem here is how to make Eclipse recognize the system variables.
When you do not believe in setting environment variables in Eclipse, you can pass Cmake-defines either directly to cmake command:
cmake -E chdir Release/ cmake -G "Unix Makefiles" ... -DBOOST_ROOT:PATHNAME=boost/install/dir ...
or define them in your CMakeLists.txt before find boost/eigen3
SET(BOOST_ROOT boost/install/dir)
...
FIND_PACKAGE(BOOST ... )
or use environment variables within your OS/shell. You must define them before launching the Eclipse. E.g. from bash, do
export BOOST_ROOT=boost/install/dir
eclipse
Note that you have to define all variables needed for both boost and eigen3. You can place some debugging messages in your CMakeLists.txt to confirm that you pass them correctly:
MESSAGE("Boost root: ${BOOST_ROOT}")

Pkgconfig cant find a package

I am using pkgconfig in cmake to link to an external library. Even though there exists a exteral_package.pc file (with apparently correct information), cmake is throwing me an error.
The CMakeLists file looks something like this:
project(juicer)
set(VERSION 1.0)
# Find packages
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
find_package(Tracter REQUIRED)
And the FindTracter file looks like this:
find_package(PkgConfig)
pkg_check_modules(TRACTER REQUIRED tracter)
Error:
-- checking for module 'tracter'
-- package 'tracter' not found
CMake Error at /usr/share/cmake-2.8/Modules/FindPkgConfig.cmake:279 (message):
A required package was not found
Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/FindPkgConfig.cmake:333 (_pkg_check_modules_internal)
cmake/FindTracter.cmake:10 (pkg_check_modules)
CMakeLists.txt:22 (find_package)
I am new to using CMake and your help is very much appreciated.
Thanks
Akshat