Scripts

A Script Ain’t A Project

  • Main purpose: prototyping project work without a project

  • No cache (⟶ persistent variables)

  • No targets (after all, nothing is built)

  • No subdirectories (nothing is built in subdirectories either)

  • Invocation: cmake -P <script>

message("Hello CMake")
$ cmake -P hello.cmake
Hello CMake

Passing Commandline Parameters

  • -Dname=value - just like passing parameters into a project build

message("Hello ${PERSON}")
$ cmake -DPERSON="Joerg Faschingbauer" -P hello-person.cmake
Hello Joerg Faschingbauer