使用Cmake进行编译并使用仅标头库 [英] Compiling with Cmake and using a header only library
问题描述
问题是对上一个问题的继续/重复,这没有解决我遇到的问题。
The question is a continuation/repeated one to a previous question, which didn't resolve the issue i'm running into.
使用make file编译Eigen是一项任务。但是在Cmake中,如何添加一个头文件库(基本上我只使用Eigen文件夹从Eigen网站提取的归档文件夹,并忽略其余的。)
注意:Eigen文件夹有自己的CMakeLists。 txt
Compiling Eigen with make file is one step task. But in Cmake, how do you add a header only library (basically i am using only the Eigen folder from the extracted archive folder in the Eigen website, and disregarding the rest.) Note: Eigen folder has its own CMakeLists.txt
推荐答案
您可以使用FindEigen3.cmake。将它放入 cmake / Modules
文件夹中,并将以下行添加到您的CmakeLists.txt
You can use the FindEigen3.cmake. Put it into cmake/Modules
folder and add the following lines to your CmakeLists.txt
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
find_package(Eigen3 REQUIRED)
include_directories(${EIGEN3_INCLUDE_DIR})
您可以在 cmake / FindEigen3.cmake $中的Eigen库的源代码中找到FindEigen3.cmake c $ c>
这篇关于使用Cmake进行编译并使用仅标头库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!