Difference between revisions of "HPC:CMake"

From HPC wiki
Line 4: Line 4:
 
For full documentation visit the [https://cmake.org/ '''CMake Home Page'''] and the [https://cmake.org/documentation '''CMake Documentation Page''']. The [https://gitlab.kitware.com/cmake/community/-/wikis/home '''CMake Community Wiki'''] also references useful guides and recipes.
 
For full documentation visit the [https://cmake.org/ '''CMake Home Page'''] and the [https://cmake.org/documentation '''CMake Documentation Page''']. The [https://gitlab.kitware.com/cmake/community/-/wikis/home '''CMake Community Wiki'''] also references useful guides and recipes.
 
   
 
   
==== Usage ====
+
==== CMake module ====
 +
There are two types of CMake installations on our HPC system:
 +
- the system default versions
 +
AND
 +
- the versions made available as modules.
 +
 
 +
To check the versions of the default cmake and cmake3 packages run:
 +
 
 +
<pre>
 +
[asrini@node155 ~]$ which cmake
 +
/bin/cmake
 +
 
 +
[asrini@node155 ~]$ cmake --version
 +
cmake version 2.8.12.2
 +
 
 +
[asrini@node155 ~]$ which cmake3
 +
/bin/cmake3
 +
 
 +
[asrini@node155 ~]$ cmake3 --version
 +
cmake3 version 3.17.3
 +
 
 +
CMake suite maintained and supported by Kitware (kitware.com/cmake).
 +
 
 +
</pre>
 +
 
 +
If installing a specific software packages requires a version other than the default versions, then the appropriate CMake module needs to be enabled, before attempting the software installation (click "expand" to see basic module usage):
 +
 
 +
----
 +
<div class="mw-collapsible mw-collapsed">
 +
 
 +
<pre>
 +
[asrini@node155 ~]$ module show cmake/3.21.1
 +
-------------------------------------------------------------------
 +
/usr/share/Modules/modulefiles/cmake/3.21.1:
 +
 
 +
module-whatis CMake is a cross-platform, open-source build system generator.
 +
prepend-path PATH /opt/software/cmake/3.21.1/bin
 +
-------------------------------------------------------------------
 +
 
 +
</pre>
 +
 
 +
<pre>
 +
[asrini@node155 ~]$ module load cmake/3.21.1
 +
</pre>
 +
 
 +
<pre>
 +
[asrini@node155 ~]$ which cmake
 +
/opt/software/cmake/3.21.1/bin/cmake
 +
 
 +
[asrini@node155 ~]$ which cmake3
 +
/opt/software/cmake/3.21.1/bin/cmake3
 +
 
 +
[asrini@node155 ~]$ cmake --version
 +
cmake version 3.21.1
 +
 
 +
CMake suite maintained and supported by Kitware (kitware.com/cmake).
 +
 
 +
[asrini@node155 ~]$ cmake3 --version
 +
cmake version 3.21.1
 +
 
 +
CMake suite maintained and supported by Kitware (kitware.com/cmake).
 +
 
 +
[asrini@node155 ~]$ cmake
 +
Usage
 +
 
 +
  cmake [options] <path-to-source>
 +
  cmake [options] <path-to-existing-build>
 +
  cmake [options] -S <path-to-source> -B <path-to-build>
 +
 
 +
Specify a source directory to (re-)generate a build system for it in the
 +
current working directory.  Specify an existing build directory to
 +
re-generate its build system.
 +
 
 +
Run 'cmake --help' for more information.
 +
 
 +
</pre>

Revision as of 13:30, 24 August 2021

CMake

CMake is a cross-platform, open-source build system generator.

For full documentation visit the CMake Home Page and the CMake Documentation Page. The CMake Community Wiki also references useful guides and recipes.

CMake module

There are two types of CMake installations on our HPC system: - the system default versions AND - the versions made available as modules.

To check the versions of the default cmake and cmake3 packages run:

[asrini@node155 ~]$ which cmake
/bin/cmake

[asrini@node155 ~]$ cmake --version
cmake version 2.8.12.2

[asrini@node155 ~]$ which cmake3
/bin/cmake3

[asrini@node155 ~]$ cmake3 --version
cmake3 version 3.17.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).

If installing a specific software packages requires a version other than the default versions, then the appropriate CMake module needs to be enabled, before attempting the software installation (click "expand" to see basic module usage):


[asrini@node155 ~]$ module show cmake/3.21.1 
-------------------------------------------------------------------
/usr/share/Modules/modulefiles/cmake/3.21.1:

module-whatis	 CMake is a cross-platform, open-source build system generator. 
prepend-path	 PATH /opt/software/cmake/3.21.1/bin 
-------------------------------------------------------------------

[asrini@node155 ~]$ module load cmake/3.21.1 
[asrini@node155 ~]$ which cmake
/opt/software/cmake/3.21.1/bin/cmake

[asrini@node155 ~]$ which cmake3
/opt/software/cmake/3.21.1/bin/cmake3

[asrini@node155 ~]$ cmake --version
cmake version 3.21.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

[asrini@node155 ~]$ cmake3 --version
cmake version 3.21.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

[asrini@node155 ~]$ cmake
Usage

  cmake [options] <path-to-source>
  cmake [options] <path-to-existing-build>
  cmake [options] -S <path-to-source> -B <path-to-build>

Specify a source directory to (re-)generate a build system for it in the
current working directory.  Specify an existing build directory to
re-generate its build system.

Run 'cmake --help' for more information.