How to copy .so file from src to devel when catkin_make?
I have an external .so
library to link. If I put it only in src/lib/
and try to find_library()
it, the catkin_make
always fail. But if I manually put the .so
file in devel/lib/
, it works. Is there any way that I can automatically copy the .so
file from src/lib/
to devel/lib/
?
Here is a confusing thing. When I output the ${PROJECT_SOURCE_DIR}
, it is the src
folder, but when I use this address to find_library
, it will be directed to devel
folder. But I didn't put .so file in devel/lib/
.
My code in CMakeLists.txt:
message("PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}")
find_library(DYNAMSOFT_LIBRARY
NAMES libDynamsoftBarcodeReader.so
PATHS ${PROJECT_SOURCE_DIR}/lib/)
message("DYNAMSOFT_LIBRARY: ${DYNAMSOFT_LIBRARY}")
Corresponding output in terminal:
PROJECT_SOURCE_DIR: /home/zhiyang/mfp_workspace/src/srsnode_barcode_reader
DYNAMSOFT_LIBRARY: /home/zhiyang/mfp_workspace/devel/lib/libDynamsoftBarcodeReader.so