Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cmake and visual studio

Tags:

cmake

gcc 4.4.2 / Visual Studio C++ 2008

I have been using cmake on linux, without any problems.

Now I have ported by application to run on windows.

I generated the solution files using cmake -G "Visual Studio 9 2008 ../src"

However, I know that cmake only creates a Makefile that is used by the compiler to build your application.

I open my solution in Visual Studio, I press the F7 key to compile.

I am wondering does it actually use the Makefile that was generated by cmake? Or it is just compiling the application like any normal visual studio program?

Many thanks for any advice,

like image 882
ant2009 Avatar asked Mar 13 '10 06:03

ant2009


People also ask

Does CMake work with Visual Studio?

Visual Studio uses a CMake configuration file to drive CMake generation and build. CMakePresets. json is supported by Visual Studio 2019 version 16.10 or later and is the recommended CMake configuration file.

Can you use CMake with Visual Studio Code?

The latest version of CMake tools is now available for download in the VS Code Marketplace or using the . vsix file. We have been working hard on improving the CMake experience and are excited to share some new features and improvements for users starting in version 1.11.

Is CMake better than Visual Studio?

CMake is a better build system than Visual Studio projects and solutions. It is compact and much more easier to maintain even for Windows only projects. See CMake for Visual Studio Developers for some reasons.

How do I open a CMake project in Visual Studio?

On the Visual Studio main menu, choose File > Open > CMake. Navigate to the CMakeLists. txt file in the root of the bullet3 repo you just downloaded. As soon as you open the folder, your folder structure becomes visible in the Solution Explorer.


2 Answers

Cmake generates a Visual Studio Solution and Project file.

The solution contains at least three projects:

  • ALL_BUILD
  • YourProject
  • ZERO_CHECK

The solution is set up so that when you build your project (by build solution, or build project) "YourProject" will be built and then ZERO_CHECK will be built, causing cmake to run and check if anything has changed. If anything has changed, the solution and project file will be regenerated and Visual Studio will ask if you would like to reload.

The compilation of your program is done by Visual Studio, as it would if you set it up manually, but Visual Studio will run cmake, and thus check if anything has changed, and the project files should be regenerated.

like image 82
Kleist Avatar answered Nov 16 '22 04:11

Kleist


CMake generates "real" .vcproj files, so Visual Studio will build your project like any normal Visual Studio project. There are no makefiles involved.

like image 35
JesperE Avatar answered Nov 16 '22 04:11

JesperE