cmake des problèmes dans Windows

Je suis en train de compiler ce (assez complexe) morceau de code avec cmake et MinGW sous Windows:

#include <iostream>

int main()
{
    std::cout << "Test" << std::endl;
    return 0;
}

C'est le CMakeLists.txt fichier (qui fonctionne correctement sous Linux):

cmake_minimum_required(VERSION 2.6)

SET(CMAKE_C_COMPILER path/to/gcc)
SET(CMAKE_CXX_COMPILER path/to/g++)

project(cmake_test)

add_executable(a.exe test.cpp)

Avec la commande:

cmake -G"MinGW Makefiles" .

J'obtiens ces erreurs:

CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeMinGWFindMake.cmake:20 (MESSAGE):
  sh.exe was found in your PATH, here:

  C:/MinGW/msys/1.0/bin/sh.exe

  For MinGW make to work correctly sh.exe must NOT be in your path.

  Run cmake from a shell that does not have sh.exe in your PATH.

  If you want to use a UNIX shell, then use MSYS Makefiles.

Call Stack (most recent call first):
  CMakeLists.txt:8 (project)


CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Could not find cmake module file:C:/cmake_test/CMakeFiles/CMakeCCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Could not find cmake module file:C:/cmake_test/CMakeFiles/CMakeCXXCompiler.cmake
-- Configuring incomplete, errors occurred!

Ces erreurs ne m'aide pas beaucoup. Considérant qu'il fonctionne sous Linux, il doit être quelque chose lié à la Fenêtre de configuration.

Merci pour toute aide!

Configuration:
- Windows 7
- MinGW/GCC 4.6.1

Le message d'erreur de CMake est clair: assurez-vous que vous n'avez pas de poisson dans votre chemin. C'est: Ne pas lancer CMake -G"MinGW Makefiles" à partir de votre MSys invite.
Alors pourquoi avoir sh.exe dans mon chemin est un problème?
En exécutant where sh.exe je l'ai trouvé à C:\Cygwin64\bin\sh.exe et C:\Program Files\OpenSSHbinsh.exe. Comment dois-je retirer Cygwin et OpenSSH principaux dossiers sans les casser?

OriginalL'auteur Pietro | 2012-10-24