Closed sct2010 closed 3 months ago
Hi, @sct2010
I have some doubts, I'm not sure if we should set the value of definitions["CMAKE_SYSTEM_NAME"]
(it would take the value 'Generic' given the current implementation) or we should just improve the if definitions:
so it checks for actual cross-compilation. I feel like the second option is better, CMAKE_SYSTEM_NAME
will take the value of CMAKE_HOST_SYSTEM_NAME
and we will enter the if
to set the rest of CMake variables, wdyt?
Hi @jgsogo
You are right, setting the definitions["CMAKE_SYSTEM_NAME"]
to Generic
is not a proper solution.
Improving the if definitions:
would be better. A few lines above you already have a check if we are crosscompiling. Why not include it?
if cross_building(self._conanfile.settings) or definitions:
Not sure if it should be just if cross_building(self._conanfile.settings):
... it is an easy PR 😉
This ticket is quite outdated, both tools, env-management and the 2 profile cross-build model has changed everything.
Closing the ticket, please report a new one against the new Conan 2 if necessary, thanks!
I was trying to cross compile from linux x86_64 to linux arm32. The toolchain and sysroot are conan packages. The two conanfiles setting the package_info:
I expected to get the content of the CONAN_CMAKE_FIND_ROOT_PATH variable available in the cmake file. It is not the case.
My configuration is the following:
After a quick look at the conan source, I found an issue in the
client/build/cmake_flags.py
:In my case,
cross_building(self._conanfile.settings)
returnsTrue
. In the next line it detects host and target os is the same (if os_ != os_build:
). So it is not setting thedefinitions["CMAKE_SYSTEM_NAME"]
. Later in the code it detects if cross compilation is enabled, byif definitions:
. Since it never sets a single definition above, the check if we are cross compilation fails and the definitions are empty. My sugesstion is to change the following line:to something like
Currently I have a workaroung and force the cross compilation detection by setting:
self.env_info.CONAN_CMAKE_SYSTEM_NAME = "Linux"
Environment Details (include every applicable attribute)