简体   繁体   English

由CMake生成的Xcode项目不是show header file

[英]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.hppinner/in_xxx1.hpp作为参数add_executables So far, I have not seen any disadvantage of that. 到目前为止,我还没有看到任何不利之处。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 CMake生成的Xcode项目将无法编译 - CMake generated Xcode project won't compile 列出由cmake生成的Visual Studio C ++项目中的头文件 - Listing header files in Visual Studio C++ project generated by cmake CMake链接库未显示在VisualStudio生成的项目中 - CMake linking library doesn't show up in VisualStudio generated project 使用Xcode进行CMake:找不到已配置的头文件(.h.in) - CMake with Xcode: configured header file (.h.in) not found CMake生成的Xcode项目无法找到从Xcode构建的二进制“产品” - CMake generated Xcode project fails to find the binary “Products” that are built from Xcode 在Xcode c ++项目中包含头文件 - Include header file in Xcode c++ project Boost序列化:从CMake生成的XCode 5项目中的链接器错误(带有最少的完整示例) - Boost Serialization : Linker errors in XCode 5 project, generated from CMake (w/ minimal complete example) Cmake 生成的 Eclipse 项目 - 无源 - Cmake generated Eclipse Project - No Source 使用cmake为Eclipse CDT生成的项目 - Project generated with cmake for Eclipse CDT 如何将在依赖CMake项目中创建的Protobuf生成的.h文件正确导入到父CMake项目中? - How do I properly import, into a parent CMake project, a Protobuf-generated .h file created in a dependency CMake project?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM