Linked Questions
162 questions linked to/from CMake link to external library
16 votes
1 answer
68k views
How to link shared library *dll with CMake in Windows [duplicate]
I have 2 files: library.dll and library.h with some code that I need in my own project. I'm working on Windows with Clion where I should config this with CMake. I tried this way: ...
3 votes
1 answer
6k views
CMake: Link an executable to multiple libraries (*.so) [duplicate]
I'm new to building with CMake. I'm using Ubuntu and I have a .cpp file (say xyz.cpp located somewhere in ~/mydir) which links to three custom shared libraries (libA.so, libB.so & libC.so ...
1 vote
2 answers
8k views
How to specify where to find a shared library using CMake? [duplicate]
I am trying to link to a shared library using CMake. I understand that this can bee achieved using the target_link_libraries() command. I have been able to get this working but not quite in the way ...
1 vote
1 answer
10k views
How to include custom *.so file to CMAKE? [duplicate]
I've created custom shared object with one function inside - void hello(); which only prints "hello". I'm now trying to use the SO in another project, but I can't use it (more likely - I don'...
0 votes
1 answer
6k views
Link static library with cmake [duplicate]
How can I link a static library with cmake? The library I'm trying to link is in the project directory lib/lib.a and the only source file is main.cpp. The .h file of the library lib.a is in inlcude/...
0 votes
1 answer
3k views
How to link any DLL to Cmake project [duplicate]
Is job in qmake: LIBS+= -L"C:\Program Files\program\any_dll.dll" How to in cmake? cmake_minimum_required(VERSION 2.8) project(my_project) add_executable(${PROJECT_NAME} "main.cpp")
1 vote
1 answer
3k views
How to link external library in Clion/Cmake? [duplicate]
I am new to Cmake, and I am having trouble linking an external library (libtiff). I have installed libtiff and it is in my /usr/local/include. Then I used include_directories() and ...
0 votes
1 answer
4k views
CMake: The following variables are used in this project, but they are set to NOTFOUND [duplicate]
I'm a newbie in CMake, i know there are many StackOverflow post asking this, but none of those posts helped me fix this error, this is what my workspace looked like project .vscode build ...
1 vote
2 answers
5k views
"No such file or directory" when linking shared library with CMake [duplicate]
I have am trying to link a precompiled so file to my executable in cmake. I'm not sure if I am misunderstanding how to use a shared library or not but I assumed that once I compile a shared library, ...
0 votes
1 answer
3k views
CMake : Linking cURL to my project : "cannot find -lcurl" [duplicate]
I would like to use cURL with my project. I added this to my CMakelist : include_directories(include) link_directories(lib) target_link_libraries(untitled curl) This is the tree of my project : When ...
2 votes
0 answers
3k views
CMake warning: CMake Targets may link only to libraries. CMake is dropping the item [duplicate]
I am making an anpr algorithm that requires tesseract to decode the image to text. When running cmake .. inside my build dir, I get a warning saying: ┌──(user㉿MacBookArch)-[~/dev/anpr/build] └─$ cmake ...
1 vote
1 answer
2k views
Getting undefined reference error when linking cmake [duplicate]
I am trying to include portaudio and opus in my project, but whenever i compile, i get this error Scanning dependencies of target PeersChat [ 50%] Building CXX object CMakeFiles/PeersChat.dir/main.cpp....
1 vote
1 answer
1k views
How to fix compile libpq-fe.h in cmake error in C++ [duplicate]
With g++ I compile my program "g++ main.cpp -lpq" without error, and with cmake on Clion this error appears i using #include <'postgresql/libpq-fe.h'> >/opt/clion-2018.3.4/bin/cmake/linux/bin/...
0 votes
1 answer
2k views
Adding third party static library + headers in CMake [duplicate]
I have a third-party static library that I would like to add to a project, and as there are ongoing updates to the library, I would like to stick to a single CMakeLists.txt in root (if possible) - or ...
1 vote
1 answer
1k views
How to compile+link a simple hello_world.c against a "cdylib" Rust lib on Windows using MSVC [duplicate]
I created a dynamic lib using Rust (crate type = "cdylib"). Rust/Cargo produced two files: text_loading_lib.dll and text_loading_lib.dll.lib. I want to build a really simple project (...