question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AppleClang identification dependes on CMP0025

See original GitHub issue

Identification of AppleClang compiler in CMAKE_CXX_COMPILER_ID depends on CMP0025 being set to NEW.

However the default behavior is OLD

Unlike most policies, CMake version 3.0.2 does not warn by default when this policy is not set and simply uses OLD behavior. See documentation of the CMAKE_POLICY_WARNING_CMP0025 variable to control the warning.

To help detect this issue cmake-conan should enable the CMAKE_POLICY_WARNING_CMP0025 flag and/or check the value of CMP0025 policy on Mac builds. Also note that this policy must be set before the project declaration.

Otherwise we just get this error

ERROR: Invalid setting '7.0' is not a valid 'settings.compiler.version' value.
Possible values are ['3.3', '3.4', '3.5', '3.6', '3.7', '3.8', '3.9']

because it is identified as Clang instead of AppleClang

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
memshardedcommented, May 31, 2017

Done it. I have also added CI with travis-ci for both Linux and OSX, and it seems the approach is running fine. A message outputs:

- Conan: APPLE and Clang detected. Assuming apple-clang compiler. Set CMP0025 to avoid it

It is already merged in master, I am going to tag this too. Please try it and report, re-open issue if something fails, or have any question. Thanks!

1reaction
memshardedcommented, May 31, 2017

Hi @kolis

I see, thanks! The only issue is that I think that it is not possible for conan.cmake to set it. Note how it is used:

cmake_minimum_required(VERSION 2.8)
project(conan_wrapper CXX)
include(conan.cmake)

but as you said, and the docs clearly state, the policy MUST be set before the project declaration:

cmake_policy(SET CMP0025 NEW)
cmake_minimum_required(VERSION 2.8)
project(conan_wrapper CXX)
include(conan.cmake)

There is nothing in the conan.cmake file we provide that could make cmake understand that it is the AppleClang compiler. I guess the only way is to document it, any other idea or suggestion?

As a side note, I have to admit that I am not a big fan of this cmake-conan project, because of this kind of issues, I think it is much better to call conan directly, or to have python scripts that orchestrate the build, calling the necessary tools (conan, cmake, or others), much better scripting in python than having to script in cmake. There are already 300 lines of cmake code, just to avoid a single direct conan install command. Just my personal opinion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CMP0025 — CMake 3.25.1 Documentation
Compiler id for Apple Clang is now AppleClang . CMake 3.0 and above recognize that Apple Clang is a different compiler than upstream...
Read more >
#53201 (cmake: doesn't recognize macports-clang (No known ...
I was a bit too enthusiastic: setting CMP0025 on the commandline can still be undone by a cmake_minimum_required(VERSION x) with x < 3.0...
Read more >
Clang Compiler User's Manual - Apple Open Source
The mapping of category names to category id's can be obtained by running 'clang --print-diagnostic-categories'. Controlling Diagnostics via Command Line Flags.
Read more >
Remove the deprecated QDirModel - Qt Code Review
Change-Id: I7818ecd8f849eb566ac176612f382e17a0471c47 Reviewed-by: Lars ... .app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -o ...
Read more >
CMake 3.14 not detecting AppleCLang in MacOS Mojave + ...
(Also read about policy CMP0025 but in this simple test I'm not using it. ... The C compiler identification is AppleClang 10.0.0.10001145 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found