Gili
Gili

Reputation: 90150

CMake: How to build projects in a cross-platform manner?

I'm trying to build a project in a cross-platform manner.

I'm using CMake to generate project files on the fly, but it's not clear how to then compile those project files in a cross-platform way. I found try_compile but it's not clear whether this will do what I want. Any ideas?

For example, say I am using Visual Studio 2010 against project foo. I am expecting CMake to generate foo.sln, and then build it (generate the binaries). I know how to automate the first part, but how do I automate the second?

Upvotes: 1

Views: 439

Answers (1)

Fraser
Fraser

Reputation: 78418

From the CMake docs:

"CMake is a cross-platform build system generator."

So in other words, once CMake has generated the project files, it's work is really done.

You can invoke the native build tool via CMake using the --build flag, e.g.

cmake --build . --config Release --target install -- /M:4

See here for further info.

Upvotes: 4

Related Questions