[CMake] Cross Compiling

Michael Wild themiwi at gmail.com
Tue Jan 5 03:04:38 EST 2010


On 4. Jan, 2010, at 19:15 , Alexander Neundorf wrote:
[snip]
> 
>> - There is no distinction between install prefixes for the target and the
>> host. Sometimes I'd like to put various build tools on the host system at
>> the same time as libs and binaries on the target root.
> 
> In CMake one build tree uses one toolchain. So in one build tree you can only 
> create executable which run either for the target, of for the host, not both 
> in one go.
> So if you need first to create host build tools, and later on use them for the 
> actual cross compile, you need two build trees. I would recommend to "export" 
> the executable and "import" them again in the cross build.
> 
> If this is not your problem, but really just the install location, you can set 
> the install location of every install() command separately, this is 
> completely independent from the cross compiling support.



To automate this you can use the ExternalProject.cmake that comes with CMake-2.8 to build the host tools. You can then use add_executable(tool IMPORTED) and set_target_properties(tool PROPERTIES IMPORTED_LOCATION ...) to import the tool target into the cross-compiling project.


Michael



More information about the CMake mailing list