Problem with .so linking

My application building with .so file is failing in the linking stage. When I make the file name as MySecond_digital.so it is reporting not able to find the file and when I am naming it libMySecond_digital.so all the calls used in my application defined in the .so is reporting undefined reference. Pl. see if any of you can help me. I am struggling with it for quite a few days.

How are the link lines that cannot find MySecond_digital.so being told to find it?

As for the undefined references, can you show what compilation flags are being used on one of its sources?

Undefined refrence with libMyDigital.so is solved. It was a coding issue. MyDigital.so linking is required to be seen further.

Sorry I was away from my workstation and hence could not response you properly.
The code in CMakeLists.txt for linking library was as below

find_library(MyLib NAMES MySecond_digital.so PATHS /home/skgoswami/Desktop/MySecond.digital/MySecond.digital/binaries/linux64)
message(${MyLib})
target_link_libraries(MyFMI ${MyLib})

This was not able to locate the .so file despite path copied was perfect. I was advised by one colleague to append ‘lib’ to the .so file name, as gcc linker expects the same for .so. Though it was an unexpected solution but it worked after correcting the main calls defined in .so files. It was a black box FMU and hence I was not fully aware of the calls.
If you have any further observations pl. share.

NAMES might want to be just MySecond_digital here as the search knows to append the “normal” suffix. You can use --debug-find to get CMake to output information about its searches; that should help figure out why it doesn’t find the file.

I am in learning phase over cmake and surely will try your debug command. However now my application is getting built without ‘lib’ appending i.e. with MySecond_digital.so. Things are unexplainable why so. I was somehow not convinced with my colleague’s suggestion but it worked and was failing with my code. If code correction was the reason but then why it was reporting not able to find MySecond_digital.so, so many doubts. Probably I will have to go back in reverse order to recreate. Let me see if I can and report you back. Thanks for your time trying to help me.