使用Cmake进行编译并使用仅标头库 [英] Compiling with Cmake and using a header only library

查看:389
本文介绍了使用Cmake进行编译并使用仅标头库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题是对上一个问题的继续/重复,这没有解决我遇到的问题。

The question is a continuation/repeated one to a previous question, which didn't resolve the issue i'm running into.

使用Eigen Cmake

使用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

https://bitbucket.org/eigen/eigen/src/971445a0e8ec311b4b663242b1f0ac668a9753ca/cmake/FindEigen3.cmake?at=default

这篇关于使用Cmake进行编译并使用仅标头库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