Cmake management Visual Studio cannot display the header file solution

Source: Internet
Author: User

Labels: Visual Studio cmake C ++

Cause

We use cmake to manage cross-platform projects, but in windows, our friends found that the header files on Visual Studio were not loaded, so they were manually loaded. Then, one day I modified the cmakelists.txt file. Visual Studio automatically regenerated the project, and then the header file disappeared. Cry ~~~~

Solution

source_groupYou can split files into directories to display them in IDE.
Therefore, we modified the base. cmake file so that all the projects can retrieve the files and display them inincludeFolder.

file(GLOB_RECURSE CURRENT_HEADERS  *.h *.hpp)source_group("Include" FILES ${CURRENT_HEADERS}) add_executable(${MODULE_NAME} ${SOURCES} ${CURRENT_HEADERS})

Re-generate the Windows project, the header file automatically appears, and the friends under Win are happy.

Vim and Emacs are directly ignored ~~~

?
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.