Error with CMake to generate ITK Module VTKGlue - cmake

I want to generate makefiles for ITK module VTKGlue but I have a message error:
CMake Error at Modules/Bridge/VtkGlue/itk-module-init.cmake:7
(find_package): Could not find a configuration file for package
"VTK" that is compatible with requested version "".
The following configuration files were considered but not accepted:
C:/ITK/bin/VTK/VTKConfig.cmake, version: 6.2.0 (64bit)
Call Stack (most recent call first):
CMake/ITKModuleEnablement.cmake:315 (include) CMakeLists.txt:364
(include)
The content of Modules/Bridge/VtkGlue/itk-module-init.cmake is :
#
Find the packages required by this module
#
Needed VTK version set(VERSION_MIN "5.10.0")
Look for VTK find_package(VTK NO_MODULE REQUIRED COMPONENTS vtkCommonCore)
What should I do?
Thanks

The solution is to rebuild VTK...
It has been built with the generator VS, whereas ITK is built with the generator Eclipse CDT.

Related

How to match major version only in cmake

I am trying to build a project that requires LLVM 11 as a dependency. They bundle a copy of LLVM 11.0.1. I want to build it against the system version, which is LLVM 11.1.0. In the cmake build files, they have:
find_package(LLVM 11.0 CONFIG)
If you try to use the system LLVM, you get the following error:
CMake Warning at 3rdparty/llvm.cmake:42 (find_package):
Could not find a configuration file for package "LLVM" that is compatible
with requested version "11.0".
The following configuration files were considered but not accepted:
/usr/lib/llvm/11/lib64/cmake/llvm/LLVMConfig.cmake, version: 11.1.0
/usr/lib/llvm/11/lib/cmake/llvm/LLVMConfig.cmake, version: 11.1.0
Call Stack (most recent call first):
3rdparty/CMakeLists.txt:436 (include)
I thought that changing the line to this would fix it:
find_package(LLVM 11 CONFIG)
but it doesn't, and I get the exact same error:
CMake Warning at 3rdparty/llvm.cmake:42 (find_package):
Could not find a configuration file for package "LLVM" that is compatible
with requested version "11".
The following configuration files were considered but not accepted:
/usr/lib/llvm/11/lib64/cmake/llvm/LLVMConfig.cmake, version: 11.1.0
/usr/lib/llvm/11/lib/cmake/llvm/LLVMConfig.cmake, version: 11.1.0
Call Stack (most recent call first):
3rdparty/CMakeLists.txt:436 (include)
What am I missing? Here is a full link to the code: https://github.com/RPCS3/rpcs3/blob/master/3rdparty/llvm.cmake
Whether a version is deemed compatible to the requested version is specified by the package you're trying to find. I haven't looked at the LLVM config, but I suspect it specifies that only the exact version is compatible instead of all versions with the same major version.
If you're running CMake 3.19 or later you can pass a version range to find_package, so you could try find_package(LLVM 11...<12 CONFIG) instead.

include library to clion project

I'm trying to include wxWidgets library in my project.
I'm working on Ubuntu 16.04. You can get wxWidgets from the repository (already compiled) and just include it by modifying a cmake file (included in CLion). It works fine doing just that.
However, I need to modify the sources and this means that I have to compile the library myself.
I followed the instructions from this file:
https://github.com/wxWidgets/wxWidgets/blob/v3.1.0/docs/gtk/install.txt
Now Cmake can't find the library.
What may be missing?
EDIT:
The part of CMake regarding wxWidgets :
find_package(wxWidgets 3.1.0 COMPONENTS core base media REQUIRED)
include(${wxWidgets_USE_FILE})
target_link_libraries(projectName ${wxWidgets_LIBRARIES})
Error:
CMake Error at /home/usrName/Clion/clion-2017.2/bin/cmake/share/cmake-
3.8/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find wxWidgets: Found unsuitable version "3.0.2", but required is
at least "3.1.0" (found
-L/usr/lib/x86_64-linux-gnu;-pthread;;;-lwx_gtk2u_core-3.0;-lwx_baseu-3.0;-
lwx_gtk2u_media-3.0)
Call Stack (most recent call first):
/home/usrName/Clion/clion-2017.2/bin/cmake/share/cmake-
3.8/Modules/FindPackageHandleStandardArgs.cmake:375 (_FPHSA_FAILURE_MESSAGE)
/home/usrName/Clion/clion-2017.2/bin/cmake/share/cmake-
3.8/Modules/FindwxWidgets.cmake:931 (find_package_handle_standard_args)
CMakeLists.txt:18 (find_package)

"OpenCV" is considered to be NOT FOUND

Linux Flavor: Debian (Crunch Bang)
Problem Occurred: When attempting to build cvblobs with the following command
cd ~/cvblob
cmake .
Error:
CMake Error at cvBlob/CMakeLists.txt:20 (find_package):
Found package configuration file:
/usr/local/share/OpenCV/OpenCVConfig.cmake
but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
NOT FOUND.
-- Configuring incomplete, errors occurred!
Well I met a similar problem when I was going with some other open source face detection modules rather than cvblobs.
Actually you will find that before these lines of error-info, there are:
CMake Warning at /usr/local/opencv-2.4.13/cmake/OpenCVConfig.cmake:163 (message):
Found OpenCV Windows Pack but it has not binaries compatible with your configuration.
You should manually point CMake variable OpenCV_DIR to your build of OpenCV library.
Call Stack (most recent call first):
CMakeLists.txt:57 (find_package)
CMake Warning at CMakeLists.txt:57 (find_package):
Found package configuration file:
/usr/local/opencv-2.4.13/cmake/OpenCVConfig.cmake
but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be NOT FOUND.
So you may notice that it asks you to manually point out the directory of you build version of OpenCV library.
For me, my source codes are at
/usr/local/opencv-2.4.13/
but I make and install my release build of OpenCV at
/usr/local/opencv-2.4.13/release/
so I use:
cmake -D OpenCV_DIR=/usr/local/opencv-2.4.13/release/ ..
and everything works:)
When I compile a program that use OpenCV lib, vision 2.4.8, occurs the similar error, when I point manually Opencv_DIR path to opencv/build ,visio 3.1.0, error occurred like you.
Then I point Opencv_DIR path to opencv/build whose vision is same to the program used. It works.
One of the reason could be the another OpenCV package in another path, that you had installed before. In my case, I had already installed OpenCV for Python in Anaconda package, and the CMake always wanted to refer me to that package.
I simply added:
set(OpenCV_FOUND 1)
to my CMakeList.txt file, this command simply override the other package you may had installed. The final version of CMakeList file which is working for me would be this:
set( OpenCV_FOUND 1 )
find_package(OpenCV 2.4.13 REQUIRED PATHS "C:/opencv")
set(SOURCE_FILES main.cpp)
add_executable(OpenCV_Test ${SOURCE_FILES})
Note:
1- I am using the CMakeList.txt file for Clion IDE
2- I am using it under windows. Probably you may set the relevant path if you use other OS
3- You need also change the OpenCV version if you use other version

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

Cmake Error for ITK with GDCM configuration

Following error found while configuring ITK with GDCM2.2
CMake Error at Modules/ThirdParty/GDCM/itk-module-init.cmake:5 (find_package):
By not providing "FindGDCM.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "GDCM", but
CMake did not find one.
Could not find a package configuration file provided by "GDCM" with any of
the following names:
GDCMConfig.cmake
gdcm-config.cmake
Add the installation prefix of "GDCM" to CMAKE_PREFIX_PATH or set
"GDCM_DIR" to a directory containing one of the above files. If "GDCM"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
CMakeLists.txt:558 (include)
I have installed GDCM2.2 [not repository] and manually set path of gdcm directory but still this error returned by Cmake.
Please help.
To build ITK with gdcm download .zip file of gdcm2.2.1 or latest version cause installing gdcm by exe is not include any GDCMconfig.cmake file but zip have it. And in ITK configuration we have to give path of directory where GDCMconfig.cmake is present.