Skip to content

hiredis included through FetchContent should not include CPack #1306

@koenvandesande

Description

@koenvandesande

When you include hiredis through FetchContent, it causes a warning when the main project also uses CPack:

CMake Warning at /usr/local/lib/python3.12/dist-packages/cmake/data/share/cmake-3.31/Modules/CPack.cmake:510 (message):
  CPack.cmake has already been included!!
Call Stack (most recent call first):
  cmake-build-debug-wsl/_deps/hiredis/CMakeLists.txt:98 (include)

Could you prevent this by guarding the inclusion of CPack with a check on whether it is the top-level project?

if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
  include(CPack)
endif()

If needed I could turn this into a PR if that is easier for you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions