Uh oh!
There was an error while loading. Please reload this page.
Apply c++ standard flag only to files of CXX language - #1678
Conversation
loriab
commented
Apr 10, 2019
Thank you for fixing the CI. I believe this PR is now fit for consideration. |
wjakob
commented
Jun 10, 2019
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
commented
Jun 11, 2019
I decided to merge this one since it is a superset of #1089. |
The
-std=c++xxflag should only be applied toCXXfiles. Normally, applying the-stdto 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_LANGUAGEgenerator.