简体   繁体   中英

Xcode project that was generated by CMake is not show header file

I build my C++ project with CMake. I want use Xcode as Editor so, I run this command.

cmake . -GXcode

BTW, My C++ Project header and source file is located in different folder.

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:

include_directories (
   ${CMAKE_SOURCE_DIR}/include
)
add_executable( "runrun" main.cpp )

In Xcode, only main.cpp file is shown.

在此输入图像描述

I want see header file also in 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.

In your case, you should also add xxx1.hpp and inner/in_xxx1.hpp as parameters of add_executables . So far, I have not seen any disadvantage of that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM