public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] How to add -std=c++14 to CXXFLAGS of a cmake.eclass based package?
@ 2022-12-17 11:35 Andrey Grozin
  2022-12-17 11:52 ` Arsen Arsenović
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Andrey Grozin @ 2022-12-17 11:35 UTC (permalink / raw
  To: gentoo-dev

Hello *,

I'm trying to package a new version of sci-visualization/gle which now 
uses cmake. After some patching CMakeLists.txt, it configures 
successfully. But at build time it spits zillion errors

error: ISO C++17 does not allow dynamic exception specifications

The natural thing to try is to add -std=c++14 to CXXFLAGS. So I tried

src_compile() {
     CXXFLAGS="${CXXFLAGS} -std=c++14" cmake_src_compile
}

but this makes no difference, c++17 is still used. How to convince 
cmake_src_compile to use -std=c++14?

Thanks in advance,
Andrey


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] How to add -std=c++14 to CXXFLAGS of a cmake.eclass based package?
  2022-12-17 11:35 [gentoo-dev] How to add -std=c++14 to CXXFLAGS of a cmake.eclass based package? Andrey Grozin
@ 2022-12-17 11:52 ` Arsen Arsenović
  2022-12-17 13:10   ` Andrey Grozin
  2022-12-17 12:06 ` parona
  2022-12-17 13:05 ` Azamat Hackimov
  2 siblings, 1 reply; 6+ messages in thread
From: Arsen Arsenović @ 2022-12-17 11:52 UTC (permalink / raw
  To: gentoo-dev; +Cc: Andrey Grozin

[-- Attachment #1: Type: text/plain, Size: 1046 bytes --]

Hi,

Andrey Grozin <grozin@woodpecker.gentoo.org> writes:

> Hello *,
>
> I'm trying to package a new version of sci-visualization/gle which now uses
> cmake. After some patching CMakeLists.txt, it configures successfully. But at
> build time it spits zillion errors
>
> error: ISO C++17 does not allow dynamic exception specifications
>
> The natural thing to try is to add -std=c++14 to CXXFLAGS. So I tried
>
> src_compile() {
>     CXXFLAGS="${CXXFLAGS} -std=c++14" cmake_src_compile
> }
>
> but this makes no difference, c++17 is still used. How to convince
> cmake_src_compile to use -std=c++14?
>
> Thanks in advance,
> Andrey


audacity-2.4.2-r3.ebuild has something for this already:
``append-cxxflags -std=gnu++14''

Check out flag-o-matic.eclass.  Note that the build system could still
be overriding it, so if that fails, I'd check the compilation commands
for -std=... parameters, as well as CXX_STANDARD_LEVEL, or whatever
cmake calls it.

Hope that helps, have a great day.
-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] How to add -std=c++14 to CXXFLAGS of a cmake.eclass based package?
  2022-12-17 11:35 [gentoo-dev] How to add -std=c++14 to CXXFLAGS of a cmake.eclass based package? Andrey Grozin
  2022-12-17 11:52 ` Arsen Arsenović
@ 2022-12-17 12:06 ` parona
  2022-12-17 13:05 ` Azamat Hackimov
  2 siblings, 0 replies; 6+ messages in thread
From: parona @ 2022-12-17 12:06 UTC (permalink / raw
  To: gentoo-dev

Hi,

> but this makes no difference, c++17 is still used. How to convince
> cmake_src_compile to use -std=c++14?

Cmake sets those flags during src_configure (when the build dir is configured) and therefore ignores CXXFLAGS entirely during src_compile.

You should set those in src_configure before cmake_src_configure gets called. And Arsen Arsenovićs reply applies here on how to use flag-o-matic function append-cxxflags to do it.

--
Alfred Wingate


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] How to add -std=c++14 to CXXFLAGS of a cmake.eclass based package?
  2022-12-17 11:35 [gentoo-dev] How to add -std=c++14 to CXXFLAGS of a cmake.eclass based package? Andrey Grozin
  2022-12-17 11:52 ` Arsen Arsenović
  2022-12-17 12:06 ` parona
@ 2022-12-17 13:05 ` Azamat Hackimov
  2022-12-17 13:16   ` Azamat Hackimov
  2 siblings, 1 reply; 6+ messages in thread
From: Azamat Hackimov @ 2022-12-17 13:05 UTC (permalink / raw
  To: gentoo-dev

Hello.

You need to add

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

into CMakeLists.txt after project() declaration via patching. Since
this is an upstream issue, you need to notify upstream about C++17
incompatibility.

сб, 17 дек. 2022 г. в 14:35, Andrey Grozin <grozin@woodpecker.gentoo.org>:
>
> Hello *,
>
> I'm trying to package a new version of sci-visualization/gle which now
> uses cmake. After some patching CMakeLists.txt, it configures
> successfully. But at build time it spits zillion errors
>
> error: ISO C++17 does not allow dynamic exception specifications
>
> The natural thing to try is to add -std=c++14 to CXXFLAGS. So I tried
>
> src_compile() {
>      CXXFLAGS="${CXXFLAGS} -std=c++14" cmake_src_compile
> }
>
> but this makes no difference, c++17 is still used. How to convince
> cmake_src_compile to use -std=c++14?
>
> Thanks in advance,
> Andrey
>


-- 
From Siberia with Love!


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] How to add -std=c++14 to CXXFLAGS of a cmake.eclass based package?
  2022-12-17 11:52 ` Arsen Arsenović
@ 2022-12-17 13:10   ` Andrey Grozin
  0 siblings, 0 replies; 6+ messages in thread
From: Andrey Grozin @ 2022-12-17 13:10 UTC (permalink / raw
  To: Arsen Arsenović; +Cc: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 166 bytes --]

On Sat, 17 Dec 2022, Arsen Arsenović wrote:
> audacity-2.4.2-r3.ebuild has something for this already:
> ``append-cxxflags -std=gnu++14''
Thanks, this works.

Andrey

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] How to add -std=c++14 to CXXFLAGS of a cmake.eclass based package?
  2022-12-17 13:05 ` Azamat Hackimov
@ 2022-12-17 13:16   ` Azamat Hackimov
  0 siblings, 0 replies; 6+ messages in thread
From: Azamat Hackimov @ 2022-12-17 13:16 UTC (permalink / raw
  To: gentoo-dev

Also, according to commit history, dynamic exception usage was removed
in https://github.com/vlabella/GLE/commit/14753e9aba9eb6490358caaeb60f6e36ba314acc,
so you can try to apply this patch.

сб, 17 дек. 2022 г. в 16:05, Azamat Hackimov <azamat.hackimov@gmail.com>:
>
> Hello.
>
> You need to add
>
> set(CMAKE_CXX_STANDARD 14)
> set(CMAKE_CXX_STANDARD_REQUIRED ON)
>
> into CMakeLists.txt after project() declaration via patching. Since
> this is an upstream issue, you need to notify upstream about C++17
> incompatibility.
>
> сб, 17 дек. 2022 г. в 14:35, Andrey Grozin <grozin@woodpecker.gentoo.org>:
> >
> > Hello *,
> >
> > I'm trying to package a new version of sci-visualization/gle which now
> > uses cmake. After some patching CMakeLists.txt, it configures
> > successfully. But at build time it spits zillion errors
> >
> > error: ISO C++17 does not allow dynamic exception specifications
> >
> > The natural thing to try is to add -std=c++14 to CXXFLAGS. So I tried
> >
> > src_compile() {
> >      CXXFLAGS="${CXXFLAGS} -std=c++14" cmake_src_compile
> > }
> >
> > but this makes no difference, c++17 is still used. How to convince
> > cmake_src_compile to use -std=c++14?
> >
> > Thanks in advance,
> > Andrey
> >
>
>
> --
> From Siberia with Love!



-- 
From Siberia with Love!


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-12-17 13:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-17 11:35 [gentoo-dev] How to add -std=c++14 to CXXFLAGS of a cmake.eclass based package? Andrey Grozin
2022-12-17 11:52 ` Arsen Arsenović
2022-12-17 13:10   ` Andrey Grozin
2022-12-17 12:06 ` parona
2022-12-17 13:05 ` Azamat Hackimov
2022-12-17 13:16   ` Azamat Hackimov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox