rhlee
rhlee

Reputation: 4046

Using cmake to compile

I come from a unixy background, so tend to prefer command-line style automation over ide's.

I'm tryng to get deeper into windows development. I have previously written programs on Windows just using the cl compiler to compile the c code. I'd like to move to an automated build system like cmake.

I can get cmake to create an Visual Studio solution, which will compile. But that is not quite what I am looking for. What I am looking for is for cmake to invoke to cl to compile/link the code itself, just like make invokes gcc.

Is cmake able to do this or would Scons be better suited for me?

Upvotes: 2

Views: 2321

Answers (3)

rhlee
rhlee

Reputation: 4046

Found out, as per Peter's comment, that cmake is a build-generator tool. It's generates makefiles that external build tools can run. So I'll either use cmake+namke or scons.

Upvotes: 1

Bill Hoffman
Bill Hoffman

Reputation: 1752

Once you have your project created with CMake, cmake can also run the build.

cd builddir cmake --build .

You can also use CMake to create nmake or jom (parallel nmake) makefiles, or even gmake. So, it is certainly possible to use CMake from the command line and use VS compilers.

Upvotes: 1

Brady
Brady

Reputation: 10357

Im not so sure about cmake, but SCons has some builders dedicated just to Microsoft Visual Studio.

Look for the following in the SCons builder documentation:

  • MSVSProject()
  • MSVSSolution()

Plus SCons has a much nicer syntax, its python! :)

Upvotes: -1

Related Questions