Skip to content

Make files visible in generated Visual Studio solution #1216

@davidhunter22

Description

@davidhunter22

If you generate a Visual studio solution from the current CMake the GSL headers like algorithm and assert don't appear. The only way you seem to be able to see them is to open a test like algorithm_tests.cpp and then do a "Go to document" on a line like #include <gsl/algorithm>.
In my local copy I added the following

add_custom_target(include SOURCES
    gsl/algorithm
    gsl/assert
    gsl/byte
    gsl/gsl
    gsl/narrow
    gsl/pointers	
    gsl/span
    gsl/span_ext
    gsl/util	
    gsl/zstring		
)

But I am sure that is the wrong way to do it.

I also added

set(SolutionItems
    .clang-format
    .gitattributes
    .gitignore
    CMakeSettings.json
    CONTRIBUTING.md
    LICENSE
    README.md
    SECURITY.md
    ThirdPartyNotices.txt)
set_property(DIRECTORY APPEND PROPERTY VS_SOLUTION_ITEMS ${SolutionItems})

This makes all these files appears in the "Solution Items" folder in the IDE which is super useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Help WantedNeeds additional help or expertisePriority: LowCan be handled at leisureStatus: OpenNeeds attention

    Type

    Projects

    Status

    Confirmed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions