Skip to content

fix: filter out -std= arguments from pkg-config dependencies#30

Open
doudou wants to merge 2 commits intomasterfrom
filter_out_std_from_pkgconfig
Open

fix: filter out -std= arguments from pkg-config dependencies#30
doudou wants to merge 2 commits intomasterfrom
filter_out_std_from_pkgconfig

Conversation

@doudou
Copy link
Member

@doudou doudou commented Feb 12, 2026

The logic as present will not make sure we use the latest standard. That is, we
will use the last standard present and the usage of direct arguments is
overriding all other mechanisms. This makes packages actually impossible to
compile without also explicitly setting a -std= argument in the task's
CMakeLists.txt

Given that the 'cxx_standard' mechanism is setting the target's related feature,
I think it's fair to stop propagating these options.

However, this breaks backward compatibility. Not super happy about that.

As written, it was ony setting a local variable instead of actually setting the
standard
The logic as present will not make sure we use the latest standard. That is, we
will use the last standard present *and* the usage of direct arguments is
overriding all other mechanisms. This makes packages actually impossible to
compile without also explicitly setting a -std= argument in the task's
CMakeLists.txt

Given that the 'cxx_standard' mechanism is setting the target's related feature,
I think it's fair to stop propagating these options.
<% if project.cxx_standard %>
# override the c++ standard with the final result at generation time
cxx_standard = "<%= project.cxx_standard %>"
cxx_standard "<%= project.cxx_standard %>"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, thanks for catching this. better late than never.

@pierrewillenbrockdfki
Copy link
Contributor

In my opinion, the behavior before was just plain broken: depending on the order of including other packages one would get the right or wrong standard, and a different package can make your package build or not build.

See also: https://github.com/rock-core/base-cmake/blob/e426993d386078c04c617490f9fa7b94b3799e44/modules/Rock.cmake#L747-L774

See tests: https://github.com/rock-core/build_tests-orogen-cxx_standards_11_then_14 https://github.com/rock-core/build_tests-orogen-cxx_standards_14_then_11

Copy link
Contributor

@pierrewillenbrockdfki pierrewillenbrockdfki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants