CMake VTK_DIR-NOTFOUND

12,537

Solution 1

The first thing I would check is what is the actual find_package() command being invoked where the error occurs? Perhaps that call is something a bit unusual or explicitly has the MODULE keyword (this would prevent the VTKConfig.cmake file from being found).

If that looks okay, check to see if something is modifying the VTK_DIR variable. Insert the following near the top of your top-most CMakeLists.txt file:

variable_watch(VTK_DIR)

This should tell you what, if anything, is modifying it in ways you didn't expect.

Assuming VTK_DIR is not actually being changed, the next thing you could try is setting CMAKE_PREFIX_PATH to the directory containing the VTKConfig.cmake file (you can add this in the CMake GUI if it isn't there already). Maybe also try variable_watch(CMAKE_PREFIX_PATH) too just in case something is modifying that internally in unexpected was as well.

If that still doesn't reveal anything, then it would seem likely that there is something wrong with either your CMake or VTK installation. Perhaps try an earlier CMake version and see if you get any different behaviour.

Solution 2

Although the currently accepted answer is a good way of debugging, it looks like you're building Point Cloud Library (PCL) with the binaries from unancyowen. In which case I suggest ensuring your system environment variables are setup correctly which will automate the process you are currently going through and facilitate the job of the find_package() methods. Assuming you installed everything in the same directory (i.e. where you have already linked to FLANN and Eigen) the following default PCL 3rd Party Libraries should be added to Path:

C:\Program Files\PCL 1.7.2\3rdParty\FLANN\bin

C:\Program Files\PCL 1.7.2\3rdParty\VTK\bin

C:\Program Files\PCL 1.7.2\3rdParty\Eigen

C:\Program Files\PCL 1.7.2\3rdParty\Boost

Then Qt, OpenNI etc. which are installed separately.

And you can also add:

BOOST_INCLUDEDIR : C:\Program Files\PCL 1.7.2\3rdParty\Boost\include\boost-X_XX\boost (Replace X_XX with your version number)

BOOST_LIBRARYDIR : C:\Program Files\PCL 1.7.2\3rdParty\Boost\lib

BOOST_ROOT : C:\Program Files\PCL 1.7.2\3rdParty\Boost

EIGEN_ROOT : C:\Program Files\PCL 1.7.2\3rdParty\Eigen

Share:
12,537
Jaume
Author by

Jaume

Updated on June 01, 2022

Comments

  • Jaume
    Jaume almost 2 years

    VTK_DIR-NOTFOUND is returned when using CMake. I am using CMake GUI and, as other path errors, I can point then to proper path. However, for VTK doesn't work. I am pointing to directory where VTConfig.cmake file and others are. Also tried with all of other VTK dirs but without any sucess. I am using Visual Studio 12 2013 Win 64 configuration for generation but tried with 2010 too.

    enter image description here

    pointing to path manually,

    enter image description here

  • usr1234567
    usr1234567 about 8 years
    How could I miss varable_watch?! Such an inferior tool compared to my current approach - printf debugging.