Guillaume Duhamel wrote:
> 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.

The execute_process() will run the child CMake with the same environment
variables that the outer CMake uses.  If you have CC or CXX set for the
cross compiler then the inner project will choose that.

I expect the entire native project uses a different toolchain altogether.
You need to pass this toolchain on the inner cmake command line.
Something like this might work:

execute_process(
  COMMAND cmake ${CMAKE_CURRENT_SOURCE_DIR}/c68k
                -DCMAKE_C_COMPILER=/path/to/native/cc
                -DCMAKE_C_FLAGS=""
  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/c68k
  )

-Brad
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to