CMake using two different NDK, why is it broken? - visual-studio

I am trying to build the ceres-library on android.
I am following the instructions been given on the website, but I got stuck with an error and I don't understand why.
I am not an expert in building tools so I do apologize if my question is trivial but I'd like to know why it's not working.
Essentially what happens is that cmake for some reason is using the NDK I've installed with android studio but also the NDK that comes with visual studio if you enable the android development features.
My question first of all is why is using it both? (I would assume I have something broken in my setup but I cannot manage to fix it).
The command line I've been running is the following:
cmake -DCMAKE_TOOLCHAIN_FILE="C:\Users\l.gagliano\AppData\Local\Android\Sdk\ndk\16.1.4479499\build\cmake\android.toolchain.cmake" -DEigen3_DIR=D:\DEV\ceres\eigen\build -DANDROID_ABI=arm64-v8a -DANDROID_STL=c++_shared -DANDROID_NATIVE_API_LEVEL=android-21 -DBUILD_SHARED_LIBS=ON -DMINILOG=ON D:\DEV\ceres\ceres-solver-2.1.0
But I get the following output:
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Users/l.gagliano/AppData/Local/Android/Sdk/ndk/16.1.4479499/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
-- Check for working C compiler: C:/Users/l.gagliano/AppData/Local/Android/Sdk/ndk/16.1.4479499/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.25/Modules/CMakeTestCCompiler.cmake:70 (message):
The C compiler
"C:/Users/l.gagliano/AppData/Local/Android/Sdk/ndk/16.1.4479499/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: D:/DEV/ceres/ceres-android/CMakeFiles/CMakeScratch/TryCompile-lab0em
Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/MSBuild/Current/Bin/MSBuild.exe cmTC_366ff.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=16.0 /v:m && Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
ANDROID_HOME=C:\\Microsoft\AndroidSDK\25
ANT_HOME=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Apps\apache-ant-1.9.3
JAVA_HOME=C:\Program Files\Eclipse Foundation\jdk-8.0.302.8-hotspot
NDK_ROOT=C:\\Microsoft\AndroidNDK64\android-ndk-r16b
testCCompiler.c
In file included from <built-in>:327:
<command line>(3,9): warning : '__ANDROID_API__' macro redefined [-Wmacro-redefined] [D:\DEV\ceres\ceres-android\CMakeFiles\CMakeScratch\TryCompile-lab0em\cmTC_366ff.vcxproj]
#define __ANDROID_API__ 21
^
<command line>(1,9): note: previous definition is here
#define __ANDROID_API__ 19
^
1 warning generated.
C:\\Microsoft\AndroidNDK64\android-ndk-r16b\toolchains\x86_64-4.9\prebuilt\windows-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin\ld: error: cmTC_366ff.dir\Debug\testCCompiler.o: incompatible target
clang.exe: error: linker command failed with exit code 1 (use -v to see invocation)
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Application Type\Android\3.0\Android.Common.targets(119,5): error MSB6006: "clang.exe" exited with code 1. [D:\DEV\ceres\ceres-android\CMakeFiles\CMakeScratch\TryCompile-lab0em\cmTC_366ff.vcxproj]
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:60 (project)
-- Configuring incomplete, errors occurred!
See also "D:/DEV/ceres/ceres-android/CMakeFiles/CMakeOutput.log".
See also "D:/DEV/ceres/ceres-android/CMakeFiles/CMakeError.log".
The command line comes from the example given in the Ceres Android section.
Obviously my end goal, apart from understanding the error, is actually fixing it so any suggestion would be appreciated.

This sorted:
cmake -G "Visual Studio 16" -A arm64 -DCMAKE_PREFIX_PATH=D:\DEV\ceres\gflags\build-gflags -DCMAKE_TOOLCHAIN_FILE="C:\Users\l.gagliano\AppData\Local\Android\Sdk\ndk\16.1.4479499\build\cmake\android.toolchain.cmake" -DEigen3_DIR=D:\DEV\ceres\eigen\build -DANDROID_ABI=arm64-v8a -DANDROID_STL=c++_shared -DANDROID_NATIVE_API_LEVEL=android-21 -DBUILD_SHARED_LIBS=ON -DMINIGLOG=ON D:\DEV\ceres\ceres-solver-2.1.0
Mainly the -G "Visual Studio 16" -A arm64 was the big deal.

Related

Qt Creator fails to open a CMake project due to a wrong link.exe path

I upgraded Visual Studio 2017 recently and now cannot open a CMake project in Qt Creator 4.8.2.
CMake succeeds to test the compiler when running from cmd.exe but fails in Qt Creator:
Running "C:\Program Files\CMake\bin\cmake.exe -E server "--pipe=\\.\pipe\{b2399ce2-b8c1-4992-94b7-57b65efed70f}" --experimental" in D:\checkout\mateju\integrace\util\itex\build_Qt5-Release.
Starting to parse CMake project.
The C compiler identification is MSVC 19.16.27027.1
The CXX compiler identification is MSVC 19.16.27027.1
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.8/Modules/CMakeTestCCompiler.cmake:51 (message):
The C compiler "C:/Program Files (x86)/Microsoft Visual
Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe" is
not able to compile a simple test program.
It fails with the following output:
Change Dir: D:/checkout/mateju/integrace/util/itex/build_Qt5-Release/CMakeFiles/CMakeTmp
Run Build Command:"nmake" "/NOLOGO" "cmTC_1344c\fast"
"C:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe"
-f CMakeFiles\cmTC_1344c.dir\build.make /nologo -L
CMakeFiles\cmTC_1344c.dir\build
Building C object CMakeFiles/cmTC_1344c.dir/testCCompiler.c.obj
C:\PROGRA~2\MICROS~2\2017\COMMUN~1\VC\Tools\MSVC\1416~1.270\bin\HostX64\x64\cl.exe
#C:\Users\MATEJU~1\AppData\Local\Temp\nmEB0D.tmp
testCCompiler.c
Linking C executable cmTC_1344c.exe
"C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe
--intdir=CMakeFiles\cmTC_1344c.dir --manifests -- "C:\Program Files
(x86)\Microsoft Visual
Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64\link.exe"
/nologo #CMakeFiles\cmTC_1344c.dir\objects1.rsp
#C:\Users\MATEJU~1\AppData\Local\Temp\nmEC75.tmp
LINK Pass 1 failed to run.
NMAKE : fatal error U1077: "C:\Program Files\CMake\bin\cmake.exe":
return code 0xffffffff
Stop.
NMAKE : fatal error U1077: "C:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe":
return code 0x2
Stop.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
Configuring incomplete, errors occurred!
See also "D:/checkout/mateju/integrace/util/itex/build_Qt5-Release/CMakeFiles/CMakeOutput.log".
See also "D:/checkout/mateju/integrace/util/itex/build_Qt5-Release/CMakeFiles/CMakeError.log".
CMake Project parsing failed.
As you can see, the compiler path is:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64
However, it’s looking for the linker in the path:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64
So my question is: How can I update the linker path to (the only existing) 14.16.27023? Or what else should I do to continue using CMake in Qt Creator?
I’ve tried to find a corresponding option in my Qt Creator Compiler options but it claims to use the same vcvarsall.bat call which works well on command-line…
D:\build>"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.8
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
D:\build>link
Microsoft (R) Incremental Linker Version 14.16.27027.1
Copyright (C) Microsoft Corporation. All rights reserved.
<and so on...>
I’ve tried the following steps without any success:
add C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64 to PATH as the answer to a similar question suggests
launch Qt Creator from cmd.exe after running vcvarsall.bat in the same window
upgrade CMake to the latest stable version (3.14.1)
install and try in Qt Creator 4.9.0-rc1
search for the string 14.10.25017
in the Windows Registry – no results
in the Qt Creator directory
no configuration files found
found .pdb and .lib files which likely only means they were built using this version of Visual Studio
in C:\Program Files (x86)\Microsoft Visual Studio – no results
in C:\Program Files (x86)\Windows Kits – no results
After several unsuccessful guesses mentioned in the question, I succeeded to open, build and run my project after I issued
Build > Clear CMake Configuration
in the menu of Qt Creator.

How to run Visual Studio 2015 and 2017 on the same machine?

I installed Visual Studio Community 2015 on a server running Windows Server 2012 R2. I confirmed that the toolchain was able to build my C++ project (which uses CMake).
I then installed Visual Studio Community 2017 and confirmed that the toolchain was working as well. However, to my dismay, I soon discovered that the 2015 toolchain was no longer working. Trying to build my project resulted in the following errors:
-- The C compiler identification is MSVC 19.0.24215.1
-- The CXX compiler identification is MSVC 19.0.24215.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.8/Modules/CMakeTestCCompiler.cmake:51 (message):
The C compiler "C:/Program Files (x86)/Microsoft Visual Studio
14.0/VC/bin/cl.exe" is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/Nathan/Documents/repositories/qmdnsengine/build/CMakeFiles/CMakeTmp
Run Build Command:"nmake" "/NOLOGO" "cmTC_614a9\fast"
"C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\BIN\amd64\nmake.exe" -f CMakeFiles\cmTC_614a9.dir\build.make
/nologo -L CMakeFiles\cmTC_614a9.dir\build
Building C object CMakeFiles/cmTC_614a9.dir/testCCompiler.c.obj
C:\PROGRA~2\MICROS~1.0\VC\bin\cl.exe
#C:\Users\Nathan\AppData\Local\Temp\2\nmB42E.tmp
testCCompiler.c
Linking C executable cmTC_614a9.exe
"C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe
--intdir=CMakeFiles\cmTC_614a9.dir --manifests --
C:\PROGRA~2\MICROS~1.0\VC\bin\link.exe /nologo
#CMakeFiles\cmTC_614a9.dir\objects1.rsp
#C:\Users\Nathan\AppData\Local\Temp\2\nmB577.tmp
RC Pass 1 failed to run.
NMAKE : fatal error U1077: '"C:\Program Files\CMake\bin\cmake.exe"' :
return code '0xffffffff'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\BIN\amd64\nmake.exe"' : return code '0x2'
Stop.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Users/Nathan/Documents/repositories/qmdnsengine/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Nathan/Documents/repositories/qmdnsengine/build
What does this error mean and how would I go about fixing it?

VS 2010 and CMake: 'rc' is not recognized as an internal or external command

