I’m working on a project, with CMake, that uses mainly two different libraries:
- ROOT: https://root.cern/
- OpenCASCADE: https://dev.opencascade.org/
When I try compiling I get errors of ambiguity. Basically both the libraries have the same Printf
function (and possibly others). Gladly the libraries are not called in the same scripts, and I could therefore isolate one from the other.
I tried reading a lot before asking here, and some of the solutions I found consist of editing one of the libraries by changing the function name, but I’m afraid of going in that direction and messing up with the library. Furthermore, the functions that are ambiguous are base libraries, and I cannot call one of them by e.g. ROOT::TString::Printf
or using typedef
.
So I thought of a couple of different approaches:
- Compile separately as completely different projects, and call the executable of one of the subprojects from the other by means of
std::system("./executable");
– I find this cumbersome, as I think I’d maybe need a bash macro to compile everything separately; - Edit my
CMakeLists.txt
to call the libraries separately;
For the latter case, I’ve read a lot about it, but it’s definitely not clear to me how to set this up. I know that there are options such option
and set
in order to do so, but can’t seem to make it right.
Which approach should I take, and if it’s the latter, how to do it?
8