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

Do not pass compiler executable for AppleClang if it is the default #592

Merged
merged 6 commits into from
Nov 17, 2023

Conversation

jcar87
Copy link
Contributor

@jcar87 jcar87 commented Nov 17, 2023

While the compiler resides in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc, and that is the path that CMake registers, this cannot be invoked directly unless ones passes flags to locate the sysroot with the library etc. CMake does pass this additional information, but other tools downstream might not (e.g. Autotools, as reported in an issue). This is otherwise done automatically when invoking via /usr/bin/cc, which in turn invokes it via xcrun, defining SDKROOT properly and thus it "just works".

The fix is to detect if the compiler CMake has detected is the default as found by xcrun - in that case, we don't propagate the compiler, and assume that it is the one that will be detected by default by downstream projects.

Close #589

Copy link
Member

@memsharded memsharded left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say is looking good, better avoid the definition of compiler_executables.

@jcar87
Copy link
Contributor Author

jcar87 commented Nov 17, 2023

Additionally and come to think of it - when the CMake generator is "Visual Studio", we don't need to propagate compilers either - these are either derived by CMake itself, or Conan activates vcvars on the fly for command line generators. Less a problem, as it is redundant, but worth taking into account.

@jcar87 jcar87 marked this pull request as ready for review November 17, 2023 14:36
@jcar87 jcar87 merged commit c53fbf5 into conan-io:develop2 Nov 17, 2023
5 checks passed
@jcar87 jcar87 deleted the lcc/bugfix/cxx-compiler-appleclang branch November 17, 2023 17:10
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.

3 participants