0

I'm using cmake-3.16, and for other technical reason, I must use MODULE to make a shared lib(*.so) in Linux instead of using SHARED.

But with MODULE, cmake does NOT produce target file with name like "libDummy.so.x.x.x", and automatically create a symbolic link with name like "libDummy.so".

So I manually use OUTPUT_NAME_RELEASE to declare the target name as following:

add_library( Dummy MODULE Dummy.cpp )
set_target_properties( Dummy PROPERTIES
    PREFIX              ""
    SUFFIX              ""
    OUTPUT_NAME_RELEASE "Dummy.so.${PROJECT_VERSION}"
    OUTPUT_NAME_DEBUG   "Dummy.so.${PROJECT_VERSION}"
)
install( TARGETS Dummy LIBRARY DESTINATION somewhere )

But I don't know how to add a symbolic link for it. I found the cmake command:

file( CREATE_LINK "Origin.so.0.1.2" "Symlnk.so" RESULT act_res SYMBOLIC )

looks like doing my requirement. But I don't Known its syntax. I searched in cmake documents, there are very less comments about it.

How to refer the target name of the original Module in the command file( CREATE_LINK ),

and how to make the symbolic link with relative path,

and how to store the symblink into the same folder of the module?

Thx!

Leon
  • 1,489
  • 1
  • 12
  • 31
  • Can you explain more about why you "must" use `MODULE`? Normally this would happen automatically for a shared library if you set the `VERSION` and `SOVERSION` properties. – Alex Reinking Aug 09 '22 at 15:01
  • https://stackoverflow.com/questions/72850419/different-version-require-of-cmake-results-dlopen-undefined-symbol – Leon Aug 09 '22 at 15:12

0 Answers0