Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cmake not finding Visual Studios 2012 in Generators list

I'm trying to run through the Firebreath tutorial, but I cannot get Cmake to work. Cmake does not register any version of Visual Studios under the Generators list. This is the list when running cmake --help:

Generators

The following generators are available on this platform:
  Unix Makefiles              = Generates standard UNIX makefiles.
  Ninja                       = Generates build.ninja files (experimental).
  CodeBlocks - Ninja          = Generates CodeBlocks project files.
  CodeBlocks - Unix Makefiles = Generates CodeBlocks project files.
  Eclipse CDT4 - Ninja        = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Unix Makefiles
                              = Generates Eclipse CDT 4.0 project files.
  KDevelop3                   = Generates KDevelop 3 project files.
  KDevelop3 - Unix Makefiles  = Generates KDevelop 3 project files.
  Sublime Text 2 - Ninja      = Generates Sublime Text 2 project files.
  Sublime Text 2 - Unix Makefiles
                              = Generates Sublime Text 2 project files.

I have re-installed CMake, installing Visual Studios 2010 and 2012 (Express and Professional editions), and even uninstalled and re-installed .NET 4.0 to 4.5 (from here). It works fine on my personal computer, as I got it running on the first go. However, my work laptop is just not registering Visual Studios.

I'm running it both on Windows 7 Enterprise SP1. Any help is appreciated.

Here is the exact error I am getting:

C:\code\tutorial2\TutorialTestPlugin>firebreath\prep2012.cmd . build
A subdirectory or file build already exists.
Using projects in: "C:\code\tutorial2\TutorialTestPlugin"
Generating build files in: "C:\code\tutorial2\TutorialTestPlugin\build"
NOTE: The build files in "C:\code\tutorial2\TutorialTestPlugin\build" should *NE
VER* be modified directly.
When needed, make project changes in cmake files and re-run this script.
  Project-specific cmake files are found in [plugin dir]\CMakeLists.txt and
  [plugin dir]\Win\projectDef.cmake.
Note that parameters for cmake should be enclosed in double quotes, e.g. "-DVERB
OSE=1"
CMAKE parameters:

C:\code\tutorial2\TutorialTestPlugin\build>cmake -G "Visual Studio 11" -DFB_PROJ
ECTS_DIR="C:\code\tutorial2\TutorialTestPlugin"  "C:\code\tutorial2\TutorialTest
Plugin\firebreath"
CMake Error: Could not create named generator Visual Studio 11
cygwin warning:
  MS-DOS style path detected: C:\code\tutorial2\TutorialTestPlugin\firebreath
  Preferred POSIX equivalent is: /cygdrive/c/code/tutorial2/TutorialTestPlugin/f
irebreath
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
like image 237
bunndan Avatar asked Nov 11 '13 19:11

bunndan


People also ask

Could not find any instance of Visual Studio in Cmake?

In general the key to solving this problem always seems to be reinstalling/modifying Visual Studio, which ends up repairing the environment so that cmake can find the Visual Studio instance.

How do I specify Cmake generator?

The cmake(1) command-line tool --help output lists available generators on the current platform. Use its -G option to specify the generator for a new build tree.

How do I change the generator in my Cmake GUI?

You can use the -G option (generator). Something like cmake -G"Eclipse CDT4 - Unix Makefiles" . Try cmake --help to see all the options available in your machine.


1 Answers

The problem is you are using the cmake that is included in cygwin instead of the windows version of cmake. It appears that the current cygwin version is compiled without the generators for Visual Studio while the windows version has these.

In your case a simple way to get windows to use the windows version of cmake is to uninstall the cygwin cmake since it does not appear that you need that anyways.

An alternate method would have been adjusting your system path so that c:\cygwin\bin is after C:\Program Files (x86)\CMake 2.8\bin.

like image 159
drescherjm Avatar answered Oct 17 '22 12:10

drescherjm