Category:CMake: Difference between revisions

m
(Most examples work with CMake 2.6 in process script mode.)
 
Line 4:
|hopl=no
|tags=cmake}}
[[Category:Utility]]
 
CMake is a cross-platform make system, for compiling [[C]], [[C++]] or [[Fortran]] programs. CMake uses a configuration file (CMakeLists.txt) to run configure tests, find libraries, create targets, and generate a build system for [[make|Unix make]] or another build tool. This configuration file runs commands in CMake's own scripting language.
CMake uses a configuration file (CMakeLists.txt) to run configure tests,
find libraries, create targets, and generate a build system for
[[make|Unix make]] or another build tool. <br>
This configuration file runs commands in CMake's own scripting language.
 
For Rosetta Code, most examples work with ''CMake 2.6'' or later in ''process script mode'' (<code>cmake -P myscript.cmake</code>). Many examples use features from 2.6, especially function(). In <code>cmake -P</code> mode, CMake runs the script but never creates a project. So there are no configure tests and no targets.
in ''process script mode'' (<code>cmake -P myscript.cmake</code>).
 
Many examples use features from 2.6, especially function().
 
In <code>cmake -P</code> mode, CMake runs the script but never creates a project.
So there are no configure tests and no targets.
 
==Simple project==
Line 74 ⟶ 85:
}</lang>
 
If the three files CMakeLists.txt, config.h.in and simpletime.c are in .., then <code>cmake ..</code> configures the project.
then <code>cmake ..</code> configures the project.
 
$ cmake ..
Anonymous user