[llvm-dev] llvm-config --cxxflags should report C++ language standard version

Johan Engelen via llvm-dev llvm-dev at lists.llvm.org
Sun Nov 3 14:28:40 PST 2019

Hi Chris and Saleem,
  I'm not sure about the exact proposal, but my initial thought is that
using pkg-config instead of llvm-config would increase the burden for us
because we would have to add a dependency on pkg-config on all platforms we
support, including Windows where it is uncommon. We support building with
LLVM 3.9 up to trunk, so there'd be additional hassle of figuring out which
LLVM version a user has.
How we use llvm-config:
- allow user to explicitly which directory to look for LLVM (i.e. where to
look for llvm-config belonging to that LLVM install)
- --libs + list of components to get link libraries list
- --host-target, --assertion-mode, --target-built, and several other
LLVM-specific attributes

(we could probably also use LLVMConfig.cmake but instead we use our own
'FindLLVM' cmake script that finds and invokes llvm-config and then patches
up compiler flags, etc, to make things work with LLVM 3.9-trunk and
gcc/clang/msvc. I'm afraid LLVMConfig.cmake may do more than we want it to
do; we might have to give up control over some things that we need control

Thank you Saleem for including `-std=...` again in cxxflags.


On Sat, Nov 2, 2019 at 5:16 PM Chris Bieneman <chris.bieneman at me.com> wrote:

> Johan,
> Since llvm-config is something that matters to you I'm curious to get your
> opinion (and that of anyone else who can chime in) on something. At the dev
> meeting during the CMake roundtable we discussed deprecating llvm-config in
> favor of pkg-config.
> Would LLVM supporting pkg-config meet your needs in place of llvm-config?
> -Chris
> On Oct 31, 2019, at 1:53 AM, Johan Engelen via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
> On Thu, Oct 31, 2019 at 3:46 AM Saleem Abdulrasool <compnerd at compnerd.org>
> wrote:
>> On Wed, Oct 30, 2019 at 4:17 PM Johan Engelen <jbc.engelen at gmail.com>
>> wrote:
>>> Hi all,
>>>   Since  2724d9e12960cc1d93eeabbfc9aa1bffffa041cc, llvm-config
>>> -cxxflags no longer reports the C++ language standard version (e.g.
>>> "-std=c++14") used to compile LLVM. This may break builds of projects that
>>> build with the same flags as LLVM, e.g. the LDC compiler.
>>> Quoting from llvm/tools/llvm-config/CMakeLists.txt:
>>> ```
>>> # The language standard potentially affects the ABI/API of LLVM, so we
>>> want
>>> # to make sure it is reported by llvm-config.
>>> ```
>>> Even in the case of default C++ version, in my opinion llvm-config
>>> should explicitly report it.
>> I will add an option to report the C++ version, though that would be a
>> new option and require reworking the consumers to be aware of that.  It
>> would be better to actually rely on CMake to provide the details of the
>> build rather than `llvm-config`.
> Note that this is about the details for the build of a project that uses
> LLVM. I don't think projects should be forced to use CMake for setting up a
> build when they link to LLVM. The new option would help, but I feel it is
> better to be have the C++ version be reported by default and that a new
> option would disable it. In most cases I think one would want the c++
> version to be specified because otherwise the project will be forced to
> compile with the same compiler and same compiler version as the LLVM
> package because things rely on compiler defaults to be the same. Hence the
> comment in llvm-config/CMakeLists.
> regards,
>   Johan
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191103/02079e4f/attachment.html>

More information about the llvm-dev mailing list