git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matt Rogers <mattr94@gmail.com>
To: Philip Oakley <philipoakley@iee.email>
Cc: Sibi Siddharthan <sibisiddharthan.github@gmail.com>,
	Git List <git@vger.kernel.org>,
	Johannes Schindelin <johannes.schindelin@gmx.de>,
	Danh Doan <congdanhqx@gmail.com>
Subject: Re: [RFH] CMake: detect if being run via Visual Studio, independent of build generator?
Date: Sun, 30 May 2021 20:01:09 -0400	[thread overview]
Message-ID: <CAOjrSZusMSvs7AS-ZDsV8aQUgsF2ZA754vSDjgFKMRgi_oZAWw@mail.gmail.com> (raw)
In-Reply-To: <580d858d-dcd3-9d62-ec97-2daa9d9e0f45@iee.email>

> > My other consideration is that the build process should generate enough
> > of the right artefacts (e.g. a .sln etc). This is so that other typical
> > tools and extensions e.g. Sourcetrail which expects the .sln, but maybe
> > they'll also cope with Ninja/Cmake builds soon...
> >

Something to keep in mind is that the generator is what decides what artifacts
get produced.  As a consumer of the CMakeLists.txt it's on you to tell
CMake what
your tool needs, i.e. if it needs a compile_commands.json to run clang-tidy or a
.sln file or a ninja.build that would be on the user to generate.  I
think that's
acceptable, if there are common tools in use that require a more
complicated cmake
invocation to get that generation, then it might pay to define a preset in our
CMakePresets.json so that users can get those artifacts with a straightforward
invocation like:

cd contrib/buildsystems
mkdir build
cd build
cmake --preset sourcetrail ..

which I would still consider pretty "batteries included".

I do think however is that there are a few problems you're
encountering in this case:

1. Visual Studio build breaks because we don't install vcpkg here when we should
2. Visual Studio is no longer creating the .sln files, which some of
your external tools
were relying on.

I think that the solution to 1. would be to add a knob for vcpkg
installation, and either
have that knob "on" by default and/or provide a configuration in a
CMakePresets.json
that Visual Studio (and other IDE's/tools) could use to build.

I think the problem with 2. is that CMake is a build file generator
rather than an actual
build system itself, so it needs a user to tell it what kind of files
that their tools expect.
And I don't think there's any way to make it guess what kind of files the
user expects cmake to generate.  Depending on the complexity of the
configuration
it may be worth providing a CMakePresets.json file to make it easier to use, but
I guess it would depend on what exactly you need it to do.



-- 
Matthew Rogers

  reply	other threads:[~2021-05-31  0:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-29 15:00 [RFH] CMake: detect if being run via Visual Studio, independent of build generator? Philip Oakley
2021-05-29 15:49 ` Matt Rogers
2021-05-29 16:25   ` Philip Oakley
2021-05-29 18:33     ` Sibi Siddharthan
2021-05-29 20:31       ` Philip Oakley
2021-05-29 22:14         ` Sibi Siddharthan
2021-05-30  0:14           ` Matt Rogers
2021-05-30 10:52             ` Philip Oakley
2021-05-30 13:22               ` Matt Rogers
2021-05-30 14:29                 ` Sibi Siddharthan
2021-05-30 15:24                   ` Philip Oakley
2021-05-30 22:26                     ` Philip Oakley
2021-05-31  0:01                       ` Matt Rogers [this message]
2021-05-31 17:12                         ` Philip Oakley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOjrSZusMSvs7AS-ZDsV8aQUgsF2ZA754vSDjgFKMRgi_oZAWw@mail.gmail.com \
    --to=mattr94@gmail.com \
    --cc=congdanhqx@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    --cc=philipoakley@iee.email \
    --cc=sibisiddharthan.github@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).