在 ubuntu 20.04 上安装最新的 vtk

Installing latest vtk on ubuntu 20.04

我在 github 上关注 these commands,以便在我的机器上安装 vtk。我还安装了所有依赖项。当 运行 cmake -DCMAKE_INSTALL_PREFIX=$HOME/vtk-inst 时,我得到这个错误:

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.

在此之后,我将 CmakeLists.txt 复制到构建目录中,它说:

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".

CMake 似乎认为构建目录是源目录。您需要在构建目录中 运行 CMake,并将源目录作为命令行参数。

例如,如果源目录是 ~/vtk,而构建目录是 ~/vtk-build 你会做这样的事情:

cd ~/vtk-build; cmake ~/vtk

所以我在vtk-build中,告诉cmake源目录是~/vtk