0

I am now working on my c++ project. I would like to use CMake targeting multiple platforms in a single build. From the post here

How to make CMake targeting multiple platforms in a single build

It mentioned that we can automate this by having an enclosing build script which invokes CMake once for each target platform and performs several out-of-source builds to distinct binary directories. The enclosing script could also be written in CMake(ExternalProject). I have no idea how to write this automation in Cmake ExternalProject. Could anyone suggest me an idea or give me an example on it?

Carl
  • 105
  • 3
  • 12
  • "Could anyone suggest me an idea or give me an example on it?" - Stack Overflow is a bad place for *open-ended* questions and asking for external resource (an example in your case) is **off-topic** here. If you know nothing about CMake scripting, then take any other language, which you are familiar with, for implement your automation task. If you are familiar with CMake scripting, then you definitely can formulate your problem in more precise manner, than "I **have no idea** how to write this automation in Cmake ExternalProject." – Tsyvarev Jan 10 '19 at 19:39
  • Do you know how to make a build targeting one platform? Why not just write a batch script that performs those same commands, but points to your other target platforms? – Chris Jan 10 '19 at 21:18
  • @Carl I suggest using a shell script for this purpose, which should be straightforward. CMake's `ExternalProject_Add` is not designed for this. You would need to explicitly pass many options (e.g. compiler flags) to `ExternalProject_Add` for this to work correctly. – Raul Laasner Jan 10 '19 at 22:01
  • Actually I am working on a c++ project in mac x64 and want to build the project in linux x64 and linux x32 environment – Carl Jan 11 '19 at 10:56

0 Answers0