This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Keep targets in folder in Visual Studio
Needs ReviewPublic

Authored by sebastian-ne on Mar 29 2022, 12:36 AM.

Details

Summary

When adding llvm to another cmake project with add_subdirectory, llvm
added its targets at the top level (visible in the solution explorer in
visual studio), making it hard to spot the targets of the parent
project.

With this change, llvm's targets stay in a subdirectory, grouping all the
targets inside an LLVM directory.
Nothing changes when llvm is built as the main project.

Diff Detail

Event Timeline

sebastian-ne created this revision.Mar 29 2022, 12:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 29 2022, 12:36 AM
sebastian-ne requested review of this revision.Mar 29 2022, 12:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 29 2022, 12:36 AM

FWIW, I think this looks reasonable -- however, I think there are missing changes elsewhere. When I search for set_target_properties.*FOLDER.* across the entire monorepo, I get 197 hits many of which are not touched here. Should we be hitting all of the folders instead of just a subset of them?

Also, given how easy it would be to forget this when adding a new folder in the future, I sort of wonder whether we want to make a CMake macro for setting a folder so that we can capture the logic in one place.

nikic resigned from this revision.Apr 1 2022, 7:38 AM

(Not familiar with cmake or VS)

Godin added a subscriber: Godin.Aug 23 2022, 5:30 AM