Open rlorigro opened 1 year ago
In addition to this, I've noticed that the headers are not installed to the installation destination, which is usually convenient for linking. Would it be possible to add a step to your CMake along these lines:
install(FILES ${headers} DESTINATION include/cuttlefish)
Thanks @rlorigro — I'll tag @jamshed here but I'm sure he'll see it anyway. In the first case, I think we haven't tested including cuttlefish with FetchContent
, but I think the fix should hopefully not be difficult.
In the second case, we don't install headers by default since (at least until this point) the primary user usecase has been to use cuttlefish as a standalone program rather than to interact with it programmatically as a library (apart from our own use in pisecm
). However, it should be straightforward to also install the relevant files necessary to use cuttlefish
as a library.
Nice, thanks for the quick reply. I've managed to fix the patch step error with this (admittedly hacky) solution:
add_custom_command(
TARGET BUILD_CUTTLEFISH POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CUTTLEFISH_DIR}/patches/kmc_patch.diff
${CMAKE_SOURCE_DIR}/patches/kmc_patch.diff)
It just copies the diff file into the place where it was looking for it
But now I'm getting a new error relating to finding the KMC headers. Haven't been able to fix it by including the directories manually
[ 55%] Building CXX object _deps/project_cuttlefish-build/src/CMakeFiles/cfcore_static.dir/kmc_api/kmc_file.cpp.o
/home/ryan/code/test_dbg/build/_deps/project_cuttlefish-src/src/kmc_api/kmc_file.cpp:12:10: fatal error: kmc_api/stdafx.h: No such file or directory
12 | #include "kmc_api/stdafx.h"
| ^~~~~~~~~~~~~~~~~~
I suspect a lot of this is a result of my brute force method for linking, so If you have any recommendations for how to make this simpler, please let me know :)
Hi,
I'm attempting to link your library with a combination of
FetchContent
andadd_custom_target
. Everything installs great, but when I link KMC (the one built by your CMakeLists) in order to satisfy your dependencies, I get this error during the build step:and I've noticed there is a relevant line in your CMake, which might explain this strange error: https://github.com/COMBINE-lab/cuttlefish/blob/30eef21275579e03efad81672e4198595bcb8dce/CMakeLists.txt#L190
I'm not familiar enough with CMake to understand this. Is there something I can do to work around it?
Here is my implementation: