Generated CMakeLists.txt

All CMakeLists.txt generated by cmake-converter follow the same hierarchy. If you converted a solution, each converted directory with *proj file 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. Actually each section at generated scripts is separated with comment and can be read well.

Root of CMake tree

After conversion the root of CMake tree appears beside *.sln file. So, give the path of the root CMakeLists.txt to cmake to parse all converted tree. Root CMakeLists.txt contains info about:

1. Architectures used in solution.
2. Solution configutation names.
3. Windows SDK version used.
4. Sets cmake minimum required version.
5. Includes optional GlobalSettingsInclude.cmake
6. Adds all converted subdirectories with projects.

Top of file (project)

Creating of corresponding Visual Studio project with used languages.

Files & Targets

Files (source groups)

Converter will collect all your source files and add them to the corresponding target. The files will be added according source groups and sorted alphabetically.

IMPORTANT: names of source groups must be without special symbols (only CMake like variable). Spaces are accepted.

Library & Executable (target)

After script get all information, he create your library (STATIC or SHARED) or your executable. Also here may be used add_precompiled_header if PCH is turned on.

Property files (*.props)

Converter does not support translation of property. It addes links to correspondent files at the same location. Example: if we have following link at source xml:


You’ll get usage of similar cmake file that should be created manually:

use_props(${PROJECT_NAME} “${CMAKE_CONFIGURATION_TYPES}” “f1/f2/my-settings.cmake”)

In case of absence of cmake file CMake will throw warning:

Corresponding cmake file from props <cmake-file-name> doesn’t exist

Include directories

Adds include directories from corresponding visual studio project. Includes are PUBLIC by default. But you may use –private-include-directories to make them private and make your solution smarter.

Compile definitions

Adds compile definitions from corresponding visual studio project.


Dependencies are binaries you have set in “Additional Dependencies” of your *proj project, like shared or static libraries or references to other solution projects. add_dependencies command contains corresponding references. target_link_libraries command contains references that need to link and other external dependencies. target_link_directories may be used here as well.

Also cmake converter tries to read info about used NuGet packages and makes stubs for using it with use_package function.

Use CMake

CMake Converter try to take as much information as possible from your *proj 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:

# Go to CMake tree root (not necessary, may be relative):
cd path/to/Root/of/CMake/tree
# Generate the "Makefile"
cmake -S . -B build
# Launch compilation
cmake --build 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.