CMake Addressing

From GnuCash
Revision as of 09:36, 1 May 2018 by DaveC49 (talk | contribs) (In Progress Cmak target file addressing from build directory examples)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The cmake command sytax most relevant for building Gnucash is

cmake [<options>] <path-to-source>

More detailed information on CMake can be obtained from the | Cmake documentation.

The <options> switches relevant to building GnuCash are given in build options. As well other cmake switches are discussed in the above documentation, but are not generally needed to build GnuCash.

CMake does not allow in source builds, where the compiled files are built within the source tree structure, for projects building using CMake. It requires a separate build directory in which files generated by the build are placed. CMake generates files for the autotools make program (and other build systems e.g. Ninja). This simplifies rebuilding as the contents of the build directory can simply be deleted and rebuilt and the contents of the source directory are not altered in the cmake and build process.

The build directory can be located as desired within the users directory structure and there are no restrictions on the directory name. Only the build directory needs to be retained if you subsequently want to uninstall the version of GnuCash you have built using the make uninstall command as the install_manifest.txt file used to uninstall Gnucash is located within the build directory. For this reason it is probably wise to label the build directory with the application name and version if you place the build directory outside the source directory structure. E.g. "build-gnucash-3.x" to distinguish it from other applications built with CMake.

If you as a practice retain the sources of applications you build on your system, then you could locate the build directory within the top level source directory. If you download the tarball this will have a name like "gnucash-3.x". If you use git clone to obtain the sources from the GNuCash page on githubthe top level source directory will be named "gnucash". Another gnucash directory also exists under this top level directory named "gnucash-3.x" or "gnucash" - be careful do not use this as the top level directory in any of the following. (Note: x is one of {0, 1, 2,...}, i.e. the minor version number.)

The <path-to-source>, i.e. to the "gnucash-3.x" or "gnucash" top level directory in the cmake command can be either:

  • an absolute path to this directory; or it may be
  • a relative path from the build directory to the "gnucash-3.0" or "gnucash" directory.


                         $HOME                                                               $HOME
                           |                                                                   |
      -------------------------------------------------...                                     |
      |                                        |                                        ApplicationBuilds  
  Downloads                                  ApplicationBuilds                                 |
      |                                        |                                          
  gnucash-3.x                                build-gnucash-3.x