我在github上按照这些命令在我的机器上安装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构建中,告诉cmake源目录是~/vtk