Installation ============ .. This file is auto-generated by scripts/generate_api_rst.py. This guide explains how to build and install the ``HTTPServer`` library on your system so you can use it in other projects. Installation Script ------------------- The project provides a dedicated script to handle the build and installation process: ``scripts/install_library.sh``. How to Use ~~~~~~~~~~ To install the library to the default location (usually ``/usr/local``), run: .. code-block:: bash ./scripts/install_library.sh Custom Installation Prefix ~~~~~~~~~~~~~~~~~~~~~~~~~~ If you wish to install the library to a specific directory, you can pass the path as an argument to the script: .. code-block:: bash ./scripts/install_library.sh /path/to/custom/location What the Script Does ~~~~~~~~~~~~~~~~~~~~ 1. **Build Configuration**: It creates a clean build directory (``build_install``) and configures the project using CMake in ``Release`` mode. 2. **Optimized Build**: It disables the build of tests and the example application (``BUILD_TESTING=OFF`` and ``BUILD_SERVER_APP=OFF``) to ensure a fast, library-only installation. 3. **Cross-platform Support**: It automatically detects the number of CPU cores to perform a parallel build. 4. **Sudo Handling**: If the installation prefix is not writable by the current user, it will automatically prompt for ``sudo`` to perform the installation. Using the Installed Library --------------------------- Once installed, you can use the library in your own C++ projects. CMake Integration ~~~~~~~~~~~~~~~~~ The library exports its targets, allowing you to use ``find_package()`` in your ``CMakeLists.txt``: .. code-block:: cmake find_package(HttpServer REQUIRED) add_executable(my_app main.cpp) target_link_libraries(my_app PRIVATE HttpServer::httpserver_lib) Including Headers ~~~~~~~~~~~~~~~~~ The easiest way to use the library is via the umbrella header: .. code-block:: cpp #include You can also include specific module headers if needed: .. code-block:: cpp #include #include // ... your code ...