Giter Site home page Giter Site logo

Comments (9)

memsharded avatar memsharded commented on July 2, 2024 1

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.

memsharded avatar memsharded commented on July 2, 2024 1

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.

memsharded avatar memsharded commented on July 2, 2024

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.

koliyo avatar koliyo commented on July 2, 2024

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.

lasote avatar lasote commented on July 2, 2024

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.

lasote avatar lasote commented on July 2, 2024

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.

koliyo avatar koliyo commented on July 2, 2024

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.

memsharded avatar memsharded commented on July 2, 2024

@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.

memsharded avatar memsharded commented on July 2, 2024

Included also in tagged 0.4 pre-release

from cmake-conan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.