Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 31, 2026

Modernize CMake setup to support find_package(SciTokens) for downstream projects. Addresses request from xrootd integration discussion.

Changes

CMake Package Configuration

  • Add SciTokensConfig.cmake.in template with automatic dependency resolution
  • Generate SciTokensConfigVersion.cmake with SameMajorVersion compatibility
  • Export SciTokens::SciTokens namespaced target via SciTokensTargets.cmake
  • Install config files to ${CMAKE_INSTALL_LIBDIR}/cmake/SciTokens/

CMakeLists.txt Updates

  • Update project VERSION to 1.3.0 (sync with RPM spec)
  • Add SciTokens::SciTokens ALIAS target for in-tree usage
  • Implement generator expressions for build/install interface separation
  • Use CMakePackageConfigHelpers for config file generation

RPM Packaging

  • Add %{_libdir}/cmake/SciTokens/ to -devel package

Usage

Downstream projects can now use modern CMake patterns:

# Old approach (still works)
find_package(PkgConfig REQUIRED)
pkg_check_modules(SCITOKENS scitokens)
target_link_libraries(app ${SCITOKENS_LIBRARIES})

# New approach - automatic dependency propagation
find_package(SciTokens 1.3.0 REQUIRED)
target_link_libraries(app PRIVATE SciTokens::SciTokens)

The namespaced target automatically handles include directories, C++11 requirements, and transitive dependencies (OpenSSL, CURL, SQLite3, UUID).

Version Management

Version is defined once in project(scitokens-cpp VERSION 1.3.0) and automatically exported to version file via write_basic_package_version_file(). No manual version file maintenance required.

Backward Compatibility

All existing installation paths, headers, and library names unchanged. Legacy variables (SCITOKENS_LIBRARIES, SCITOKENS_INCLUDE_DIRS) still defined for compatibility. No breaking changes.

Original prompt

This section details on the original issue you should resolve

<issue_title>Modern CMake for scitokens-cpp</issue_title>
<issue_description>As suggested by @amadio in a discussion on the xrootd GitHub tracker (see xrootd/xrootd#2453), it'd be useful to modernize the CMake setup for scitokens-cpp. Items that come to mind:

  • Installing CMake definitions from scitokens-cpp as part of the RPM install.
  • Exporting build targets to make building and linking against scitokens-cpp easier.
  • Exporting a version number for CMake.

@amadio, I roughly know how to do the first two items. Any suggestion on the best way to accomplish the third? When I've done things like that in the past, they've ended up poorly as we always seem to forget to update the code before tagging (it relied on humans to get the versioning correct and humans are poor at process).</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: bbockelm <1093447+bbockelm@users.noreply.github.com>
Copilot AI and others added 3 commits January 31, 2026 14:58
Co-authored-by: bbockelm <1093447+bbockelm@users.noreply.github.com>
Co-authored-by: bbockelm <1093447+bbockelm@users.noreply.github.com>
Co-authored-by: bbockelm <1093447+bbockelm@users.noreply.github.com>
Copilot AI changed the title [WIP] Modernize CMake setup for scitokens-cpp Add modern CMake package configuration with target exports Jan 31, 2026
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.

Modern CMake for scitokens-cpp

2 participants