This guide covers how to integrate SingletonBase into your project's build system and build the library from source.
CMake Integration
Building from Source
Other Build Systems
To integrate SingletonBase into your CMake-based project:
# Add the SingletonBase directory to your project
add_subdirectory(path/to/SingletonBase)
# Link against the SingletonBase interface library
target_link_libraries(your_target PM::SingletonBase)This approach ensures proper include paths and namespace availability.
- CMake: Version 3.16 or higher must be installed on your system
- C++ Compiler: A C++17 compatible compiler (GCC 7+, Clang 5+, MSVC 2017+)
- Git: For cloning the repository
-
Clone Repository:
git clone https://github.com/your-org/SingletonBase.git cd SingletonBase -
Create Build Directory:
mkdir build cd build -
Configure with CMake:
cmake ..
-
Build the Project:
cmake --build .
After building the project, execute the test suite:
ctestThis runs all unit tests to verify the library functionality.
Since SingletonBase is header-only, integration with other build systems is straightforward:
- Include Path: Add the SingletonBase include directory to your compiler's include path
- Namespace Access: Ensure the
PMnamespace is available in your compilation units - No Linking Required: As a header-only library, no linking step is necessary
See also: Advanced Topics