Skip to content

CPM_<dep>_SOURCE does not load project #661

@Tetragramm

Description

@Tetragramm

This might be two bugs, or the problems could be related.

I have a project (call it MainLib) that is included in FinalProj by CPMAddPackage. MainLib uses CPMAddPackage to include multiple dependencies LibA, LibB, ect.

When I build FinalProj with CPM_MainLib_SOURCE set to a local copy of the source, the dependencies are not included.

First problem: FetchContent_Populate

CMake Warning (dev) at /usr/share/cmake-3.30/Modules/FetchContent.cmake:1953 (message):
[cmake]   Calling FetchContent_Populate(MainLib) is deprecated, call
[cmake]   FetchContent_MakeAvailable(MainLib) instead.  Policy CMP0169 can be set
[cmake]   to OLD to allow FetchContent_Populate(MainLib) to be called directly for
[cmake]   now, but the ability to call it with declared details will be removed
[cmake]   completely in a future version.
[cmake] Call Stack (most recent call first):
[cmake]   /home/me/Source/CPM_cache/cpm/CPM_0.40.8.cmake:1139 (FetchContent_Populate)
[cmake]   /home/me/Source/CPM_cache/cpm/CPM_0.40.8.cmake:917 (cpm_fetch_package)
[cmake]   /home/me/Source/CPM_cache/cpm/CPM_0.40.8.cmake:711 (CPMAddPackage)
[cmake]   /home/me/Source/FinalProj/CMakeLists.txt:19 (cpmaddpackage)
[cmake] This warning is for project developers.  Use -Wno-dev to suppress it.

Using cmake_policy(SET CMP0169 OLD) does not remove this error. set(CMAKE_POLICY_DEFAULT_CMP0169 OLD) does.

Once that is suppressed, it reports success.
[cmake] -- CPM: Adding package MainLib@ (~/Source/MainLib/)
But it does not log the inclusion of the dependencies the way it does when CPM_MainLib_SOURCE is not set.

That would look like

[cmake] -- CPM: MainLib: Adding package LibA@1.15.0 (v1.15.0 at /home/me/Source/CPM_cache/LibA/7251ead404dccd824789f8f3a13df2a6fb56440c/LibA)
[cmake] -- CPM: MainLib: Adding package LibB@1.0.3 (1.0.3 at /home/me/Source/CPM_cache/LibB/e91eb1dcff97b3aba7576745a2dcd030fdec5378/LibB)

Cmake version is 3.30.2
CPM version is 0.40.8

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