2

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?

1
  • 2
    Look at the cmake --build command. Commented May 21, 2012 at 12:59

3 Answers 3

1

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.

Sign up to request clarification or add additional context in comments.

3 Comments

That is nearly what I want to do. But in this case cmake invokes other external build tools. Does cmake have it's own native makefile format that would invoke cl (or any other compiler) directly instead of going through *make tools?
@rhlee, SCons directly supports parallel building without needing external tools: scons -j 4 will compile 4 tasks in parallel
CMake doesn't work that way. Why do you want to avoid using other tools? You need a compiler anyway, so at least nmake is likely to be installed as well.
1

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.

Comments

-1

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! :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.