[CMake] Specifying both native and cross compiler at the same time

Mojca Miklavec mojca.miklavec.lists at gmail.com
Tue Mar 19 04:16:27 EDT 2019


Hi,

I would like a build setup for a project to work correctly for both native
and cross compilation, however one part requires native compilation and
execution of the binary to generate some data tables as part of the build
process (the temporary native binary is then discarded / not installed).

What I seem to be unable to figure out is how to specify the compiler(s)
and flags separately for the native and cross compiler. I want them to be
specified by the user or package manager rather than the author of cmake
files.

One particular problem is when cross-compiling on mac with mingw (gcc)
while using clang as the native compiler (the two compilers have
incompatible flags).

How can I specify two sets of compilers and flags at configure time? (The
same question puzzles me in autoconf world as well. Please don't say that
the native compiler should be found automatically as I really need to
specify which one to use, ancient systems don't have support for C++11 with
the default compiler etc.)

Thank you very much,
    Mojca
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190319/04a19762/attachment.html>


More information about the CMake mailing list