Skip to content

chore: fix limonp's path#206

Merged
yanyiwu merged 1 commit intoyanyiwu:masterfrom
Freed-Wu:limonp
Jul 26, 2025
Merged

chore: fix limonp's path#206
yanyiwu merged 1 commit intoyanyiwu:masterfrom
Freed-Wu:limonp

Conversation

@Freed-Wu
Copy link
Contributor

No description provided.

@yanyiwu yanyiwu requested a review from Copilot July 26, 2025 00:38
Copy link

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 updates the CMake configuration to improve dependency management for the limonp library by adding support for both system-installed and local copies of the library.

  • Replaces hardcoded include directory path with dynamic detection of limonp library
  • Adds fallback mechanism to use local deps directory when system package is not found
  • Maintains backward compatibility with existing build setups

PROJECT(CPPJIEBA)

INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/deps/limonp/include
find_package(limonp)
Copy link

Copilot AI Jul 26, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider specifying QUIET to suppress warnings when the package is not found, since you have a fallback mechanism: find_package(limonp QUIET)

Suggested change
find_package(limonp)
find_package(limonp QUIET)

Copilot uses AI. Check for mistakes.
Comment on lines +4 to 11
find_package(limonp)
if(limonp_FOUND)
get_target_property(LIMONP_INCLUDE_DIR limonp::limonp INTERFACE_INCLUDE_DIRECTORIES)
else()
set(LIMONP_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/deps/limonp/include")
endif()
INCLUDE_DIRECTORIES("${LIMONP_INCLUDE_DIR}"
${PROJECT_SOURCE_DIR}/include)
Copy link

Copilot AI Jul 26, 2025

Choose a reason for hiding this comment

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

The get_target_property call may fail if the target doesn't have INTERFACE_INCLUDE_DIRECTORIES set, which would set LIMONP_INCLUDE_DIR to 'NOTFOUND'. Consider checking the result or using target_link_libraries instead of manually extracting include directories.

Suggested change
find_package(limonp)
if(limonp_FOUND)
get_target_property(LIMONP_INCLUDE_DIR limonp::limonp INTERFACE_INCLUDE_DIRECTORIES)
else()
set(LIMONP_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/deps/limonp/include")
endif()
INCLUDE_DIRECTORIES("${LIMONP_INCLUDE_DIR}"
${PROJECT_SOURCE_DIR}/include)
find_package(limonp REQUIRED)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include)
if(NOT TARGET cppjieba)
add_library(cppjieba INTERFACE)
target_include_directories(cppjieba INTERFACE
${PROJECT_SOURCE_DIR}/include
)
target_link_libraries(cppjieba INTERFACE limonp::limonp)
endif()

Copilot uses AI. Check for mistakes.
@yanyiwu yanyiwu merged commit 99124b1 into yanyiwu:master Jul 26, 2025
32 checks passed
@Freed-Wu Freed-Wu deleted the limonp branch July 26, 2025 03:40
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