[flang-dev] CMake standalone and compile flags

Mehdi AMINI via flang-dev flang-dev at lists.llvm.org
Mon May 4 10:35:52 PDT 2020


On Mon, May 4, 2020 at 10:30 AM Mehdi AMINI <joker.eph at gmail.com> wrote:

>
>
> On Mon, May 4, 2020 at 10:17 AM David Truby <David.Truby at arm.com> wrote:
>
>> Hi Mehdi,
>>
>> That branch enables out of tree builds; I believe there are people that
>> still rely on those which is why we added that branch in when rewriting the
>> CMake infrastructure.
>>
>
> I assume that folks were relying on this before the merge in the monorepo,
> but are there still reason to maintain this from now on? Can we put an
> end-date on it?
> I'm trying to figure out if this is just a transition thing or if this is
> really something useful on the long run (and why).
>
>
>> There's an open review to fix a similar issue as is reported in the
>> discussion you linked but it seems to have stalled on a discussion about
>> whether to continue to force Werror on, perhaps you could take a look at
>> that and comment there if it fixes this issue or not?
>>
>> The review is at https://reviews.llvm.org/D78306
>>
>
> Thanks, that was roughly what I was about to start doing!
> In general I think we should avoid doing directly `set(CMAKE_CXX_FLAGS
> ...` and instead use the `add_flag_if_supported` macros provided by LLVM,
> e.g.:
> https://github.com/llvm/llvm-project/blob/master/mlir/lib/CMakeLists.txt#L2
>
> Werror is always difficult to maintain because different compilers (and
> compiler versions) have different handling (possibly even opposite!)
> warnings. It is a good thing to have for developers, but it may be a bit
> hostile to users to have it on by default.
>

To give an example of what I meant by "opposite":
http://clang-developers.42468.n3.nabble.com/Re-llvm-dev-New-warnings-when-building-trunk-with-GCC-9-td4062064.html

Basically either you get a warning with clang, or you get a warning with
gcc, but there is no source construct that would satisfy both compiler.
Having Werror on by default means that a user checking out the repo and
building it may just hit an error for no good reason.
(Also it isn't clear to me why flang should deviate from the rest of the
repo on this)

Best,

-- 
Mehdi



>
>>
>>
>> Thanks
>> David Truby
>> ------------------------------
>> *From:* flang-dev <flang-dev-bounces at lists.llvm.org> on behalf of Mehdi
>> AMINI via flang-dev <flang-dev at lists.llvm.org>
>> *Sent:* 04 May 2020 18:12
>> *To:* Flang Development List <flang-dev at lists.llvm.org>
>> *Subject:* [flang-dev] CMake standalone and compile flags
>>
>> Hi,
>>
>> I was looking into fixing this error that someone has when building
>> flang: https://llvm.discourse.group/t/error-when-building-with-cmake/935
>>
>> Then I noticed that flang/CMakeLists.txt still has this branch:
>> https://github.com/llvm/llvm-project/blob/master/flang/CMakeLists.txt#L42
>> ; is there anyone that relies on it or can we simplify this file and the
>> way the options are setup?
>>
>> Thanks,
>>
>> --
>> Mehdi
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/flang-dev/attachments/20200504/db7b2128/attachment-0001.html>


More information about the flang-dev mailing list