I am trying to include third-party libraries to my project and build with CMake.
The source to be built is main.cpppresent under /src.
My project directory is as follows -
|-src
|---main.cpp
|-third-party
|---ccalib_mdf
|-----include
|-----lib
|-------libccalib_mdf-2-2-1.so
|---dbcppp
|-----include
|-------dbcppp
|-------libxmlmm
|---------include
|-----lib
|-------libdbcppp.so
|-------libxmlmm.so
|-CMakeList.txt
I add my executable -
add_executable(mdf4_transcoder ${PROJECT_SOURCE_DIR}/main.cpp)
I include the directories -
include_directories(mdf4_transcoder PRIVATE "third-party/ccalib_mdf/include")
include_directories(mdf4_transcoder PRIVATE "third-party/dbcppp/include/dbcppp")
include_directories(mdf4_transcoder PRIVATE "third-party/dbcppp/include/libxmlmm/include")
And try to link the directories and libraries-
target_link_directories(mdf4_transcoder PRIVATE "third-party/ccalib_mdf/lib")
target_link_directories(mdf4_transcoder PRIVATE "third-party/dbcppp/lib")
target_link_libraries(mdf4_transcoder Pcap++ Packet++ Common++ pcap pthread)
target_link_libraries(mdf4_transcoder ${CMAKE_SOURCE_DIR}/third-party/ccalib_mdf/lib/libccalib_mdf_x64_2-2-1.so )
target_link_libraries(mdf4_transcoder ${CMAKE_SOURCE_DIR}/third-party/dbcppp/lib/libdbcppp.so )
target_link_libraries(mdf4_transcoder ${CMAKE_SOURCE_DIR}/third-party/dbcppp/lib/libxmlmm.so)
And I run the build process. However, this error is produced -
make[2]: *** No rule to make target '/usr/src/src/repair_service/transcoder/third-party/ccalib_mdf/lib/libccalib_mdf_x64_2-2-1.so', needed by 'mdf4_transcoder'. Stop.
As it is a library built outside the project, I am unable to find the reason behind this error to occur. I searched for solutions, but found none where this error for a shared library is discussed.
Note: This build process runs on cloud. I have no direct access to the environment.