conan-io / conan-io/conan

[question] Lmod CPATH vs Conan -isystem

Open
#17,515 3 comments 0 reactions 1 assignee Claimed by @memsharded View on GitHub
Dominant language
Python
Stars
9.5k
Forks
1.1k
Avg merge
23h 48m
Merged PRs (30d)
15

Description

### What is your question?

Hi!

I'm using Lmod / EasyBuild, and it appears to provide include directories via the `CPATH` environment variable. According to the [GCC docs](https://gcc.gnu.org/onlinedocs/cpp/Environment-Variables.html) this is equivalent to injecting `-I` arguments.
Conan, on the other hand, ends up injecting `-isystem` arguments on the command-line (at least via the CMake generator).

When I build `grpc`, which depends on `openssl`, if the OpenSSL Lmod module is loaded (and therefore present on `CPATH`), its includes 'win out' and cause the `grpc` build to not use the correct headers provided by Conan. This is because `-I` 'wins' over `-isystem`. When there's a version mismatch e.g. Lmod OpenSSL/1.1 vs Conan OpenSSL/3.3.2, I get link errors as a result. (Mercifully, this is much better than ODR violations... :) )

From what I see in the above GCC docs, the other Environment Variables inject `-isystem` and not `-I`. This is a bit weird to me - why couple the 'language independent' environment variable to extra behavior like `-I` and not `-isystem`? I realize this is a question for GCC... but I'm not sure what to do here.

What's the expectation of Conan's behavior with respect to the presence of CPATH?

### Have you read the CONTRIBUTING guide?

- [X] I've read the CONTRIBUTING guide

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.