[CMake] Cross compilation and native executables

Guillaume Duhamel guillaume.duhamel at gmail.com
Thu Jan 28 17:19:38 EST 2010


> (3)
> Use execute_process() to run the CMake command line tool and configure the
> host-only project during the configuration step of the main project.  This
> will make the results of the export() command from the subproject available
> for loading by the main project.  Then add a custom target to drive the
> subproject build during the main project build using "cmake --build".
>

I tried using that method with a minor change: I'm launching the generated
native
executable from the native project, so I don't have to export / include any
target.

So I just had to replace:

subdirs(c68k)

with:

file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/c68k)
execute_process(COMMAND cmake ${CMAKE_CURRENT_SOURCE_DIR}/c68k
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/c68k)
add_custom_target(c68kinc COMMAND cmake --build
${CMAKE_CURRENT_BINARY_DIR}/c68k)

It does run the configuration and build step at the right time, but for some
reason
it detects the cross-compiler instead of the native one ; it almost looks
like the
sub-porjects inherits some values from the "parent" project despite being
run from
a separate CMake process.

Guillaume
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100128/b1cef6fd/attachment.htm>


More information about the CMake mailing list