How to set Visual Studio Filters for nested sub directory using cmake

前端 未结 4 577
北海茫月
北海茫月 2020-11-30 04:57

I have following structure

Main (dir)
      +-- CMakeLists.txt
      +-- File.cpp
      +-- File.hpp
      +-- Dir (dir)
          +-- CMakeLists.txt
                


        
4条回答
  •  我在风中等你
    2020-11-30 05:43

    I wanted to comment on https://stackoverflow.com/users/3987854/squareskittles 's answer, but I couldn't due to the lack of "reputation" ?

    Anyway,

    source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCE_LIST})
    

    works like a charm, but I also needed to set this:

    set_property(GLOBAL PROPERTY USE_FOLDERS ON)
    

提交回复
热议问题