A set of helper functions to aid in applying Pitchfork (a set of C++ project conventions) for CMake.
Download the script from the Releases page and save it somewhere in your project's directory. The following commands do this for your, when run from the project's root directory.
POSIX Shell:
mkdir -p cmake
wget -O cmake/Pitchfork.cmake 'https://github.com/jessestricker/pitchfork/releases/download/v0.2.0/Pitchfork.cmake'
PowerShell:
mkdir -Force cmake
iwr -OutFile cmake/Pitchfork.cmake 'https://github.com/jessestricker/pitchfork/releases/download/v0.2.0/Pitchfork.cmake'
After downloading, include the script into your top-level CMakeLists.txt
.
To do that, put this line after the project(...)
command:
include(cmake/Pitchfork.cmake)
Project Layout:
<project-root>
CMakeLists.txt
src/
utils
utils.hpp
utils.cpp
utils.test.cpp
app.main.cpp
Contents of CMakeLists.txt
:
pf_add_library(utils)
pf_add_executable(app LIBS utils)
Reference:
...
Implementation notes: