Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply c++ standard flag only to files of CXX language #1678

Merged
merged 1 commit into from
Jun 11, 2019

Conversation

loriab
Copy link
Contributor

@loriab loriab commented Jan 31, 2019

The -std=c++xx flag should only be applied to CXX files. Normally, applying the -std to all files is harmless because the compiler recognizes but issues a warning on the invalid flag. However, in the sad case where a module to be built contains Fortran files and the std is quite new and the fortran compiler is quite old (e.g., 14 and gfortran 4.8.5), the warning turns to error: Warning: command line option '-std=c++14' is valid for C++/ObjC++ but not for Fortran --> error: unrecognized command line option '-std=c++14'.

Of the two changes below, the pybind11Config is what worked for my project, but it seemed reasonable to switch the other as well. I haven't built with old cmake versions, but 3.3 is when the docs say cmake learned COMPILE_LANGUAGE generator.

@loriab
Copy link
Contributor Author

loriab commented Apr 10, 2019

Thank you for fixing the CI. I believe this PR is now fit for consideration.

@wjakob
Copy link
Member

wjakob commented Jun 10, 2019

FYI: there are two potentially related PRs: #1098 and #1089. Not sure what is the best way to get all of this merged..

@loriab
Copy link
Contributor Author

loriab commented Jun 10, 2019

It looks like #1089 is identical to half (tools file) of this PR. The other half of this PR (config file) is what my project needed. Probably just a difference between the (many) ways to incorporate pb11 into a project.

The other PR has rather more discussion, so if that one incorporates the config file changes from here, I'm glad to close this. Or, this PR has both -- your choice.

With respect to #1098, I've never played with cmake compile options, but it doesn't seem to address what language of files the C++ standard is applied to, so I'd venture the PR is separate.

@wjakob wjakob merged commit 676fe2b into pybind:master Jun 11, 2019
@wjakob
Copy link
Member

wjakob commented Jun 11, 2019

I decided to merge this one since it is a superset of #1089.

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.

None yet

2 participants