Setting Up CMakePPLang for Development
This page contains information to help developers new to CMakePPLang set up the project to begin development.
Downloading the Source Code
During development, the latest version of CMakePPLang should be used. CMakePPLang is hosted on GitHub and can be cloned to your local system using Git:
git clone https://github.com/CMakePP/CMakePPLang.git
Building CMakePPLang
CMakePPLang is built on top of and extends the CMake language, so
“building” CMakePPLang is performed during CMake’s configuration step. Once
the CMakePPLang source code has been downloaded, navigate into the new
CMakePPLang
directory and run the following command to “build” CMakePPLang:
For *nix-based systems (including Mac OSX):
cmake -H. -Bbuild -DBUILD_TESTING=ON
For Windows systems:
cmake -S. -Bbuild -DBUILD_TESTING=ON
In these commands, -H
and -S
specify the top-level, root directory for
the project, called the “source directory” in CMake (not to be confused with a
“source code directory”, commonly also called the “source directory”). In this
case, we are assuming that the current directory, .
, is the root directory
of the CMakePPLang
repository. The directory where build artifacts will
appear is specified by -B
, meaning we are directing build artifacts to
CMakePPLang/build
. Finally, -DBUILD_TESTING=ON
enables unit testing on
CMakePPLang, which will be necessary for development. BUILD_TESTING
defaults to OFF
, so this argument can be excluded if testing is not needed.
Note
The build step usually required by projects using CMake is not required to build CMakePPLang itself, so it is not included in this section.
Running CMakePPLang Tests
Scripts to run the unit tests will be included in CMakePPLang/build
with
the rest of the build artifacts. These scripts are run using CMake’s test driver
program, CTest. Navigate into the CMakePPLang/build
directory and run
the following command to execute CMakePPLang’s tests:
ctest --output-on-failure
While ctest
can be run with no arguments as well, it is usually useful to
run it with --output-on-failure
, since it will provide all of the output
from a failing test program instead of simply saying the test failed. After
the first run of the tests, it is also useful to include --rerun-failed
to save time by skipping passing tests.
Note
To learn more about writing unit tests for CMakePPLang, see Unit Testing CMakePPLang Functions.