I'm using a third party dll that links to libcrypto.dll (version 1.1.1n). This third party library cannot be modified. In the other hand, I use sqlcipher.dll from vcpkg, which links to libcrypto-1_1-x64.dll.
My final executable uses both libraries directly (thirdparty dll, and sqlcipher). But when I execute it, it asks for both dlls, libcrypto-1_1-x64.dll and libcrypto. Cmake fails to find thirdparty libcrypto. libCrypto version does not matter because if I copy and rename my app works.
My question is: is there a way to use only one dll? preferably I would like to use vcpkg as is.
I modified vcpkg.json to use same openssl version that uses third party dll.
Related
In my CMakeLists I have a statement:
target_link_libraries(mytarget somelib)
The problem is that I am working on Windows and somelib has a verbatim name - libsomelib.a. I cannot control that because the library is built by another person (who thinks it is a cool idea to name Windows libraries in a UNIX fashion) and installed somewhere.
Prior to the statement I have
set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
which seems to affect only libraries produced by a given CMakeLists,
and, in the list of dependencies (of a generated VS project) it still appears as somelib.lib.
My question is what can be done to get this dependent library properly named?
I am trying to compile the example read_las_example.cpp in CGAL examples directory Point_set_processing_3.
However cmake command runs into the error:
include could not find load file:
CGAL_LASLIB_support
There are some directions on using CGAL with third party libraries here : https://doc.cgal.org/latest/Manual/thirdparty.html#thirdpartyLASlib
but I am not able to follow it. In particular I don't understand how to do this - "the executables should be linked with the CMake imported target CGAL::LASLIB_support provided in CGAL_LASLIB_support.cmake". If it helps, the CGAL_LASLIB_support.cmake file is located in the directory cgal/5.1/lib/cmake/CGAL
Can anyone help with how to use CGAL with third party libraries, in particular LASlib.
It means you need to include CGAL_LASLIB_support and call target_link_libraries(your_exe_name CGAL::LASLIB_support)
It is already used in the example's CmakeLists.txt, you should check that the CGAL you are using is really 5.1, not another version cached somewhere in your system. The target CGAL::LASLIB_support only exists since 5.1, so the error seems to indicate that the CGAL version you are using is not the right one.
My cmake project builds against external libraries, e.g. Boost. I would now like to advise cmake to generate "make install code" that causes all used external libraries to be added to the installation package.
My hope is that cmake can inspect the built shared objects and executables, e.g. using ldd, to find out which external libraries are required and add them without explicit naming of the individual libraries in the CMakeLists.txt.
Of course there is the other case in which the built code expicitly loads the external libaries (dlopen(), ...), e.g. as done by Intel IPP. In this case I would probably somehow need to explicitly name the libraries to install, e.g. using some variables set by the FindXXX cmake scripts.
I am using Visual Studio 2008 trying to create a .dll. The dll uses an external library (.lib). Compiling and linking works fine (I included the paths to header/lib in the options). When my .dll is used by a program (as a plugin) it says "externalLibrary.dll missing" but there is no externalLibrary.dll, just a externalLibrary.lib.
Are there different options of linking (so the externalLibrary is already in my .dll)? Or can i simply create a .dll from the .lib? Or any other solutions to this problem?
Edit (to be more concrete):
In project properties i added
the header path # C/C++ - General - Additional Include Directories
the library path # Linker - General - Additional Library Directories
the library name # Linker - Input - Additional Dependencies (although
this doesn't change anything)
The .lib file you are using is an import library which basically means that it contains only stubs for functions/classes/... but not the actual implmentation. That implementation is in the dll. An import library is only useful for the linker as it uses it to resolve symbols. But at runtime, the actual compiled code is needed so your application/dll looks for the dll. But even if your dll is used as a plugin, it's no problem for it to depend on other dlls. So if you have the other dll I suggest you go that way. (what is 'externalLibrary' btw?, it's not normal a vendor supplies you only with an import library and not the dll)
If you really do not want to use the external dll, you'll have to find the static library for the code of 'externalLibrary'. Unlike the import library, a static library does contain all symbols complete with actual implementation etc. So after linking with a static library, your application/dll contains the code itself and does not need to resolve it at runtime.
IDE: VS2005
Say I am using Poco library and the executable needs below dlls. I have to put them in same directory where the executable is.
msjava.dll
msvcp80.dll
msvcr80.dll
PocoFoundation.dll
PocoNet.dll
Is there any way that can build a dll-free executable? Thanks.
They don't have to be in the same directory. They can be in another directory if your PATH variables includes the directory they are in.
It looks like the Poco libraries can be downloaded as source, so you should be able to build them as static libraries and make a stand alone executable.
Update
For the msvc DLL's, you can build against static libraries. Bring up the properties of your project, go to C/C++, Code Generation and modify "Runtime Library". Make sure to choose a library other then "Multi-threaded DLL" or "Multi-threaded Debug DLL." You will also want to make sure you do that for the Poco libraries as well.