-
Notifications
You must be signed in to change notification settings - Fork 254
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
Using Host and Build Profile from CMakePresets #678
Comments
I found a smart solution, which finally doesn't work as expected.
And
With this, CMakeCache variables are set expected, but CMake build failed for some reason.
and build:
The output directory for Conan is default, the recipe isn't any special
|
During reducing the problem, it compiles now for some circumstances. I'm not sure what the problem is, but it seems to be related to selected compiler by Conan and/or the profile... I continued with my experiments: > conan remove '*'
...
> rm -rf build; CMAKE_CXX_COMPILER=clang++ CXX=clang++ cmake --preset clang-libc++
...
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is Clang 18.1.3
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - broken
CMake Error at /opt/cmake/share/cmake-3.30/Modules/CMakeTestCCompiler.cmake:67 (message):
The C compiler
"/usr/bin/cc"
is not able to compile a simple test program.
...
> conan list 'catch*/*:*' --format=compact
Local Cache
catch2/3.7.1
catch2/3.7.1#431d772165ed0bc5adaabaa44a9f53ca%1726584452.35 (2024-09-17 14:47:32 UTC)
catch2/3.7.1#431d772165ed0bc5adaabaa44a9f53ca:33ee53aab1b9bfd22e13914fa502a98606b452d9
settings: Linux, x86_64, Release, clang, gnu17, libc++, 18
options(diff):
catch2/3.7.1#431d772165ed0bc5adaabaa44a9f53ca:9976135ac672b25daf671f2b7a42dcb840fc7db9
settings: Linux, x86_64, Debug, clang, gnu17, libc++, 18
options(diff):
So Conan related settings seems to be correct to me :( But: > rm -rf build; CC=clang CXX=clang++ cmake --preset clang-libc++
...
# all fine with explicit given CC - even unused !!!!!
> cmake --build --preset clang-libc++-release
...
Error while scanning dependencies for /workspaces/conan-cmake-issue/testsuite/test_me.cpp:
/workspaces/conan-cmake-issue/testsuite/test_me.cpp:1:10: fatal error: 'catch2/catch_test_macros.hpp' file not found
[2/8] Scanning /workspaces/conan-cmake-issue/source/main.cpp for CXX dependencies
ninja: build stopped: subcommand failed. Anyway, somewhere I've got lost ... I created a branch conan-explicit with call of |
I like to start with the positive things: it works as intended, but if you have other ideas, problems rises as usually :)
Anyway, I use
CMakePresets.json
in that way:where I clone the git repo
cmake-conan
into${sourceDir}/cmake/cmake-conan
and inherits to all my presets, which works as expected.To support macOS users with clang and libc++ on my Linux box, I have a special target
clang-libc++
(since I don't own a Mac).My intention is to use
cmake-conan
with this CMake preset.The first step was to write a
default
profile for conan:The conan provider should take this into account for host and build profile, but doesn't.
Second try, I wrote a CMake cache file
clang-libc++-cachevars.cmake
:to inject this into the CMake cache as it is done with the
CMakePresets.json
from above, and call it:Finally, the provider is always creating the build profile:
and the CMakeCache.txt contains always:
To me, it looks as the variables
CONAN_BUILD_PROFILE
andCONAN_HOST_PROFILE
aren't honored as described in the docs, isn't it or do I use it not in the right way?The text was updated successfully, but these errors were encountered: