-2

I am trying to implement fthe fineftp-server library into an cmake-project. I compiled fineftp-server and got my fineftp-serverd.lib-file. I tried to includ it with

link_directories(${3RDPARTY_DIR}/fineftp-server)
target_link_libraries(myproject_object_lib PUBLIC fineftp)

I get no error, but when I try to use or include the classes of the lib, they are not found. I am new to this, perhaps someone can give me a hint.

Sven
  • 55
  • 1
  • 9
  • 1
    "when I try to use or include the classes of the lib, they are not found." - You need to be **more detailed**. What exactly have you tried (C++ code)? What exact error have you got? Your question should include [mcve]. – Tsyvarev Aug 16 '23 at 14:37
  • Agreed, you didn't give us enough information to help understand the problem. – drescherjm Aug 16 '23 at 14:55

1 Answers1

1

Since I don't know your concrete directory structure I can only give you a rather generic answer.

In your CMakeLists.txt file you need to use the target_include_directories() command. You can find the documentation of this command here (https://cmake.org/cmake/help/latest/command/target_include_directories.html) also I can recommend you the cmake-good series (https://www.youtube.com/watch?v=_yFPO1ofyF0&list=PLK6MXr8gasrGmIiSuVQXpfFuE1uPT615s), if you want to learn more about CMake.

Here is an example of what your CMakeLists.txt file should probably look like:

cmake_minimum_required(VERSION 3.25.0)

project(myproject)

add_library(
    myproject_object_lib
    //...
)

target_include_directories(myproject_object_lib PUBLIC ${3RDPARTY_DIR})

Here you can find a post on StackOverflow which explains how to include directories more in depth (How to properly add include directories with CMake)