0

I'm trying to use CMake to code with CodeBlocks under Windows.

Inside Cygwin console I do :

cmake .. -G"CodeBlocks - Unix Makefiles"

and output is :

CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
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: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module file:D:/sources/tests/testOSG/build_CodeBlocks/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: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file:D:/sources/tests/testOSG/build_CodeBlocks/CMakeFiles/CMakeCXXCompiler.cmake
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

I tried to set those problematic variables, but result is the same :

set CMAKE_MAKE_PROGRAM=C:/Progra~2/CodeBlocks/MinGW/bin/mingw32-make.exe
set CMAKE_C_COMPILER=C:/Progra~2/Microsoft Visual Studio 10.0/VC/bin/cl.exe
set CMAKE_CXX_COMPILER=C:/Progra~2/Microsoft Visual Studio 10.0/VC/bin/cl.exe

Any ideas how to make it work ?

Edit : adding the path to the compiler helps, but there's still an error :

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Defining WIN32 under Cygwin due to CMAKE_LEGACY_CYGWIN_WIN32
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe -- broken
CMake Error at /usr/share/cmake-2.8.9/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
  The C compiler "C:/Program Files (x86)/Microsoft Visual Studio
  10.0/VC/bin/cl.exe" is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: /cygdrive/d/sources/tests/testOSG/build_CodeBlocks/CMakeFiles/CMakeTmp

  Run Build Command:C:/Program\ Files\
  (x86)/CodeBlocks/MinGW/bin/mingw32-make.exe
  "cmTryCompileExec437970983/fast"

  C:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-make -f
  CMakeFiles/cmTryCompileExec437970983.dir/build.make
  CMakeFiles/cmTryCompileExec437970983.dir/build

  /usr/bin/sh: -c: line 0: Erreur de syntaxe près du symbole inattendu « (
  »

  /usr/bin/sh: -c: line 0: `C:/Program Files
  (x86)/CodeBlocks/MinGW/bin/mingw32-make -f
  CMakeFiles/cmTryCompileExec437970983.dir/build.make
  CMakeFiles/cmTryCompileExec437970983.dir/build'

  mingw32-make: *** [cmTryCompileExec437970983/fast] Error 1

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):

-- Configuring incomplete, errors occurred!
Ote
  • 301
  • 1
  • 5
  • 16

3 Answers3

2

Maybe you installed the 'basic setup' from 'MinGW Installation Manager'. As it does not install the GNU C++ compiler with package name- 'mingw-gcc-g++'you should select its 'bin' and 'dev' and install manually. This worked for me.

Abdullah
  • 488
  • 6
  • 16
1

for me following worked:

downloaded codeblocks-17.12mingw-setup.

added path to /MinGW/bin

hint: DONT INSTALL TO PATH WITH SPACES IN IT

in my case C:\Program Files (x86)\CodeBlocks\MinGW\bin dont worked for some projects.

when using c:\codeblocks... they work

in cmake use "CodeBlocks - MinGW Makefiles"

then open project.cbp

0

Make sure the directory with compilers(MinGw-gcc.exe or something similar) is in the PATH, after that start console one more time and try to run cmake again.

ixSci
  • 13,100
  • 5
  • 45
  • 79
  • Thanks, it helps to avoid first error, but a new one came (see original message, comments are too limited in characters to put it here) – Ote Feb 22 '13 at 16:36
  • Why do you set your compiler as cl? Shouldn't it be gcc? Or if you are using cl why don't you use Visual Studio? – ixSci Feb 22 '13 at 17:14
  • Because I don't like Visual Studio but I need to use the same compiler as my team. But starting to wonder if what I want is possible... – Ote Feb 24 '13 at 19:55