Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 9, 2025

Updates minimum CMake version from 3.6 to 3.15, eliminating deprecation warnings and applying modern CMake best practices.

Core Changes

  • Bump cmake_minimum_required(VERSION 3.15) in root CMakeLists.txt
  • Add CMAKE_CXX_STANDARD_REQUIRED ON and CMAKE_CXX_EXTENSIONS OFF for enforced C++14 compliance and portability

Package Export Fixes

  • Fix NAMESPACE from libcanon to libcanon:: for proper CMake target naming convention
  • Correct include path generator expressions:
    # Before: pointed to libcanon subdirectory
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/libcanon>
    $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/libcanon>
    
    # After: points to include directory root
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
    $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>

Test Configuration

  • Modernize test builds to use target-based linking: target_link_libraries(test PRIVATE headers gtest gtest_main)
  • Remove manual include directory management in favor of transitive dependencies

Downstream Usage

find_package(libcanon REQUIRED)
target_link_libraries(myapp PRIVATE libcanon::headers)
Original prompt

Update the minimum cmake version to 3.15 and double check whether everything works. Suggest improvements as you see fit.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: chenpeizhi <8114085+chenpeizhi@users.noreply.github.com>
Copilot AI changed the title [WIP] Update minimum cmake version to 3.15 and validate functionality Update CMake minimum version to 3.15 and fix package configuration Nov 9, 2025
Copilot AI requested a review from chenpeizhi November 9, 2025 19:00
Copy link
Contributor

@chenpeizhi chenpeizhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but we may need to test Drudge after this commit.

@chenpeizhi chenpeizhi marked this pull request as ready for review November 9, 2025 22:17
Copilot AI review requested due to automatic review settings November 9, 2025 22:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR modernizes the CMake build system for the libcanon project by updating CMake requirements, simplifying test configuration, and improving package export conventions.

  • Bumps minimum CMake version from 3.6 to 3.15
  • Simplifies include directory management by leveraging the headers INTERFACE target
  • Adds CMake namespace convention (libcanon::) to exported targets

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
CMakeLists.txt Updates CMake minimum version to 3.15, enforces C++ standard requirements, adds namespace to export targets, and fixes typo in comment
include/CMakeLists.txt Simplifies include directory paths by removing redundant /libcanon suffix and corrects comment typo
test/CMakeLists.txt Refactors test configuration to use the headers target directly instead of manual include directory specification

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@chenpeizhi chenpeizhi merged commit 6785c39 into master Nov 9, 2025
8 checks passed
@chenpeizhi chenpeizhi deleted the copilot/update-cmake-version-3-15 branch November 9, 2025 22:20
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.

2 participants