[英]Xcode project that was generated by CMake is not show header file
I build my C++ project with CMake. 我用CMake构建我的C ++项目。 I want use Xcode as Editor so, I run this command.
我想使用Xcode作为编辑器,所以,我运行此命令。
cmake . -GXcode
BTW, My C++ Project header and source file is located in different folder. BTW,我的C ++项目标题和源文件位于不同的文件夹中。
my project directory tree: 我的项目目录树:
project_root
└CMakeLists.txt
└src
└CMakeLists.txt
└main.cpp
└include
└xxx1.hpp
└inner
└in_xxx1.hpp
so I set src/CMakeLists.txt like this: 所以我像这样设置src / CMakeLists.txt:
include_directories (
${CMAKE_SOURCE_DIR}/include
)
add_executable( "runrun" main.cpp )
In Xcode, only main.cpp file is shown. 在Xcode中,只显示main.cpp文件。
I want see header file also in Xcode. 我想在Xcode中看到头文件。
What should I do? 我该怎么办?
For CMake to also put header files into your XCode project, you simply need to add the corresponding header files to your sources. 要让CMake还将头文件放入您的XCode项目,您只需将相应的头文件添加到源中。
In your case, you should also add xxx1.hpp
and inner/in_xxx1.hpp
as parameters of add_executables
. 在你的情况,你也应该补充
xxx1.hpp
和inner/in_xxx1.hpp
作为参数add_executables
。 So far, I have not seen any disadvantage of that. 到目前为止,我还没有看到任何不利之处。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.