Comments (9)
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.
from cmake-conan.
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!
from cmake-conan.
Thanks for reporting this. Just a question, this happens irrespective of the CMake version? Or the policy must be conditioned to such version? I'd say that this worked at some point for OSX and AppleClang.
from cmake-conan.
I don't know, I just recently starting using conan. I have only tested with my current cmake version 3.7.2.
from cmake-conan.
Working with the policies should work irrespective of the CMake version, at least afaik.
Reading this: CMP0025 I assume that CMake versions prior to 3.0 should always detect "Clang" but I'm a little surprised, why we haven't faced this error earlier? With my CMake and without specifying a different behavior, it's detecting AppleClang
. I'm checking deeper.
from cmake-conan.
Ok, I think I get it. Actually, CMake is detecting "Clang", that matches with the CMake documentation.
The thing is, conanbuildinfo.cmake
doesn't care, the actions done by clang and apple-clang are the same and the compiler check won't complain if settings are apple-clang and CMake detects clang.
So, What compiler do you have in conan.conf
, probably is clang
when it should be apple-clang
, actually the versions check is performed by conan, not by CMake.
Could you confirm this?
Thanks
from cmake-conan.
Hmm, nope, sorry, my conan.conf
looks like this:
[settings_defaults]
arch=x86_64
build_type=Release
compiler=apple-clang
compiler.libcxx=libc++
compiler.version=7.0
os=Macos
It is definitely affected by CMP0025 for me. If I set cmake_policy(SET CMP0025 OLD)
i get
-- Conan ** WARNING** : This detection of settings from cmake is experimental and incomplete. Please check 'conan.cmake' and contribute
-- Conan executing: conan install -f=/Volumes/Big/Work/agx/branch/conanfile.txt -g cmake -s build_type=Debug -s os=Macos -s compiler=clang -s compiler.version=7.0 -s compiler.libcxx=libstdc++ --build=missing
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', '4.0']
And printing CMAKE_CXX_COMPILER_ID
gives Clang
.
And with cmake_policy(SET CMP0025 NEW)
I get
-- Conan ** WARNING** : This detection of settings from cmake is experimental and incomplete. Please check 'conan.cmake' and contribute
-- Conan executing: conan install -f=/Volumes/Big/Work/agx/branch/conanfile.txt -g cmake -s build_type=Debug -s os=Macos -s compiler=apple-clang -s compiler.version=7.0 -s compiler.libcxx=libc++ --build=missing
And printing CMAKE_CXX_COMPILER_ID
gives AppleClang
.
In conan.cmake
there is this test of CMAKE_CXX_COMPILER_ID
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL AppleClang)
from cmake-conan.
@lasote just realized, there might be a workaround. We might try to assume apple-clang
if we are in apple and the compiler is clang
, and the policy is not set. For those rare cases using bare clang
in apple, they should set the policy to disable the assumption.
I think this should cover well the default case, and leave a way to define it for special cases. Will try to submit a fix.
from cmake-conan.
Included also in tagged 0.4 pre-release
from cmake-conan.
Related Issues (20)
- Question about mixing debug build with release dependencies HOT 2
- [question] Invalid: 'settings.compiler.runtime' value not defined HOT 21
- Different formatting of msvc runtime value conan_provider.cmake
- Installing only certain packages HOT 8
- [develop2] Question: How stable is the current state HOT 2
- tools.build:compiler_executables breaks build with Autotools and Xcode HOT 3
- [develop2] detect_compiler() detects invalid 'settings.compiler.version' for apple-clang
- [develop2] Can conan_provider.cmake work with add_subdirectory HOT 6
- find_program working when building from command line, but not when using the CLion Conan plugin HOT 11
- [bug] generated settings.yml missing Macos.version "14.2", causes build failures HOT 10
- [develop2, BUG] Unknown arguments specified in conan_provider.cmake:519 HOT 2
- Unable to cross compile openssl/3.x.x on develop2 HOT 5
- Using "build-scripts" package via tool_requires() not working HOT 2
- [develop2] CMAKE_CONFIGURATION_TYPES with custom build types not getting dependencies added properly HOT 3
- ERROR: Invalid setting '6' is not a valid 'settings.compiler.version' value HOT 2
- 【conan install】conan_provider.cmake downloads packages from source because detect_host_profile generates compiler.cppstd=xx in the cmake-build-release/conan_host_profile file with the detect_host_profile method HOT 5
- cmake bootstrapping fails if not on PATH HOT 3
- Not working with conan editable mode HOT 5
- Update readme with more details HOT 1
- MSVC version update HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cmake-conan.