Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cmake is Unable to Configure Project for Visual Studios 10 amd64

I am trying to get CMAKE to create a project for msvc 10 express edition for x64 architecture. I have both MSVC 2010 Express and Windows SDK 7.1 installed.

If I start CMake Normally I can create a 32 bit project, however it fails to make a 64 bit project. I have also Tried starting CMAKE from within the Windows SDK Command Prompt (cl cmd maps to x64 version) however It still fails with the following.

Found Windows SDK v7.1: C:\Program Files\Microsoft SDKs\Windows\v7.1\
Check for working C compiler using: Visual Studio 10 Win64
Check for working C compiler using: Visual Studio 10 Win64 -- broken
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
  The C compiler "c:/Program Files (x86)/Microsoft Visual Studio
  10.0/VC/bin/amd64/cl.exe" is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: C:/Users/Dan/Desktop/pclt/PCL/bin/CMakeFiles/CMakeTmp



  Run Build Command:C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
  cmTryCompileExec1400574213.vcxproj /p:Configuration=Debug

  Microsoft (R) Build Engine Version 4.0.30319.1

  [Microsoft .NET Framework, Version 4.0.30319.296]

  Copyright (C) Microsoft Corporation 2007.  All rights reserved.



  Build started 1/14/2013 8:15:59 AM.

  Project
  "C:\Users\Dan\Desktop\pclt\PCL\bin\CMakeFiles\CMakeTmp\cmTryCompileExec1400574213.vcxproj"
  on node 1 (default targets).

  PrepareForBuild:

    Creating directory "cmTryCompileExec1400574213.dir\Debug\".
    Creating directory "C:\Users\Dan\Desktop\pclt\PCL\bin\CMakeFiles\CMakeTmp\Debug\".

  InitializeBuildStatus:

    Creating "cmTryCompileExec1400574213.dir\Debug\cmTryCompileExec1400574213.unsuccessfulbuild" because "AlwaysCreate" was specified.

  ClCompile:

    c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\CL.exe /c /Zi /W3 /WX- /Od /Ob0 /D WIN32 /D _WINDOWS /D _DEBUG /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"cmTryCompileExec1400574213.dir\Debug\\" /Fd"C:/Users/Dan/Desktop/pclt/PCL/bin/CMakeFiles/CMakeTmp/Debug/cmTryCompileExec1400574213.pdb" /Gd /TC /errorReport:queue C:\Users\Dan\Desktop\pclt\PCL\bin\CMakeFiles\CMakeTmp\testCCompiler.c  /Zm1000 /GZ 

  C:\Program Files
  (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\Microsoft.Cpp.x64.Targets(146,5):
  error : Required file "" is missing.
  [C:\Users\Dan\Desktop\pclt\PCL\bin\CMakeFiles\CMakeTmp\cmTryCompileExec1400574213.vcxproj]


  Done Building Project
  "C:\Users\Dan\Desktop\pclt\PCL\bin\CMakeFiles\CMakeTmp\cmTryCompileExec1400574213.vcxproj"
  (default targets) -- FAILED.



  Build FAILED.




  "C:\Users\Dan\Desktop\pclt\PCL\bin\CMakeFiles\CMakeTmp\cmTryCompileExec1400574213.vcxproj"
  (default target) (1) ->

  (ClCompile target) -> 

    C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\Microsoft.Cpp.x64.Targets(146,5): error : Required file "" is missing. [C:\Users\Dan\Desktop\pclt\PCL\bin\CMakeFiles\CMakeTmp\cmTryCompileExec1400574213.vcxproj]



      0 Warning(s)
      1 Error(s)



  Time Elapsed 00:00:00.12





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


Configuring incomplete, errors occurred!
like image 425
DanChianucci Avatar asked Jan 14 '13 13:01

DanChianucci


People also ask

How do I use CMake code in Visual Studio?

Open the Command Palette (Ctrl+Shift+P) and run the CMake: Build command, or select the Build button from the Status bar. You can select which targets you'd like to build by selecting CMake: Set Build Target from the Command Palette. By default, CMake Tools builds all targets.

What is CMakeSettings JSON?

The CMakeSettings. json file contains information that Visual Studio uses for IntelliSense and to construct the command-line arguments that it passes to CMake for a specified configuration and compiler environment.


2 Answers

I found that my x64 compilers were destroyed by installing SP 1. Try this update to restore them :

http://www.microsoft.com/en-us/download/details.aspx?id=4422

like image 107
Dan Avatar answered Sep 20 '22 12:09

Dan


I had similar issues on Win7, and was getting the same error - The C compiler "cl.exe" is not able to compile a simple test program.

The solution that worked for me :

  1. On Windows Donot run cmake on the cygwin terminal.
  2. Run it from the command prompt, AND also ensure that you have admin rights, In windows 7 you can start command prompt as administrator by going to Start->All programs->Accessories-> (Right Click on Command Prompt) and Select "Run as administrator"

Then run cmake <your source> Worked like a charm for me.

like image 30
Dennis Mathews Avatar answered Sep 21 '22 12:09

Dennis Mathews