hemplate

Simple XML template engine
git clone git://git.dimitrijedobrota.com/hemplate.git
Log | Files | Refs | README | LICENSE

BUILDING.md (2584B)


      1 # Building with CMake
      2 
      3 ## Build
      4 
      5 This project doesn't require any special command-line flags to build to keep
      6 things simple.
      7 
      8 Here are the steps for building in release mode with a single-configuration
      9 generator, like the Unix Makefiles one:
     10 
     11 ```sh
     12 cmake -S . -B build -D CMAKE_BUILD_TYPE=Release
     13 cmake --build build
     14 ```
     15 
     16 Here are the steps for building in release mode with a multi-configuration
     17 generator, like the Visual Studio ones:
     18 
     19 ```sh
     20 cmake -S . -B build
     21 cmake --build build --config Release
     22 ```
     23 
     24 ### Building with MSVC
     25 
     26 Note that MSVC by default is not standards compliant and you need to pass some
     27 flags to make it behave properly. See the `flags-msvc` preset in the
     28 [CMakePresets.json](CMakePresets.json) file for the flags and with what
     29 variable to provide them to CMake during configuration.
     30 
     31 ### Building on Apple Silicon
     32 
     33 CMake supports building on Apple Silicon properly since 3.20.1. Make sure you
     34 have the [latest version][1] installed.
     35 
     36 ## Install
     37 
     38 This project doesn't require any special command-line flags to install to keep
     39 things simple. As a prerequisite, the project has to be built with the above
     40 commands already.
     41 
     42 The below commands require at least CMake 3.15 to run, because that is the
     43 version in which [Install a Project][2] was added.
     44 
     45 Here is the command for installing the release mode artifacts with a
     46 single-configuration generator, like the Unix Makefiles one:
     47 
     48 ```sh
     49 cmake --install build
     50 ```
     51 
     52 Here is the command for installing the release mode artifacts with a
     53 multi-configuration generator, like the Visual Studio ones:
     54 
     55 ```sh
     56 cmake --install build --config Release
     57 ```
     58 
     59 ### CMake package
     60 
     61 This project exports a CMake package to be used with the [`find_package`][3]
     62 command of CMake:
     63 
     64 * Package name: `hemplate`
     65 * Target name: `hemplate::hemplate`
     66 
     67 Example usage:
     68 
     69 ```cmake
     70 find_package(hemplate REQUIRED)
     71 # Declare the imported target as a build requirement using PRIVATE, where
     72 # project_target is a target created in the consuming project
     73 target_link_libraries(
     74     project_target PRIVATE
     75     hemplate::hemplate
     76 )
     77 ```
     78 
     79 ### Note to packagers
     80 
     81 The `CMAKE_INSTALL_INCLUDEDIR` is set to a path other than just `include` if
     82 the project is configured as a top level project to avoid indirectly including
     83 other libraries when installed to a common prefix. Please review the
     84 [install-rules.cmake](cmake/install-rules.cmake) file for the full set of
     85 install rules.
     86 
     87 [1]: https://cmake.org/download/
     88 [2]: https://cmake.org/cmake/help/latest/manual/cmake.1.html#install-a-project
     89 [3]: https://cmake.org/cmake/help/latest/command/find_package.html