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_group
You 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 ininclude
Folder.
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 ~~~
?