Replies: 4 comments 11 replies
-
The first idea I had, can already be done by adding something like: # Helper code to keep CppUTest in the package lock
if (DEFINED CPM_DECLARATION_CppUTest)
cpm_add_to_package_lock(CppUTest ${CPM_DECLARATION_CppUTest})
endif() |
Beta Was this translation helpful? Give feedback.
-
On a related note, I think some kind of sorting should probably be applied when Since this file should be in version control, it should preferably only change if it actual gets different information in it. |
Beta Was this translation helpful? Give feedback.
-
Yeah that's a good point. Without giving it too much thought I think that adding something like a |
Beta Was this translation helpful? Give feedback.
-
The proposed solutions would only work if all packages are listed in a central But packages are listed in multiple CMakeLists files. My root can have code like: if(BUILD_SERVER)
add_subdirectory(server)
endif()
if(BUILD_CLIENT)
add_subdirectory(client)
endif() In such case the dependencies of the client won't even be mentioned, if only Thinking about all edge cases and different scenarios I'm even inclined to propose ditching package-lock altogether. Has anyone made a good use of it? |
Beta Was this translation helpful? Give feedback.
-
Currently working on integrating CPM.cmake in one of our projects.
Although I don't really need the
package-lock.cmake
for development (yet), it would be useful as a key for the GitLab CI cache.Unfortunately, one of the things I've noticed, is that packages for which
CPMAddPackage
is no longer called, get removed from the file.On one hand this makes sense, how else would you clean up the file.
On the other hand, there's conditional dependencies in our projects. When the project is build for the host, the test framework is included (via
CPMFindPackage
). When the project is build for an embedded target (i.e. ARM Cortex M33), it is not included as the tests can not be ran on that specific target (or at least, we do not have an interface to retrieve the results, so it would not make sense).I thought about including a unique ID for the different environments to the
package-lock.cmake
filename (i.e.CPMUsePackageLock(package-lock.${CMAKE_SYSTEM}.cmake)
), but then we would just end up with multiple files that should largely have the same dependencies in there. I think this would cause unwanted duplication and might make it harder to maintain.I'm not yet sure what the right solution would be, but some ideas came to mind that might be feasible:
NAME
, as otherwise the version information would have to be duplicated)CPMFindPackage
orCPMAddPackage
Of course, if there is already a known way of dealing with this, I'd love to hear about that.
Beta Was this translation helpful? Give feedback.
All reactions