Infer Conan profile from CMake toolchain file for cross-building?
See original GitHub issueI try to integrate Conan in a CMake project using CMake toolchain files for cross-building.
The only way I could get it working was creating an additional Conan profile file matching the toolchain file settings. I wonder if it’s possible to infer those information from the CMake toolchain file to simply (cross-)building:
conan_cmake_run(
CONANFILE conanfile.txt
BASIC_SETUP
PROFILE ${CMAKE_SOURCE_DIR}/profile-armv7.conan # <- neccessary?
PROFILE_AUTO ALL
BUILD missing
)
I created a small example project to showcase the current state and goals: https://github.com/lukasberbuer/cmake-conan-crossbuild
PS: I’m pretty new to Conan and very impressed so far - solves a lot of problems for me. Great project!
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Cross building — conan 1.56.0 documentation
Using a profile: install the toolchain in your computer and use a profile to declare the settings and point to the needed tools/libraries...
Read more >Conanfile settings when cross-compiling with CMake and ...
I found I can set this in the [env] section of the profile, using CONAN_CMAKE_TOOLCHAIN_FILE , but it is not considered in settings...
Read more >Untitled
A CMake toolchain file is most often used for cross-compilation. ... was creating an additional Conan profile file matching the toolchain file settings....
Read more >Packaging C/C++ dependencies with Conan
from conans import ConanFile, CMake ... cmake. 22 conanfile.txt. Conan 101: Consuming packages ... conan create . theo/stable --profile clang5-debug.
Read more >Formula Install On Request Events (365 days)
#1919, null-dev/firefox-profile-switcher/firefox-profile-switcher-connector ... #2689, messense/macos-cross-toolchains/x86_64-unknown-linux-gnu, 1,440, 0%.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@uyha: It seems to work, thanks! I updated the repository with your recommended solution.
The arch variable needs to be specified in the CMake toolchain file:
Everything else can be derived from CMake. The Conan profile file is not necessary any more:
Note: Beware of strange paths on Windows:
I think these should be native patchs with
cmake_path(NATIVE CMAKE_C_COMPILER NORMALIZE cc)
likeENV CC=${cc}
but ninja, still has troubles when this resolves to somethingC:/Program Files
which is treaded as"C:/Program" "Files"
in Ninja…