Cmake: Difference between revisions

From miki
Jump to navigation Jump to search
(Created page with "== Select toolchain == === On Windows === On Windows, cmake default to the latest Visual Studio version installed on the system. To select MinGW toolchain [https://stackoverfl...")
 
No edit summary
Line 4: Line 4:
<source lang="bash">
<source lang="bash">
cmake -G "MinGW Makefiles" .
cmake -G "MinGW Makefiles" .
</source>

== Tips ==
=== Print variables ===
<source lang="cmake">
# Using message
message(PROJECT_SOURCE_DIR="${PROJECT_SOURCE_DIR}")

# Using helper:
include(CMakePrintHelpers)
cmake_print_variables(PROJECT_SOURCE_DIR ANOTHER_VARIABLE
</source>
</source>

Revision as of 09:46, 13 June 2023

Select toolchain

On Windows

On Windows, cmake default to the latest Visual Studio version installed on the system. To select MinGW toolchain [1]:

cmake -G "MinGW Makefiles" .

Tips

Print variables

# Using message
message(PROJECT_SOURCE_DIR="${PROJECT_SOURCE_DIR}")

# Using helper:
include(CMakePrintHelpers)
cmake_print_variables(PROJECT_SOURCE_DIR ANOTHER_VARIABLE