Cannot point to DCMTKConfig.cmake - c++

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.

Related

How do you deploy/package a CMake project with Visual Studio?

I'm currently working on a small CMake project with visual studio and I'm wanting to distribute my current build but I have no clue how to, when testing the app on another system it would error saying what I'm guessing were runtime dll's that were missing. I can't find anything online about it, and the official CMake tutorial didn't work for me. Does anyone know a way to do this?
Just like you have been told in the comments, the proper way to distribute an application on Windows is to use VC redistributable package. But if one wants to create an independent "bundle" CMake can help with it. It has a module which helps to bring the necessary dlls wherever needed. You need to understand and plan how your resulting bundle will look like and adapt the paths accordingly. I will just show you how to bring the dlls to the current binary directory with the help of the said module:
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}")
include(InstallRequiredSystemLibraries)
These 2 lines will make sure that you have an install target by building which the dlls required will be copied (installed) to the ${CMAKE_INSTALL_PREFIX} path. That would be your start from which you can proceed further with any customization you need to make.

Could NOT find LMDB (missing: LMDB_INCLUDE_DIR LMDB_LIBRARIES)

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.

Qt5, Coin3D and SoQt

I'm trying to work with Qt5, SoQt (Version 1.5.0) and Coin3D (3.1.3). I used instructions found on this website to install Coin3D. I tried to install SoQt as well (Instructions found here). I had to change those export commands a little bit:
export COINDIR="/usr/local/share"
I tried four different versions of the export INCLUDE since i'm clueless about its purpose and i am not sure if this is the reason for the errors i'm getting:
export INCLUDE="/usr/local/include:/usr/include/x86_64-linux-gnu/qt5/QtCore"
export INCLUDE="/usr/local/include:/usr/include/x86_64-linux-gnu/qt5"
export INCLUDE="/usr/include/x86_64-linux-gnu/qt5/QtCore"
export INCLUDE="/usr/include/x86_64-linux-gnu/qt5"
This is where errormessages appear: (Shorter summary below)
checking for QT4...
Could not gather the configure flags for Qt through pkg-config. Please
ensure that the qt pkg-config metadata .pc files, such as QtCore.pc,
exist on your system. In case the metadata .pc files are installed
into a non-default location verify that the PKG_CONFIG_PATH environment
variable points to the correct directory.
Further details in how to set the PKG_CONFIG_PATH environment variable
can be found in the pkg-config(1) man page.
checking whether the X11 miscellaneous utilities library is available... maybe
checking for cygpath... false
checking for moc... /usr/bin/moc
configure: WARNING: header file qglobal.h not found, can not compile Qtcode
configure: WARNING: QTDIR environment variable not set -- this might be an indication of a problem
Could not find any way to build against the Qt library. If you
are sure Qt is properly installed on your system, see the file
config.log to find out what went wrong.
One common way to solve this problem is to set up the environment
variable QTDIR to the base of the Qt installation directory. Or if it
was already set up, double check to see that it is pointing at the
correct directory.
Note that it is possible to override the combinations of Qt libraries
configure tries to link against by setting up the environment variable
CONFIG_QTLIBS. This might be necessary if you have installed the Qt
library in a manner that is not compatible with any of the known
configurations, for instance by changing the name of the library or
the Qt library having more dependencies on other libraries that we are
aware of.
If you for instance know the correct set of libraries to be qt304.lib,
qtmain.lib and gdi32.lib (this would be on an MSWindows system), then
set CONFIG_QTLIBS to the string ''-lqt304 -lqtmain -lgdi32'' before
re-running configure.
If you still can't get the configure script to detect the presence of
and how to use the Qt library, please mail the config.log file to
<coin-support#coin3d.org> and ask for help.
configure: error: aborting
I might be wrong but it seems like he is looking for Qt4 and not Qt5 because of
checking for QT4...
It also reads
configure: WARNING: header file qglobal.h not found, can not compile Qtcode
That's why i tried using qt5/QtCore instead of qt5 as path because there is a qglobal.h located within QtCore but it doesn't change anything.
Did anyone else face similar problems when setting up SoQt with Qt5 and can help me out?
Thanks in advance!
Those releases are very old (2012). Please grab the latest source of Coin from the CMake brach [1], and SoQt from [2]. Build with CMake. Also see this discussion [3] regarding high DPI support.
[1] https://bitbucket.org/Coin3D/coin/branch/CMake
[2] https://bitbucket.org/Coin3D/soqt/branch/default
[3] https://groups.google.com/forum/#!topic/coin3d-discuss/ipkSH08iFNk

Where is the lib folder (or its replacement) in the current OpenCV?

I'm following a book written for the older version of OpenCV (OpenCV 2 Computer Vision, by PACT) and it tells me to include the lib folder in my Visual Studio 2013 Property Manager when creating a new property sheet.
I don't see a directory called lib in the current GitHub version (opencv-master, which is OpenCV 3.1.x). Has this folder been replaced by something else?
I built OpenCV with cmake. I found a 4 year old unanswered question wherein someone was also looking for this folder. They tried building the library from another directory that no longer exists, but that didn't work for them anyway...
Another OpenCV user just told me that GitHub doesn't include the libraries, so you have to cmake them locally. I'm still not clear on where / how I can cmake them.
I realize the pre-built binaries have this, but I'm avoiding them because I need the SURF functions in opencv_contrib, so I needed to build it from source.
The pre-built binaries will have a library folder in the corresponding path
Local System Path(Opencv Folder)-> build->x64/x86->vc10/vc11/vc12->lib.
As you mentioned that you don't wish to use it then the only option left for you is to build it locally which is a much better option if you plan to use Opencv libraries for varied functions and projects as it resolves many build errors that you might face later.
I used the Cmake Graphical user interface to build opencv, following are the steps I followed to successfully build the libraries on my system .
So, you would need to create a new folder that will contain all
the Makefiles generated.
Please refer to this image for clearer understanding:
In GUI you define source directory path where OpenCVConfig.cmake is present, according to your image it's the
current folder in your image opencv-master.
Similarly, define the path to the new directory you created where all the build files would be stored.
Make sure to uncheck Build_Examples to avoid configuration errors.
Then click Configure at the bottom when configuring is done .(you may need to configure it twice)
After click the tab adjacent to configure, Generate to create the solution file.It will ask you for the compiler name
select the
compiler installed on your system from the list of choices. After
generation is done.
Go to this path Build_New_Directory(the directory you created) you will find OpenCV.sln build this project, it will take around 10-15 minutes depending on your processor, wait patiently .If you get a build error at this point don't invest your time in debugging on Visual Studio go back to Cmake GUi and configure it again and this time give the path to dependent libraries on your system that it could not find .Repeat the process it should be successfully build now.
After it is successfully build you can now locate the path of all opencv libraries build on your system as follows.
Build_New_Directory(the directory you created)->
install->x64->vc10(compiler I used)->lib.
As an update to Nikita's awnser:
There is a cmake build bug where the x64 folder will not be created if OpenCV_RUNTIME is not set. This will happen if you build an old OpenCV (e.g. <= 3.2.0) with a newer Visual Studio Version than was available at that time (e.g. Visual Studio 2017)
To fix this, add the correct MSVC_VERSION elseif-cases in both ./cmake/OpenCVDetectCXXCompiler.cmake and the ./cmake/templates/OpenCVConfig.root-WIN32.cmake.in (or ./cmake/OpenCVConfig.cmake in < v3.2.0) files:
[...]
elseif(MSVC_VERSION EQUAL 1900)
set(OpenCV_RUNTIME vc14)
# old version ends here with endif()
elseif(MSVC_VERSION GREATER 1909 AND MSVC_VERSION LESS 1920)
set(OpenCV_RUNTIME vc15)
elseif(MSVC_VERSION GREATER 1919 AND MSVC_VERSION LESS 1930)
set(OpenCV_RUNTIME vc16)
endif()
[...]

No ".cmake" file in home directory

I've been trying to compile a C++ project that links to the Caffe deep learning library. One piece of advice I received when using cmake was that the CMAKE_MODULES_PATH variable gets updated when I've compiled the library before so I can refer to Caffe in future cmake builds. This is supposed to be stored here:
~/.cmake/
However when I search for hidden items in my home directory, I can't find it anywhere. I'm running cmake 2.8 - is this a feature of another version or am I missing something?
CMake doesn't create any such directory. Nor does CMake search that location by default. You can create it yourself if you like, and add it to CMAKE_MODULE_PATH.