[CMake] MinGW Makefiles generator and -j
daniel at connect2.com
Sat Apr 26 21:57:28 EDT 2008
I am currently using the NMake generator when compiling in Windows with MSVC,
but I would like to use the MinGW generator so that I can use its -j switch. I
am able to build everything with MinGW but the -j switch doesn't seem to do
I made a simple test application with the following files:
add_executable (helloDemo main.cxx a_demo.cxx b_demo.cxx c_demo.cxx d_demo.cxx
e_demo.cxx f_demo.cxx g_demo.cxx h_demo.cxx)
int main(int argc, char* argv)
a_demo.cxx -- h_demo.cxx (just so it take a second to compile)
Then I ran cmake like this, I found that I needed to add these definitions to
get it to use MSVC. This is with mingw make
cmake -G "MinGW Makefiles" .. -DCMAKE_MAKE_PROGRAM=make
-DCMAKE_C_COMPILER="C:/Program Files/Microsoft Visual Studio 8/VC/bin/cl.exe"
-DCMAKE_CXX_COMPILER="C:/Program Files/Microsoft Visual Studio 8/VC/bin/cl.exe"
But when I run 'make -j4' it doesn't run in parallel.
If I configure like this (cygwin make):
cmake -G "Unix Makefiles" .. -DCMAKE_C_COMPILER="C:/Program Files/Microsoft
Visual Studio 8/VC/bin/cl.exe" -DCMAKE_CXX_COMPILER="C:/Program Files/Microsoft
Visual Studio 8/VC/bin/cl.exe" -DCMAKE_MAKE_PROGRAM=C:/cygwin/bin/make
Then when I run 'make -j4' it does run in parallel.
I should add that I tested my copy of mingw make to be sure it worked properly
with the -j option by creating a Makefile by hand that had sleep statements.
I also tried to use the Unix Makefiles generator for my real project but I got:
PCHeader/CMakeFiles/PCHeader.dir/build.make:44: *** target pattern contains no
make: *** [PCHeader/CMakeFiles/PCHeader.dir/all] Error 2
make: *** [all] Error 2
More information about the CMake