For example, I have libprofiler.so
file. How can I get name of this shared object like this:
getname /usr/lib/libprofiler.so
I want to do it because it is required for CMakeLists.txt
in
target_link_libraries(MyProject name_of_library)
For example, I have libprofiler.so
file. How can I get name of this shared object like this:
getname /usr/lib/libprofiler.so
I want to do it because it is required for CMakeLists.txt
in
target_link_libraries(MyProject name_of_library)
Do the following steps to link an existing lib to your target:
libprofiler.so
.In your CMakeLists.txt:
The code above tries to find a lib and checks the following name profiler,
libprofiler.so
andlibprofiler.so.V123
. If found, the variableLIB_PROFILER
points to the lib file. Use the variable as one of the files linked to your target.In your code, you also missed the
${}
around the variable.