Search code examples
ubuntuvtk

Installing latest vtk on ubuntu 20.04


I am following these commands on github to install vtk on my machine. I also installed all dependencies. When running cmake -DCMAKE_INSTALL_PREFIX=$HOME/vtk-inst, I get this error:

CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


CMake Error: The source directory "/home/usr/usr/software/vtk/build" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

After this, I copied CmakeLists.txt into build directory, it says that:

CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:14 (include):
  include could not find load file:

    VTKDetermineVersion


CMake Error at CMakeLists.txt:15 (include):
  include could not find load file:

    vtkVersion


CMake Error at CMakeLists.txt:18 (determine_version):
  Unknown CMake command "determine_version".


-- Configuring incomplete, errors occurred!
See also "/home/usr/usr/software/vtk/build/CMakeFiles/CMakeOutput.log".

Solution

  • CMake seems to think the build directory is the source directory. You need to run CMake in the build directory and put the source directory as a command line argument.

    For example, if the source directory is ~/vtk, and the build directory is ~/vtk-build you'd do something like this:

    cd ~/vtk-build; cmake ~/vtk
    

    So I am in vtk-build, and telling cmake the source directory is ~/vtk