Linking priority in cmake

Is there any way i can set a priority at linking some libs/classes in cmake?

I have a library BFciLib that i use in my class, and have added it in cmake like this

  target_link_libraries(Main PRIVATE BFciLib GL ${GTKMM_LIBRARIES})

I had to mock some of the methods of that lib so that i am able to develop on my pc (without having to connect my device for which the mentioned lib is used etc). So i have C wrapped those methods, and basically now i have 2 definitions of the same method.

I need to link my newly created methods to be used in MyClass, instead of the original ones(the ones of the lib) without modifying the class. But still use the library since are more other methods used. So i believe that is to be done in the cmake file.

For that i have added another executable, but i fail to see what more should i do:

 #new exe

    target_link_libraries(MainMock PRIVATE BFciLib GL ${GTKMM_LIBRARIES})

This still returns “duplicate definition” error.

How am i supposed to do?

You could try to use the C preprossor to do that.

#define function myfunction

It sounds like you want to do some more design to make it so that the implementation can be chosen separately from linking. virtual methods in C++ would help here.

thank you, i will look into that

i was wondering if there is another way, by using flags of priority in cmake

Not really. That kind of behavior might be available in some linkers, but is definitely not something universally available enough for a reliable CMake abstraction.

alright, thank you for your answer