Generated CMakeLists.txt

All CMakeLists.txt generated by cmake-converter follow the same hierarchy. If you converted a solution, each converted vcxproj will have its own file.

In order to facilitate their understanding, the generated files are organized by “section”. Here is a description for each of them.

Top of file

To keep track of the generation of the script and what it corresponds to, you will have in front of the file several information. Like the creation date, corresponding Visual Studio project, …


The first part of the file groups the variables generated for your project. They will be used throughout the file. Nothing prevents you from modifying them if something does not please you, but you will need to be careful with these changes.

You normally have:

  • ${PROJECT_NAME}: name of your project, corresponding to name in vcxproj.
  • ${OUTPUT_DEBUG}: define folder for Debug compilations.
  • ${OUTPUT_RELEASE}: define folder for Release compilations.

If your project have some dependencies, CMake-converter will try to set variables to corresponding folders.

CMake Project

After variables definitions, you’ll have the project itself and the default build type used (Release). You can override this by:


Note: CMake Converter only manage Debug or Release build type, because Visual Studio projects doesn’t manage other CMake build types (like RELWITHDEBINFO or MINSIZEREL).

Artefacts Output

If you’ve or not use -O parameter with CMake Converter, he try to define default output for your binaries produced during compilation. Each build type have a separate folder.


This part will vary depending on what you have pass as parameter to the converter.

  • If your Visual Studio project have include folders, --include parameter will tell to converter to add them here.
  • If you have pass --additional parameter to add code from a file, cmake-converter will add your code here.
  • Finally, the parameter --includecmake will include your file here.


Dependencies are other projects you have set in your vcxproj project, like shared or static libraries. You have an option call BUILD_DEPENDS who attempt to link with them.

By default this option is set to ON.

If ON, CMake tries to find corresponding CMakeLists.txt inside each dependency folder. CMake-converter will define variables to define the folders of your dependencies, which you can find at the top of the file. These folders can be override by the --dependencies parameter.

If OFF, he tries to link library (.so or .dll) in a folder call dependencies/libname/build. This folder can also be change if needed.

Files & Targets


Converter will also collect all your source files and add them to the corresponding target.

Library & Executable

After script get all information, he create your library (STATIC or SHARED) or your executable. If needed, he add dependencies too and link them.


The biggest part of the work done by CMake Converter. CMake-converter will add flags for each ${CMAKE_BUILD_TYPE}.


On Linux, flags are usually set properly but script add minimum to use. The only flag that will change will be the version of the standard library (c++11 by default) with the –std parameter.


Each xml tag will be scanned to find all the flags to pass to the compiler, by target_compile_options directive.

Use CMake

CMake Converter try to have the most informations as possible of your vcxproj file. However, it’s recommended to read and test the generated CMakeLists.txt before using it in production !

Once CMake Converter has generated a CMakeLists.txt file, to compile with CMake, type the following commands:

# It's better to create a dedicated folder:
mkdir build && cd build
# Generate the "Makefile"
cmake ../to/cmakelists/folder/
# Launch compilation
cmake --build .

You can also provide a specific Generator with -G "<GENERATOR_NAME>". Please refer to CMake Generator Documentation.

You can provide the build type by add -DCMAKE_BUILD_TYPE=<BUILD_TYPE>.

CMake provides a lot of other options that you can discover in their official documentation.