This repository contains CMake scripts I use in my projects to manage build options, preferences, properties, and utilities for a CMake-based project.
Go to file
2024-05-16 19:18:22 -04:00
BuildOptions.cmake Improve naming, update license in headers 2024-05-16 19:14:41 -04:00
BuildProperties.cmake Improve naming, update license in headers 2024-05-16 19:14:41 -04:00
CPM.cmake Initial commit; standardizing these scripts from various projects 2024-05-16 18:56:21 -04:00
DefaultConfig.cmake Add missing paranetheses 2024-05-16 19:18:22 -04:00
LICENSE Initial commit; standardizing these scripts from various projects 2024-05-16 18:56:21 -04:00
README.md Improve naming, update license in headers 2024-05-16 19:14:41 -04:00
Util.cmake Improve naming, update license in headers 2024-05-16 19:14:41 -04:00

CmakeTools

License CMake

Overview

This repository contains CMake scripts I use in my projects to manage build options, preferences, properties, and utilities for a CMake-based project.

The main scripts included are:

  • BuildOptions.cmake
  • Util.cmake

Additional third-party scripts included are:

  • GitHub MIT

A convenience .cmake file with some default behavior is also included:

  • DefaultConfig.cmake
    • Contains some sane defaults to reduce repetitive typing

Getting Started

Prerequisites

  • CMake 3.26.0 or above. Might work with lesser verisons, but not tested.

Setup

  1. Create a project repository and a directory to contain these scripts. (e.g CMake)
  2.  $ git submodule add ${REPO_URL} CMake # You can use any directory name you wish
    

Usage

  1. Create your CMakeLists.txt

  2. Add this at the top:

    # CMakeLists.txt
    cmake_minimum_required(VERSION 3.26)
    
    include(CMake/Util)
    git_setup_submodules()
    
    include(CMake/BuildPreferences)
    iunclude(Cmake/BuildOptions)
    
    prevent_in_source_build()
    disable_deprecated_features()
    
    ## or 
    # include(CMake/DefaultConfig)
    
    project(MyProject)
    

License

The .cmake scripts in this repository are disstributed under the Unlicense - see the LICENSE file for details.

The included CPM.cmake module is © Lars Melchior and contributors, and is distributed under the MIT License - see the LICENSE file for details.