I'm trying to build a project on Windows 10 - Home using VS 2010 and CMake.
I'm getting the following errors:
zutil.c
lib -nologo -out:zlib.lib adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj gzwrite.obj infback.obj inflate.obj inftrees.obj inffast.obj trees.obj uncompr.obj zutil.obj
rc /dWIN32 /r /fozlib1.res ./win32/zlib1.rc
'rc' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: 'rc' : return code '0x1'
Stop.
*.dll
The system cannot find the file specified.
0 file(s) copied.
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
The system cannot find the file specified.
-- The C compiler identification is MSVC 16.0.40219.1
-- 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 C:/Program Files (x86)/CMake/share/cmake3.6/Modules/CMakeTestCCompiler.cmake:61 (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: C:/Project/build/libpng-1.6.7-build/CMakeFiles/CMakeTmp
Does anyone know what the cause of:
'rc' is not recognized as an internal or external command,
operable program or batch file."
would be?
I'm assuming that's also causing the cl.exe is broken error?
The last time I had this problem was when my Visual Studio 2012 Professional standard installation did not install any Windows SDK (the error log was showing an missing SDK header).
To verify your SDK installation e.g. check that you have any Resource Compiler installed. It should be in a path similar to:
C:\Program Files (x86)\Microsoft SDKs\Windows\v[some version]\bin\RC.Exe
Since I was missing this - or more accurate any SDK - I installed Windows 8.1 SDK (since Visual Studio 2012 does target Windows 8.x) and voila my CMake was able again to compile the (test) programs. I think for Visual Studio 2010 the default would be the Windows 7.0a SDK and for Visual Studio 2015 it would be Windows 10 SDK with Universal C Runtime.
Reference
The CXX compiler identification is unknown
Visual Studio 2010 Express, Windows SDK 7.1, CMake and 64 bit

Debugging Qt with Visual Studio

How is it possible to debug Qt 4.8 in Visual Studio 2005?
Building release does work but if i try to debug, I always get this message:
This application has failed to start because the application configuration is incorrect. Review the manifest file for possible errors. Reinstalling the application may fix this problem. For more details, please see the application event log.
How can I fix that? Thank you!
Update
I rebuild Qt for Visual Studio 2005 using configure -platform win32-msvc2005 and jom instead of nmake (damn thats fast) and now get following Errorcode:
The application was unable to start correctly (0xc0150002).Click OK to close the application.
Update2
How can I fix the DLLs and error messages?
Dependency Walker:
Missing DLLs
MSVCP90D.DLL
MSVCR90D.DLL
API-MS-WIN-APPMODEL-RUNTIME-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL
API-MS-WIN-SHCORE-SCALING-L1-1-1.DLL
DCOMP.DLL
IESHIMS.DLL
Error messages
Error: The Side-by-Side configuration information for "c:\qt\4.8.6\bin\QTGUID4.DLL" contains errors.
Error: At least one required implicit or forwarded dependency was not found.
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
Error: Modules with different CPU types were found.
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
Update 3
I now started from scratch:
Install qt-opensource-windows-x86-vs2008-4.8.6.exe (building from qt-everywhere-opensource-src-4.8.6.zip would even cause release mode not to work anymore, cannot find QtGuid4.lib and QtGui4.lib, but with building from installed Qt it finds the libs)
Install qt-vs-addin-1.1.11-opensource.exe
jom distclean "Error: File Makefile doesn't exist exit."
jom confclean "Error: File Makefile doesn't exist exit."
configure -platform win32-msvc2005
jom
Last few output lines of jom:
C:\Qt\4.8.6>jom
[...]
qimageiohandler.cpp
qimagereader.cpp
qimagewriter.cpp
qpaintengine_pic.cpp
qkeymapper_win.cpp
qiconloader.cpp
Code wird generiert...
Code wird generiert...
qimage.cpp
jom: C:\Qt\4.8.6\src\gui\Makefile.Release [tmp\obj\release_shared\qguiplatformpl
ugin.obj] Error 2
cl -c -FIqt_gui_pch.h -Yuqt_gui_pch.h -Fptmp\obj\release_shared\QtGui_pc
h.pch -nologo -Zm200 -Zc:wchar_t- -O2 -MD -W3 -w34100 -w34189 -GR -EHsc -DQT_SHA
RED -DQT_THREAD_SUPPORT -DUNICODE -DWIN32 -DQT_BUILD_GUI_LIB -DQT_NO_USING_NAMES
PACE -DQT_MAKEDLL -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT3_SUPPORT -
DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -D_USE_MATH_DEFINES -DQT_NO_DIRECTDRAW -D
QT_USE_BUNDLED_LIBPNG -DPNG_NO_ASSEMBLER_CODE -DQT_NO_CUPS -DQT_NO_LPR -DQT_NO_O
PENTYPE -DQT_NO_STYLE_MAC -DQT_NO_STYLE_GTK -DQT_NO_STYLE_WINDOWSCE -DQT_NO_STYL
E_WINDOWSMOBILE -DQT_NO_STYLE_S60 -DQT_NO_EGL -DQ_INTERNAL_QAPP_SRC -DQT_NO_DIRE
CTWRITE -DQT_DLL -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_
HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DNDEBUG -I"..\..\include\QtCore" -I"..
\..\include" -I"..\..\include\QtGui" -I"tmp\rcc\debug_shared" -I"tmp" -I"..\3rdp
arty\wintab" -I"image" -I"..\3rdparty\libpng" -I"..\3rdparty\zlib" -I"..\3rdpart
y\zlib" -I"..\3rdparty\harfbuzz\src" -I"dialogs" -I"..\..\include\ActiveQt" -I"t
mp\moc\release_shared" -I"." -I"..\..\mkspecs\win32-msvc2005" -Fotmp\obj\release
_shared\ #C:\Users\fpieske\AppData\Local\Temp\qpicture.obj.5884.19719.jom
qpicture.cpp
qpictureformatplugin.cpp
qpixmap.cpp
qpixmapdata.cpp
Code wird generiert...
Code wird generiert...
jom: C:\Qt\4.8.6\src\gui\Makefile [release-all] Error 2
jom: C:\Qt\4.8.6\Makefile [sub-gui-make_default-ordered] Error 2
C:\Qt\4.8.6>
I got it! Was about to quit trying to debug with Visual Studio and use Qt Creator instead. While reading how to configure Qt Creator i read about installing Windows SDK. Well debugging with Qt Creator still does not work (Unknown debugger type "No Engine") but installing Windows SDK solved my debugging problem in Visual Studio!
Try the following:
Open a command prompt and traverse to the directory where your Qt .pro file resides.
Run the following command - qmake -tp vc {name of the project file}.
Open Visual Studio and browse to the same directory. There should now be a generated VS project inside it.
Open the project.
In VS Project Properties|Configuration Properties|Debugging set any Environment or Command Line Arguments.
Build a debug version of the application and run it.
Save solution.
If you encounter build problems it may be that there were incorrectly escaped strings (at least as far as VS is concerned) in the project file. For example
DEFINES+=\"DEFINE_NAME=$$quote(\\"SomeString\\")\"
Will need to be modifed temporarily to this:
DEFINES+=\"DEFINE_NAME=$$quote(\"\"\"SomeString\"\"\")\"

CMake for CodeBlocks under windows

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!
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.
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
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.

Resources