Re: [RFH] CMake: detect if being run via Visual Studio, independent of build generator?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, May 30, 2021 at 6:52 AM Philip Oakley <philipoakley@iee.email> wrote:
>
> quick thoughts..
> On 30/05/2021 01:14, Matt Rogers wrote:
> > (resending because client reconfigured to not use plaintext)
> ;-)
> >
> > Reading through the documentation, Visual Studio seems to support
> > CmakePresets.json [1]
> Is that stored with the project, or with the VS installation (still to
> read [1] beyond a v quick scan..)

This file would live in our source tree next to our CMakeLists.txt.  It's kind
of cmakes answer to the problem CMakeSettings.json was trying to solve.

> >  for handling configuration of cmake options.  It
> > might be worth it to keep the defaults as is.
>
> Given that it's just changed, do you mean ' keep it as new - Ninja' or
> 'keep it as old - VS generator'..
>

Users should be free to use arbitrary generators and have them work
out of the box for normal use cases (here I'm thinking of IDE integrations
as well as just running builds).  So you should have the option to use
either Visual Studio with Ninja or with the Visual Studio 2019 generator.
I personally prefer Ninja, but maybe somebody is stuck using an older version,
or would prefer to have a .sln file for other reasons.

Personally, I think that most users not knowing anything would go in
thinking that arbitrary generators are equally supported with perhaps
a small number of knobs.

By default Visual Studio 2019 is probably doing an invocation something
like:

mkdir out && cd out && cmake -G Ninja ..

Which would ideally just work automagically.  But if for example you wanted
to support using vcpkg as a package source, we're pretty much forced to
provide a knob here (what if I wanted to use Visual Studio as my IDE but
not want to use vcpkg to manage those dependencies for example).

I think the best middle of the line solution would be to just provide a manual
knob for turning vcpkg support on/off here and offer configurations in
CMakePresets.json for both situations.  The only downside here is that I believe
a lot of IDE's are aggressive about running the cmake configuration step and may
try to install vcpkg even if it is unnecessary.  But automatic
generation can generally
be turned off by users I guess.


-- 
Matthew Rogers



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux