Replies: 1 comment 3 replies
-
I have no experience with hooking in a sub-CMake project. My experience with CMake is limited, not all good... As this probably requires CMake specific knowledge, my suggestion would be to get some general advice on the matter from a CMake forum, or even StackOverflow, first. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi! I'm considering Cgreen as the unit testing framework for a few C projects, but I'd very much prefer to not install it as a system-wide library. In this case I'd need to install and maintain project-specific versions of it in every developer machine, CI build agent, etc. Since this is a small and self-contained library, I'm looking to add it as a git submodule into every project which needs it; then just build and link it as a local library (static or shared, doesn't matter) when building the unit test executable.
I'm struggling with the relevant top-level CMakeLists.txt (my CMake skills are quite weak). Does anyone have a practical example of how to pull Cgreen into CMakeLists.txt without a system-wide installation? E.g. maybe something like this (assuming the Cgreen source code is in a directory "unittest_source/cmake"), but actually working?
This doesn't actually build Cgreen when building the unit test executable. If I go and manually trigger a build of Cgreen, the main executable still fails to link
-lcgreen
.Update Arrived at this as a working solution:
Beta Was this translation helpful? Give feedback.
All reactions