学习cmake-cookbook/chapter-02/recipe-06/cxx-example

严扬
2023-12-01

cmake编译时报找不到“Eigen3”错误:

root@kirinai-15-g5000pro:/workspace/cmake/cmake-cookbook/chapter-02/recipe-06/cxx-example# cmake .
-- The CXX compiler identification is GNU 7.5.0
-- 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:9 (find_package):
  Could not find a package configuration file provided by "Eigen3" (requested
  version 3.3) with any of the following names:

    Eigen3Config.cmake
    eigen3-config.cmake

  Add the installation prefix of "Eigen3" to CMAKE_PREFIX_PATH or set
  "Eigen3_DIR" to a directory containing one of the above files.  If "Eigen3"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!
See also "/workspace/cmake/cmake-cookbook/chapter-02/recipe-06/cxx-example/CMakeFiles/CMakeOutput.log".

首先通过以下方式暗转Eigen3的开发包:        

sudo apt-add-repository universe
sudo apt-get install libeigen3-dev

然后再重试就可以了。

root@kirinai-15-g5000pro:/workspace/cmake/cmake-cookbook/chapter-02/recipe-06/cxx-example# cmake .
-- The CXX compiler identification is GNU 7.5.0
-- 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
-- Performing Test _march_native_works
-- Performing Test _march_native_works - Success
-- Performing Test _xhost_works
-- Performing Test _xhost_works - Failed
-- Using processor's vector instructions (-march=native compiler flag set)
-- Configuring done
-- Generating done
-- Build files have been written to: /workspace/cmake/cmake-cookbook/chapter-02/recipe-06/cxx-example

详细参见:

cmake 找不到 eigen3 包

 类似资料: