Add external library

Answered

Hello,

I'm having some problems with adding an external library to my project and everything I found regarding this topic didn't really get me any further.

I have these files added:

  • include/curses.h
  • include/panel.h
  • lib/pdcurses.lib
  • cmake-build-debug/pdcurses.dll

How do my CMakeLists.txt does to have to look for this? Tried so much but since I really have no clue about cmake I can't get it to work.

 

0
2 comments
Avatar
Permanently deleted user

Sebastian,

fist of all the compiler have to find the library and it's components. Use the following CMake command:

    find_package (my_library COMPONENTS REQUIRED component1 component2 OPTIONAL_COMPONENTS opt_component)

and after that you should link the target  with the library:

    target_link_libraries (my_target ${my_library};${another_library})

Find more info about including libraries and CMake in our Quick CMake tutorial: https://www.jetbrains.com/help/clion/2017.1/quick-cmake-tutorial.html 

0

Hello everyone,

I tried several suggestions and checked many stack overflow thread about adding pdcurses to clion, but i was not able to make it work.

Could you please provide a complete cmake config file?

In my configuration pdcurses lib is in the following folder:

C:\msys64\mingw64\include

C:\msys64\mingw64\lib

 

thank you very much

Kind regards

 

0

Please sign in to leave a comment.