So I’m trying to add ddtrace package to nixpkgs package.
Generally this process is straight forward, but the package depends on libddwaf library. That library uses cmake to build, and that cmake also downloads other dependencies.
My problem is that I’m new to cmake, and I see that nixpkgs have some routines for handling it, but it is hard to find them when I don’t know what I’m looking for. Don’t know if that’s the case with cmake, but there are also packages that were created a while ago and might be do things wrong way etc.
I guess my question is, is there a good package that might be using cmake in similar way so I could use it as a guide?
Disclaimer: I’m not an expert in cmake, just packaged a couple of cmake-based packages.
Hello. I see two ways of dealing with this particular cmake build. If custom build of rapidjson with ExternalProject_Add is essential, you can patch this call to supply SOURCE_DIR with predownloaded sources thus skipping download step.
If custom build is not necessary, you can completely remove ExternalProject_Add call, and rewrite add_library(lib_rapidjson INTERFACE IMPORTED GLOBAL) so that it uses shared library instead. This shared library will come from nixpkgs using buildInputs attribute.
Relevant docs: https://cmake.org/cmake/help/latest/command/add_library.html#imported-libraries https://cmake.org/cmake/help/latest/module/ExternalProject.html#command:externalproject_add