CMake SYSTEM INTERFACE #4160
Unanswered
severinstrobl
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When adding pybind11 to a CMake project via
add_subdirectory(), theSYSTEMkeyword is added to the specification of the include directory inpybind11/CMakeLists.txt
Lines 185 to 186 in fac23b6
While this is certainly the right way to handle include directories in sub-projects, it can result in problems for some environments: For HPC systems, it is not uncommon for module files to add their respective include path to the
CPATHenvironment variable. When building a CMake project shipping pybind11 as a third-party module and adding it viaadd_subdirectory(), a different installation of pybind11 may be used during compilation in case an external module providing pybind11 is loaded at the same time. This is a result of the default ordering of include paths by the compiler, where entries in$CPATHare searched before the ones provided via-isystem(resulting from theSYSTEM INTERFACE).Admittedly, this is a rather obscure problem, but maybe a workaround exists for such setups. If not, would it be possible to allow disabling the addition of
SYSTEMin pybind11 via an configuration option? As a interim fix, in my version of pybind11 I added such an option to selectively controlpybind11_systempybind11/CMakeLists.txt
Line 87 in fac23b6
via
allowing me to disable
SYSTEMviaset(pybind11_SYSTEM_INTERFACE off).I'd be very happy to hear any suggestions or comments regarding this issue!
Beta Was this translation helpful? Give feedback.
All reactions