Could NOT find LMDB (missing: LMDB_INCLUDE_DIR LMDB_LIBRARIES) - c++

Windows 10
Visual Studio 14
I am trying to build a c++ code based on this github repository.
However, when I try to generate lib files in Cmake I get this error:
How can I make it recognize LMDB, GFALGS, and GLOG?

Apparently I'm not allowed to comment yet, but I would like to point you to the documentation: FindHDF5.
I can't find anything about HDF5_DIR but I did find HDF5_ROOT.
HDF5_ROOT
Specify the path to the HDF5 installation to use.

Related

Cannot point to DCMTKConfig.cmake

Using Windows 10, I want to configure the source of OpenSceneGraph via CMake to make it build-ready for Visual Studio. I also need some DCMTK functionalities, hence I want to link it.
OpenSceneGraph provides an attempt to link DCMTK in its CMakeLists.txt, but it fails (and since linking it is optional, configuration is finished nevertheless).
-- Trying to find DCMTK expecting DCMTKConfig.cmake
-- Trying to find DCMTK expecting DCMTKConfig.cmake - failed
-- Trying to find DCMTK relying on FindDCMTK.cmake
-- Please set DCMTK_DIR and re-run configure (missing: DCMTK_config_INCLUDE_DIR DCMTK_dcmdata_INCLUDE_DIR DCMTK_dcmimage_INCLUDE_DIR DCMTK_dcmimgle_INCLUDE_DIR DCMTK_dcmjpeg_INCLUDE_DIR DCMTK_dcmjpls_INCLUDE_DIR DCMTK_dcmnet_INCLUDE_DIR DCMTK_dcmpstat_INCLUDE_DIR DCMTK_dcmqrdb_INCLUDE_DIR DCMTK_dcmsign_INCLUDE_DIR DCMTK_dcmsr_INCLUDE_DIR DCMTK_dcmtls_INCLUDE_DIR DCMTK_ofstd_INCLUDE_DIR DCMTK_oflog_INCLUDE_DIR)
My DCMTK package does provide a DCMTKConfig.cmake file, and I've set a system environment variable DCMTK_DIR that points to its directory.
Researching the problem, I've found the article on FindDCMTK but I can't get any viable information out of it.
The directories for OpenSceneGraph and DCMTK are next to each other in a specified location.
How do I instruct CMake to find the configuration file of DCMTK?
As suggested by Tsyvarev in the comments above, I would also advise using the CMAKE Gui on Windows - when you attempt to configure, it should display everything it either set or changed with red highlights. Then you can manually edit the DCMTK related variables to point to the correct folders and/or files - you might be able to just edit the Root folders and hit configure again to let it populate based on root. When you are satisfied with the settings and not getting errors, then you can hit Generate to let it create the Visual Studio files.

Visual Studio's CMake with vcpkg: Error gdal is not found

I have been trying to build a cmake c++ project. More specifically I am trying to use the gdal library in this project. In the CMakeLists.txt it says find_library(GDAL gdal) after doing some research i found, that visual studio can open cmake files by default as mention in this thread: https://learn.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=vs-2019.
Moreover, visual studio should also automatically include the gdal library once i have set it up with vcpkg correctly. I've already downloaded the x64-windows version of the library (vcpkg install gdal:x64-windows) in order to build for the right architecture and made it available via vcpkg integrate install on a user-wide scope.
After some trial and error, everything works fine now, the toolchain gets included accordingly and the library is found automatically, resulting in a configuration like that:
However, when trying to include the header files (or anything else; see code snippet), visual studio does not seem to link the library correctly as it will result in the error message: cannot open source file "gdal/gdal.h".
#include <gdal/ogrsf_frmts.h>
#include <gdal/gdal.h>
#include <gdal>
Where should I further investigate?
As others have said vcpkg integrate install and vcpkg.cmake don't work together the reason being:
set_target_properties(${name} PROPERTIES VS_USER_PROPS do_not_import_user.props)
set_target_properties(${name} PROPERTIES VS_GLOBAL_VcpkgEnabled false)
this deactivates the integration. The reason to deactivate the integration is so that you don't write an incomplete CMakeLists.txt (e.g. missing the include directory or not linking all required libraries).
As such replace find_library(GDAL gdal) with find_package(GDAL REQUIRED) and target_link_libraries against the target GDAL::GDAL (https://cmake.org/cmake/help/v3.17/module/FindGDAL.html)

Compiling MariaDB C/C++ Connector on Windows

I am trying to use MariaDB in my visual studio project, so after looking at the documentation, I installed MariaDB and downloaded the source code for the C/C++ connector.
I got the include folder linked to the project, so I am able to make calls to the functions there, but it won't build because the linker fails to find the function definitions (obviously). I have looked all over and cannot find any solid directions on building the .lib files I need. I have found two sources that say that I need to just build the mariadb_connector_c.sln, but that file does not exist in the source code that I got, nor does it exist on their Git repo: https://github.com/MariaDB/mariadb-connector-c
The closest thing that I have found is the appveyor.yml file they provided, which contains the following: Contents of YML File
Is there anybody out there who has done this before? I can't find anything online or in the files they provided pertaining to this.
UPDATE:
I found the answer thanks to some of the replies. I needed to run the source code through cmake in order to get the .sln that I could then build to get the .lib files I need to link to the project.
The answer is a generic answer for any cmake project
Install CMake. make sure cmake.exe is in PATH (Windows installer offers this option). Install Visual Studio, and make sure C/C++ compiler is installed
start command line prompt
Execute "cmake . && cmake --build ." in the command line prompt.
That#s it.

How to build MinGW binaries in OpenCV for Windows?

I can't build MinGW binaries in OpenCV. I am using Code::Blocks and need to include OpenCV libraries in my C++ project.
I searched the web for hours for a solution, but i can't find any. I tried CMake, but get the following error:
CMake Error: CMake was unable to find a build program corresponding
to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably
need to select a different build tool.
I searched the web for this error, but all the proposed solutions are too advanced for me.
Is there a way to build MinGW without CMake? My reason for not want to use CMake is that it seems like i will get too much trouble with it. If it's not possible (or more difficult) to not use CMake, is anyone knows how to get around with aforementioned error?

Using GDCM via CMake

I downloaded source of GDCM 2.4.1 and used CMake 2.8.12.1 and Visual Studio 2010 to build the libraries. I want to use GDCM in my C++ project.
Unfortunately, it seems that after building the GDCM solution with VS, there are only the lib-files in the bin folder, but no typical "include" folder with the header files, what I usually expect. Thus, I can't integrate GDCM libaries in my own project (I tried to use FindPackage(GDCM) in my own CMakeproject, but header files can't be found).
I do not want to copy the header files manually or target the source directory of GDCM.
Does anybody know help?
I found out that the problem has something to do with VTK, I also use the this library in my project. So I need to enable "GDCM_USE_VTK" in CMake of GDCM. That option leads to a compiler error when I try to build the "INSTALL" subproject in the GDCM solution:
CMake Error at cmake_install.cmake:31 (FILE): file INSTALL cannot find "D:/Libs/VTK_5.6.0/BIN/bin/vtkCommon.dll".
I took a look in the VTK directory and found out that the path mentioned above does not exists. Instead the dll is located in:
D:\Libs\VTK_5.6.0\BIN\bin\Release\vtkCommon.dll or
D:\Libs\VTK_5.6.0\BIN\bin\Debug\vtkCommon.dll
That means GDCM solution does not know the dll is located in a special debug or release folder. If I disable "GDCM_USE_VTK" everything works fine and all files will be copied to the target folder. But I do need the VTK dll.
Any thoughts?
Michael
For anyone who ever touches the same problem, here's the final solution. Build "ALL_BUILD" in the GDCM solution, then integrate GDCM libs in your CMakeLists.txt the following way:
FIND_PACKAGE(GDCM REQUIRED)
IF(GDCM_FOUND)
INCLUDE(${GDCM_USE_FILE})
SET(GDCM_LIBRARIES
gdcmcharls
gdcmCommon
gdcmDICT
gdcmDSED
gdcmexpat
gdcmgetopt
gdcmIOD
gdcmjpeg12
gdcmjpeg16
gdcmjpeg8
gdcmMEXD
gdcmMSFF
gdcmopenjpeg
gdcmzlib
socketxx
vtkgdcm
Rpcrt4)
ELSE(GDCM_FOUND)
MESSAGE(FATAL_ERROR "Cannot find GDCM, did you set GDCM_DIR?")
ENDIF(GDCM_FOUND)