-1

I am trying to install a simulation software on windows using MingW32 and cmake.

The problem I have is after I use :

cmake .. -DCMAKE_INSTALL_PREFIX="/cygdrive/c/Gromacs467" -DGMX_X11=OFF -DGMX_GPU=OFF -DGMX_MPI=OFF -DGMX_PREFER_STATIC_LIBS=ON -DGMX_CPU_ACCELERATION=SSE2 -DBUILD_SHARED_LIBS=NO -DGMX_BUILD_OWN_FFTW=ON -VMDDIR="C:\Program Files (x86)\University of Illinois\VMD"  -G "MinGW Makefiles"

From a Microsoft visual studio, (Otherwise I ran in other issue).

I then start a MinGW console and go to the repertory where my Makefile was created, and enter the command make, and here is what I get :

c:\Temp\gromacs-4.6.7\cmake_build>make
Microsoft Windows [Version 10.0.10586]
(c) 2015 Microsoft Corporation. All rights reserved.

And naturally the make command does not actually execute. Why do I get the windows version ? No idea....

Interestingly enough, the name of the MniGW32 console change to add make at the end if I enter it more than once, and keeps on doing it later.

make --version gives the normal output, so I do not understand where the problem comes from.

c:\Temp\gromacs-4.6.7\cmake_build>make --version
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i686-pc-msys
Martin F
  • 47
  • 1
  • 9
  • What is executed depends on your current directory and then the `PATH` environment variable. Are both run using the same console, and not one using the Visual Studio 'Developer Command Prompt'? – MicroVirus May 31 '16 at 23:46

2 Answers2

3

If you use cmake ... -G "MinGW Makefiles" you will need to call mingw32-make.

And just a hint: I assume you were previously building with Cygwin and for MinGW32 it should be -DCMAKE_INSTALL_PREFIX="/c/Gromacs467" instead of -DCMAKE_INSTALL_PREFIX="/cygdrive/c/Gromacs467"

References

Community
  • 1
  • 1
Florian
  • 39,996
  • 9
  • 133
  • 149
3

Instead of calling make directly, you can let CMake invoke the build for you with the following syntax:

cmake --build <build-dir> --target <target-name> --config <build-type>

The --target and --config arguments are optional and <build-dir> must point to your CMake project's build directory. The main advantage to invoking your build this way is that CMake has already determined the build tool and knows where to find it and how to invoke it correctly. Invoking your build via CMake in this manner is likely to be more robust.

Basic CMake documentation for the --build option available here and some related material can be found in this blog post, particularly the section "Abstracting away the build tool" (disclosure: I wrote the blog article).

Craig Scott
  • 9,238
  • 5
  • 56
  • 85