Mewen LE RESTE
Mewen LE RESTE

Reputation: 66

CMake compile with external library

I try to compile my code with an external library but every time I tried I've got an error. Here is my actual cmake linkage:

include(dependencies.cmake)
add_executable(${NAME} ${SOURCE_FILES})
target_link_libraries(${NAME} PUBLIC ${DEPENDENCIES})

And here is my dependencies.cmake:

set(LIB_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib)
find_library(MY_DEPENDENCIES NAMES myLib HINTS ${LIB_PATH} NO_DEFAULT_PATH)
set(DEPENDENCIES ${MY_DEPENDENCIES})

And here is my project tree:

Project
|----include
|----lib
|    |----libmyLib.so
|----release
|----src
|----CMakeLists.txt
|----dependencies.cmake

And I've got this error

make[4]: *** No rule to make target '../lib/libmyLib.so'

I precise that:

Anyone as a suggestion?

Upvotes: 0

Views: 249

Answers (1)

Mewen LE RESTE
Mewen LE RESTE

Reputation: 66

Ok so I find what causes the error, my external lib was a symbolic link and not the .so directly, I fix this and now it work

Upvotes: 2

Related Questions