[CMake] crosscompilation and source generation via add_custom_command

Hendrik Sattler post at hendrik-sattler.de
Mon Feb 3 15:11:41 EST 2020



Am 3. Februar 2020 20:48:50 MEZ schrieb "Jędrzej Dudkiewicz" <jedrzej.dudkiewicz at gmail.com>:
>Hello,
>
>I cross-compile a project from x86_64-linux-gnu to
>arm-linux-gnueabihf. Currently this is done using hand-written
>Makefiles, but I"m moving it to cmake. This project uses custom
>version of `lemon` parser generator. Aforementioned lemon is included
>as a source - this is single .c file that is compiled during build. Is
>there a way to build and run this binary on x86_64-linux-gnu while
>cross-compiling to arm-linux-gnuabihf? I suppose I could
>add_custom_command that would compile using hardcoded compiler
>version, but it doesn't seem very nice.

You can compile the tool using ExternalProject. This needs a separate directory with a its own CMakeLists.txt file for the tool.

>Thanks in advance,
>-- 
>Jędrzej Dudkiewicz
>
>I really hate this damn machine, I wish that they would sell it.
>It never does just what I want, but only what I tell it.
>-- 
>
>Powered by kitware.com/cmake
>
>Kitware offers various services to support the CMake community. For
>more information on each offering, please visit
>https://cmake.org/services
>
>Visit other Kitware open-source projects at
>https://www.kitware.com/platforms
>
>Follow this link to subscribe/unsubscribe:
>https://cmake.org/mailman/listinfo/cmake
>
>This mailing list is deprecated in favor of https://discourse.cmake.org


More information about the CMake mailing list