如何将RapidXml添加到CMake项目?

时间:2019-03-26 16:06:03

标签: c++ cmake rapidxml

我想将RapidXML添加到我的CMake项目中,以便我可以使用它。 我的项目结构如下:

Root
|
|_inc (for my own Headers)
|    |_main.h
|    |_CMakeList.txt
|_src (for my own Sources)
|    |_main.cpp
|    |_CMakeList.txt
|_libs (for third party libs)
|     |_rapidxml
|     |_CMakeList.txt
|_CMakeList.txt

有人可以帮助我吗? 预先感谢!

1 个答案:

答案 0 :(得分:0)

我自己找到了解决方案。 :) 在/Root/libs/CMakeList.txt中,添加了以下几行:

add_subdirectory(rapidxml)
add_library(rapidxml INTERFACE)
target_include_directories(rapidxml INTERFACE rapidxml/ )

如果有更好的解决方案,我很高兴听到!