[cmake-developers] Cannot cross-compile CMake

David Cole david.cole at kitware.com
Mon Sep 12 09:23:18 EDT 2011


Looks to me like this would be sufficient:

# only build/install the documentation if not crosscompiling
IF(NOT CMAKE_CROSSCOMPILING)
  INSTALL_FILES(${CMAKE_MAN_DIR}/man1 FILES ${MAN_FILES})
  INSTALL_FILES(${CMAKE_DOC_DIR} FILES ${HTML_FILES} ${TEXT_FILES})
  INSTALL(FILES cmake.m4 DESTINATION share/aclocal)

  # Drive documentation generation.
  ADD_CUSTOM_TARGET(documentation ALL DEPENDS ${DOC_FILES}
${CMake_BINARY_DIR}/Docs/cmake.txt )
ENDIF()

Not sure if there's a "wiser" way to achieve your goal...

How are you testing the cross-compiled CMake to ensure that it works
as expected...?



On Mon, Sep 12, 2011 at 8:14 AM, Rolf Eike Beer <eike at sf-mail.de> wrote:
> Hi,
>
> I just tried to cross-compile CMake for an ARM target. Which I did was
> basically:
>
> -bootstrap and build CMake for the host
> -create a toolchain file for the target
> -call this to configure CMake:
>
> cmake \
>        -D CMAKE_TOOLCHAIN_FILE=${prefix}/etc/toolchain.cmake \
>        -D CMAKE_INSTALL_PREFIX=/usr \
>        -D KWSYS_LFS_WORKS=TRUE \
>        -D KWSYS_CHAR_IS_SIGNED=TRUE \
>        ../cmake \
>        ;
>
> The last two were needed because CMake can't determine those because it's
> using a cross compiler. Annoying, but easily solved. But then I tried to
> build and ended with this:
>
> Scanning dependencies of target documentation
> [ 98%] [ 98%] [ 98%] Generating ../Docs/ctest.txt
> Generating ../Docs/cpack.txt
> Generating ../Docs/cmake.txt
> /bin/sh: ../bin/ctest: cannot execute binary file
> make[2]: *** [Docs/ctest.txt] Error 126
> make[2]: *** Waiting for unfinished jobs....
> /bin/sh: ../bin/cmake: cannot execute binary file
> make[2]: *** [Docs/cmake.txt] Error 126
> /bin/sh: ../bin/cpack: cannot execute binary file
> make[2]: *** [Docs/cpack.txt] Error 126
> make[1]: *** [Utilities/CMakeFiles/documentation.dir/all] Error 2
>
> Well, of course this will not work, this is _cross_ compiling...
>
> For now my solution is this:
>
> sed 's/^ADD_CUSTOM_TARGET(documentation/#&/;s/^INSTALL_FILES(/#&/' -i
> cmake/Utilities/CMakeLists.txt
>
> This is no problem for me since I don't need the documentation on the
> target anyway.
>
> Are there any hints on this subject or should I just go and create a bug
> report?
>
> Eike
> _______________________________________________
> cmake-developers mailing list
> cmake-developers at cmake.org
> http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
>



More information about the cmake-developers mailing list