Skip to content

Conversation

@gsegon
Copy link
Contributor

@gsegon gsegon commented Nov 7, 2025

This PR enhances installation and packing of the library.

  1. The installation installs the mathtoolbox target with:
  • {CMAKE_INSTALL_PREFIX}/include/mathtoolbox/*.hpp
  • {CMAKE_INSTALL_PREFIX}/lib/libmathtoolbox.a
  • {CMAKE_INSTALL_PREFIX}/lib/cmake/MathToolboxConfig.cmake
  • {CMAKE_INSTALL_PREFIX}/lib/cmake/MathToolboxConfigVersion.cmake
  • {CMAKE_INSTALL_PREFIX}/lib/cmake/MathToolboxTargets.cmake
  • {CMAKE_INSTALL_PREFIX}/lib/cmake/MathToolboxTargets-release.cmake (or MathToolboxTargets-debug.cmake for Debug build)

CMake install config is modified such that a dependent cmake project (user project) can find and link mathtoolbox via find_package, for example:

cmake_minimum_required(VERSION 4.0)
project(SomeApp)

set(CMAKE_CXX_STANDARD 20)

find_package(MathToolbox REQUIRED)

add_executable(some_app main.cpp)
target_link_libraries(some_app PUBLIC MathToolbox::mathtoolbox)

target_include_directories(some_app PUBLIC .)

If the library is not found CMake will automatically cache an empty MathToolbox_DIR and the user is expected to provide the path to library install destination cmake directory. Conventionally, this is <install_dir>/lib/cmake.

  1. CMake packaging config is setup and enabled. For example, calling
cmake --build build --target package

will package the installation in a number of default formats, namely: MathToolbox-0.3.1-Linux.sh, MathToolbox-0.3.1-Linux.tar.gz, MathToolbox-0.3.1-Linux.tar.Z. See CPack for more options.

- Set project version to `0.3.1` and specify `LANGUAGES CXX`.
- Add proper include paths for build and install interfaces.
- Implement installation targets and export configuration for CMake integration.
- Introduce `MathToolboxConfig.cmake` template for package support.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant