0

I have a CMake project that supports multiple platform combination (arm, powerpc ,x86-64). Native platform is x86-64.

I have toolchain.cmake file for each cross-platform build(for arm and powerpc). When I give toolcahin.cmake files for cross-platform build to cmake everything is working as expected except one thing.

In the project I want to build a particular executable with native build support(that is on x86-64). Since I gave toolchain.cmake file explicitly, so all CMAKE_C_FLAGS are global for all executable in project.

So I want to give toolchain.cmake(say for arm) to cmake and want to build the whole project except one executable on native(x86-64) in one go. Is there any way where I can change the complete CMAKE_C_FLAGS and can provide the native one for that particular executable ?

I tried few things as per How to change a compiler flag for just one executable in CMake? but can't get the solution to this problem

sepp2k
  • 363,768
  • 54
  • 674
  • 675
uday singh
  • 61
  • 9
  • Possible duplicate of [Using CMake with multiple compilers for the same language](https://stackoverflow.com/questions/9542971/using-cmake-with-multiple-compilers-for-the-same-language) – Tsyvarev Sep 26 '18 at 10:26
  • In CMake project you cannot build executables both for the host and for the target at once. You need to use several `cmake` invocations (with different toolchains and so). – Tsyvarev Sep 26 '18 at 10:28

0 Answers0