Skip to content

Detect c++ standard unconditionally (needed for embed target)#944

Merged
jagerman merged 1 commit into
pybind:masterfrom
jagerman:embed-cppversion
Jul 16, 2017
Merged

Detect c++ standard unconditionally (needed for embed target)#944
jagerman merged 1 commit into
pybind:masterfrom
jagerman:embed-cppversion

Conversation

@jagerman

Copy link
Copy Markdown
Member

Currently select_cxx_standard(), which sets PYBIND11_CPP_STANDARD when not externally set, is only called from pybind11_add_module(), but the embed target setup (which runs unconditionally) makes use of ${PYBIND11_CPP_STANDARD}, which isn't set yet. This commit removes the select_cxx_standard function completely and just always runs the standard detection code.

This also tweaks the detection code to not bothering checking for the -std=c++11 flag when the -std=c++14 detection succeeded.

Fixes #943.

One odd thing about #943 is that when pybind11_add_module was never called at all (and hence select_cxx_standard() was never called at all), an embedded target would get the std=c++14 flag, but it's a mystery to me how that was happening.

@jagerman

Copy link
Copy Markdown
Member Author

The commit removes select_cxx_standard(); does anyone see a reason to keep it as a cmake function? (i.e. and just always call select_cxx_standard() from pybind's main CMakeLists.txt)

@dean0x7d

Copy link
Copy Markdown
Member

Looks good to me. I don't see any reason to keep the function.

Currently select_cxx_standard(), which sets PYBIND11_CPP_STANDARD when
not externally set, is only called from pybind11_add_module(), but the
embed target setup (which runs unconditionally) makes use of
${PYBIND11_CPP_STANDARD}, which isn't set yet.  This commit removes the
`select_cxx_standard` function completely and just always runs the
standard detection code.

This also tweaks the detection code to not bothering checking for the
`-std=c++11` flag when the `-std=c++14` detection succeeded.
@jagerman
jagerman merged commit fad5d33 into pybind:master Jul 16, 2017
@dean0x7d dean0x7d modified the milestone: v2.2 Aug 13, 2017
@jagerman
jagerman deleted the embed-cppversion branch August 14, 2017 20:26
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