I am using CLion from Mac, and i'm having problems to understand how can i add external libraries to my project. So, how can i add external libraries to a c++ project?
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- Is GLFW designed to use without LWJGL (in java)?
- thread_local variables initialization
相关文章
- RDF libraries for Scala [closed]
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
- Converting glm::lookat matrix to quaternion and ba
Manually edit CMakeLists.txt adding the following lines at the end with the proper paths for your system and proper ProjectName. This config is for an Ubuntu 17.04 workstation.
Hope this helps.
You can test it with the following:
in
CMakeLists.txt
, add external library information. first, you can define a logical name for the external library, say for e.g. we want to link a shared library which has .so file somewhere already installed on the system,add_library(myLogicalExtLib SHARED IMPORTED)
IMPORTED means that the library already exists and we don't need to build it here in this project.
then, we can supply the location information about this logical library as follows,
set_target_properties(myLogicalExtLib PROPERTIES IMPORTED_LOCATION "/usr/lib/x86_64-linux-gnu/my_logical_ext_lib.so")