Tuesday 15 September 2015

c++ - How to use external DLLs in CMake project -


I have been looking on the Internet, but I can not find the answer to my question is that nothing (or I Do not know what to find out).

Anyway this is my problem: I want to use the third dual libraries (.dlls) files in my seamkake project. Library () which I want to include, is open source and which also wants to use in binary, also uses SIMKE as a working device, if it is relevant

I hope That was quite clear that I was quite clear.

After his CMakeLists.txt

First, edit you two things to include your third party library will need: for example, to link the path to link files and library file:

  # find_path (SIFTGPU_INCLUDE_DIR siftgpu.h) # library file find_library (SIFTGPU_LIBRARY siftgpu ), Then you may need (SIFTGPU_INCLUDE_DIR and SIFTGPU_LIBRARY) # In the future course of action depends on your CMakeLists.txt # locate your library set (SIFTGPU_FOUND TRUE) # If you need to compile the conditional # Some parts of your code based on the availability of the library, if you need it may occur (-DHAVE_LIBSIFTGPU = 1) # two, you really need Shamil_ set directory ($ {SIFTGPU_INCLUDE_DIR}) or (YOUR_LIBRARIES $ {YOUR_LIBRARIES} $ {SIFTGPU_LIBRARY}} {{SIFTGPU_LIBRARY}) Andaif ()   

Next, you do this for other libraries And when every library is detected, the link to the target:

  target_link_libraries (yourtarget $ {YOUR_LIBRARIES})   

Then you can go to CMake You can configure your project with, but this is not as any magic method to find your installed library, it will not get anything, but it will create two variables: SIFTGPU_INCLUDE_DIR And SIFTGPU_LIBRARY

Use the CMake GUI directory containing the header file o Pointing to the SIFTGPU_INCLUDE_DIR . And SIFTGPU_LIBRARY Liberalization file of your third party library.

Repeat, reconfigure and compile for every third-party library.

No comments:

Post a Comment