cmake: create a dummy file for Xcode - #4439
Conversation
Otherwise Xcode will happily not-link our git2 target, resulting in a "missing file" error when building eg. examples
| # when using only object libraries. | ||
| FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.c "") | ||
| LIST(APPEND LIBGIT2_OBJECTS ${CMAKE_CURRENT_BINARY_DIR}/dummy.c) | ||
| ENDIF() |
There was a problem hiding this comment.
You're only doing this after already exporting LIBGIT2_OBJECTS into the parent scope. So I guess all callers of this CMakeLists.txt file will not get that dummy file. Is this intended?
There was a problem hiding this comment.
I'm not sure what is achieved by those PARENT_SCOPE, is it so that clar can static-link against the whole library code ?
AFAICT, this makes the dummy file appear, it shouldn't impact anything other than the Xcode generator, and if my point above is true then I don't think it matters because libgit2_clar is an executable, and it has .c files of its own (which sidesteps the underlying Xcode issue).
If you're concerned, I can move the block just above those SET lines.
There was a problem hiding this comment.
Yeah, exactly. We do not want to link against the .so or .a file but instead to the object files directly such that we can use some internal functions.
I think your reasoning makes sense, so it should be a non-issue. Thanks.
|
Thanks for the workaround! |
|
Sorry for the missed fix : since I was originally prodding Xcode, and CMake didn't actually cleanup the expected dylib, it appeared to work when I tested the first time. |
Otherwise Xcode will happily not-link our git2 target, resulting in a "missing file" error when building eg. examples