Using vcpkg to install RTABMap with VSCode as editor - c++

I want to install RTABMap with vcpkg and then use VSCode as editor to include RTABMap into my C++ project. I installed RTABMap as described on their wiki with vcpkg install rtabmap:x64-windows (i also tried the x86 triplet) and then wanted to use it in my project. To get started I wrote the following cmake file based on an example from their repository:
cmake_minimum_required(VERSION 3.5)
project(RTABMap_Test VERSION 0.1.0)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}")
find_package(RTABMap REQUIRED)
find_package(OpenCV REQUIRED)
set(INCLUDE_DIRS
${RTABMap_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
)
set(LIBRARIES
${RTABMap_LIBRARIES}
${OpenCV_LIBRARIES}
)
include_directories(${INCLUDE_DIRS})
add_executable(RTABMap_Test main.cpp)
target_link_libraries(RTABMap_Test ${LIBRARIES})
and the following main.cpp file:
#include <rtabmap/core/Rtabmap.h>
int main(void) {
return 0;
}
The cmake settings in VSCode are as follows:
"cmake.configureSettings": {
"CMAKE_TOOLCHAIN_FILE": "G:/.vcpkg/scripts/buildsystems/vcpkg.cmake",
"VCPKG_TARGET_TRIPLET": "x64-windows"
}
However, when I run CMake: Build from VSCode, cmake fails with the following message:
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
-- The C compiler identification is MSVC 19.32.31332.0
-- The CXX compiler identification is MSVC 19.32.31332.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning at G:/.vcpkg/installed/x64-windows/share/rtabmap/RTABMapConfig.cmake:78 (MESSAGE):
Asked for "gui" module but RTABMap hasn't been built with gui support.
Call Stack (most recent call first):
G:/.vcpkg/scripts/buildsystems/vcpkg.cmake:843 (_find_package)
CMakeLists.txt:6 (find_package)
-- Found RTABMap: RTABMap_CORE_RELEASE-NOTFOUND;RTABMap_UTILITE_RELEASE-NOTFOUND;optimized;G:/.vcpkg/installed/x64-windows/lib/zlib.lib;debug;G:/.vcpkg/installed/x64-windows/debug/lib/zlibd.lib
-- Found Protobuf: G:/.vcpkg/installed/x64-windows/tools/protobuf/protoc.exe (found version "3.21.12.0")
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Found TIFF: optimized;G:/.vcpkg/installed/x64-windows/lib/tiff.lib;debug;G:/.vcpkg/installed/x64-windows/debug/lib/tiffd.lib (found version "4.5.0")
-- Found HDF5: hdf5::hdf5-shared (found version "1.12.2")
-- Found ZLIB: optimized;G:/.vcpkg/installed/x64-windows/lib/zlib.lib;debug;G:/.vcpkg/installed/x64-windows/debug/lib/zlibd.lib (found suitable version "1.2.13", minimum required is "1")
-- Found JPEG: optimized;G:/.vcpkg/installed/x64-windows/lib/jpeg.lib;debug;G:/.vcpkg/installed/x64-windows/debug/lib/jpeg.lib (found version "62")
-- Found ZLIB: optimized;G:/.vcpkg/installed/x64-windows/lib/zlib.lib;debug;G:/.vcpkg/installed/x64-windows/debug/lib/zlibd.lib (found version "1.2.13")
-- Found PNG: optimized;G:/.vcpkg/installed/x64-windows/lib/libpng16.lib;debug;G:/.vcpkg/installed/x64-windows/debug/lib/libpng16d.lib (found version "1.6.39")
-- Found GIF: optimized;G:/.vcpkg/installed/x64-windows/lib/gif.lib;debug;G:/.vcpkg/installed/x64-windows/debug/lib/gif.lib (found version "5.2.1")
-- Found LibArchive: G:/.vcpkg/installed/x64-windows/debug/lib/archive.lib (found version "3.6.2")
-- Found OpenCV: G:/.vcpkg/installed/x64-windows (found version "4.7.0")
-- Configuring done
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
RTABMap_CORE_RELEASE
linked by target "RTABMap_Test" in directory G:/FKIE/rtabmap_test
RTABMap_UTILITE_RELEASE
linked by target "RTABMap_Test" in directory G:/FKIE/rtabmap_test
-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
On the other hand, when I run cmake . -DCMAKE_TOOLCHAIN_FILE=G:/.vcpkg/scripts/buildsystems/vcpkg.cmake I get this error:
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
CMake Warning at G:/.vcpkg/installed/x64-windows/share/rtabmap/RTABMapConfig.cmake:78 (MESSAGE):
Asked for "gui" module but RTABMap hasn't been built with gui support.
Call Stack (most recent call first):
G:/.vcpkg/scripts/buildsystems/vcpkg.cmake:843 (_find_package)
CMakeLists.txt:6 (find_package)
-- Found ZLIB: optimized;G:/.vcpkg/installed/x64-windows/lib/zlib.lib;debug;G:/.vcpkg/installed/x64-windows/debug/lib/zlibd.lib (found suitable version "1.2.13", minimum required is "1")
-- Found ZLIB: optimized;G:/.vcpkg/installed/x64-windows/lib/zlib.lib;debug;G:/.vcpkg/installed/x64-windows/debug/lib/zlibd.lib (found version "1.2.13")
-- Configuring done
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
RTABMap_CORE_RELEASE
linked by target "RTABMap_Test" in directory G:/FKIE/rtabmap_test
RTABMap_UTILITE_RELEASE
linked by target "RTABMap_Test" in directory G:/FKIE/rtabmap_test
-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
The two missing variables are set in the RTABMapConfig.cmake.in located at the root directory of the RTABMap repository and used by the CMakeLists.txt, so I assume that I don't have to set them manually, meaning -- as far as I can tell -- when vcpkg installs RTABMap it doesn't properly configure RTABMap.
What to do?

I had to write this as an answer due to character limitation. It's however more of a hint on what to look at rather then how to fix it.
Let's take a look at how RTABMapConfig.cmake is generated via the precursor file RTABMapConfig.cmake.in:
Lines 18-21:
find_library(RTABMap_CORE_RELEASE NAMES rtabmap_core NO_DEFAULT_PATH HINTS #CONF_LIB_DIR#)
find_library(RTABMap_CORE_DEBUG NAMES rtabmap_cored NO_DEFAULT_PATH HINTS #CONF_LIB_DIR#)
IF(RTABMap_CORE_DEBUG AND RTABMap_CORE_RELEASE)
#...
Not ideal for a .cmake.in but I'm not going to judge that. All that I'm going to say is that parts of the code rely on certain variables being set. The same variables that were "NOT FOUND" in your generation i.e. this line in the generation step:
-- [...] RTABMap_CORE_RELEASE-NOTFOUND [...]
If you would traverse the .cmake.in file down you would notice the same for the other "NOT FOUND" variable.
Later on we have:
Line 47:
set(RTABMap_LIBRARIES ${RTABMap_CORE} ${RTABMap_UTILITE})
Which is (as you probably know by now) empty.
Conclusion and possible solutions:
The RTABMapConfig.cmake can't find the proper libraries (if they exist) this can be caused either by the fact that during the vcpkg install phase something went wrong and the libraries weren't built OR the RTABMapConfig.cmake was poorly generated and needs to be fixed (the paths to the core and utilite libraries specifically)
Check if something like rtabmap_core.lib exists and if not - compilation failed and you need to reinstall rtabmap
If ad1) isn't the case then open up the RTABMapConfig.cmake and look at the paths to these libraries - fix them if needed.
EDIT: If I were you I would open up an issue on vcpkg's github.

Related

How to find and link CUDA libraries using CMake 3.15?

I'm using CMake 3.15-rc3 on my Unix-like system.
I need to link a program I'm building with several of the CUDA libraries, including cublas, cufft, cusolver, curand, nppicc, nppial, nppist, nppidei, nppig, nppitc, npps.
Based on what I found online, I need to do something like this:
add_executable(test benchmark.cpp)
find_package(CUDALibs)
target_link_libraries(test CUDA::cudart CUDA::cublas CUDA::cufft CUDA::cusolver CUDA::curand CUDA::nppicc CUDA::nppial CUDA::nppist CUDA::nppidei CUDA::nppig CUDA::nppitc CUDA::npps)
When I run make I get the following error:
CMake Warning at CMakeLists.txt:27 (find_package):
By not providing "FindCUDALibs.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "CUDALibs",
but CMake did not find one.
Could not find a package configuration file provided by "CUDALibs" with any
of the following names:
CUDALibsConfig.cmake
cudalibs-config.cmake
Add the installation prefix of "CUDALibs" to CMAKE_PREFIX_PATH or set
"CUDALibs_DIR" to a directory containing one of the above files. If
"CUDALibs" provides a separate development package or SDK, be sure it has
been installed.
So looks like I need a CUDALibsConfig.cmake file. Where do I get this file and how to I tell cmake to use it?
If I use the following it works:
find_package(CUDA REQUIRED)
target_link_libraries(run_benchmarks tf libmxnet.so ${CUDA_LIBRARIES} ${CUDA_cusparse_LIBRARY} ${CUDA_cublas_LIBRARY} ${CUDA_npp_LIBRARY})
But according to this find_package(cuda) is deprecated, so I want to learn the proper usage.
Edit
I tried what was suggested in one of the responses.
I added CUDA to the project LANGUAGES:
project(
test_project
DESCRIPTION "Test project"
LANGUAGES CXX CUDA
)
And then I used find_package( FindCUDAToolkit REQUIRED)
However, when I run cmake I get the following errors:
 nchafni   dev  …  sample_code  benchmarks  build  1  cmake ..
-- The CXX compiler identification is GNU 7.5.0
-- The CUDA compiler identification is NVIDIA 10.1.243
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working CUDA compiler: /usr/local/cuda-10.1/bin/nvcc
-- Check for working CUDA compiler: /usr/local/cuda-10.1/bin/nvcc -- works
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
CMake Error at CMakeLists.txt:17 (find_package):
By not providing "FindFindCUDAToolkit.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"FindCUDAToolkit", but CMake did not find one.
Could not find a package configuration file provided by "FindCUDAToolkit"
with any of the following names:
FindCUDAToolkitConfig.cmake
findcudatoolkit-config.cmake
Add the installation prefix of "FindCUDAToolkit" to CMAKE_PREFIX_PATH or
set "FindCUDAToolkit_DIR" to a directory containing one of the above files.
If "FindCUDAToolkit" provides a separate development package or SDK, be
sure it has been installed.
-- Configuring incomplete, errors occurred!
What am I missing?
find_package(CUDA) is deprecated for the case of programs written in CUDA / compiled with a CUDA compiler (e.g. NVCC). The documentation page says (emphasis mine):
It is no longer necessary to use this module or call find_package(CUDA) for
compiling CUDA code. Instead, list CUDA among the languages named in
the top-level call to the project() command, or call the
enable_language() command with CUDA. Then one can add CUDA (.cu)
sources to programs directly in calls to add_library() and
add_executable().
But find_package(CUDA) was not really deprecated - as of CMake version 3.15 - for C++ code which simply uses CUDA-enabled/CUDA-bundled/CUDA-utilizing libraries.
In CMake 3.17, a new macro/command was introduced: FindCUDAToolkit() (and this, find_package(CUDAToolkit). You can't use that with your version of CMake; find_package(CUDA) will do just fine, even if it's a bit clunky and outdated.
Edit: It is actually very easy to upgrade to a newer CMake version: KitWare offer binary releases which have very little dependencies. On a Linux system they would be:
linux-vdso.so.1
libdl.so.2
librt.so.1
libpthread.so.0
libm.so.6
libc.so.6
/lib64/ld-linux-x86-64.so.2
... and you would be hard-pressed to find a system without these. Also, even when installed under an arbitrary path, CMake will be able to differentiate between its version of shared files and whatever the system version of CMake uses. So - no reason to stick with the old version.
The documentation you linked says that you need to add CUDA to the list of languages in your project() command. And to find CUDA libraries it says to use FindCUDAToolkit module, not that CUDALibs.

How to handle with 'Policy CMP0074 is not set' warning while using Cmake to build PCL tutorials?

I want to complete this basic tutorial:
http://pointclouds.org/documentation/tutorials/writing_pcd.php#writing-pcd
Its very simple. When I prepare CMakeLists.txt and .cpp file, I run them with CMake GUI and I get this warning. I installed PCL 1.9.1 so I build file for Visual Studio 2017 64x.
Selecting Windows SDK version 10.0.17134.0 to target Windows 10.0.17763.
The C compiler identification is MSVC 19.15.26726.0
The CXX compiler identification is MSVC 19.15.26726.0
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x64/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x64/cl.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Detecting C compile features
Detecting C compile features - done
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x64/cl.exe
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x64/cl.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
CMake Warning (dev) at CMakeLists.txt:5(find_package):
Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables.
Run "cmake --help-policy CMP0074" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
Environment variable PCL_ROOT is set to:
C:\libraries\PCL 1.9.1
For compatibility, CMake is ignoring the variable. This warning is for project developers. Use -Wno-dev to suppress it.
Found Eigen: C:/libraries/PCL 1.9.1/3rdParty/Eigen/eigen3
Eigen found (include: C:/libraries/PCL 1.9.1/3rdParty/Eigen/eigen3, version: 3.3.5)
Looking for pthread.h
Looking for pthread.h - not found
Found Threads: TRUE
Found Boost: C:/libraries/PCL 1.9.1/3rdParty/Boost/include/boost-1_68 (found suitable version "1.68.0", minimum required is "1.40.0") found components: system filesystem thread date_time iostreams serialization chrono atomic regex
Found FLANN: C:/libraries/PCL 1.9.1/3rdParty/FLANN/lib/flann_cpp_s.lib FLANN found (include: C:/libraries/PCL 1.9.1/3rdParty/FLANN/include, lib: optimized;C:/libraries/PCL 1.9.1/3rdParty/FLANN/lib/flann_cpp_s.lib;debug;C:/libraries/PCL 1.9.1/3rdParty/FLANN/lib/flann_cpp_s-gd.lib)
FLANN found (include: C:/libraries/PCL 1.9.1/3rdParty/FLANN/include, lib: optimized;C:/libraries/PCL 1.9.1/3rdParty/FLANN/lib/flann_cpp_s.lib;debug;C:/libraries/PCL 1.9.1/3rdParty/FLANN/lib/flann_cpp_s-gd.lib)
Found OpenNI2: C:/libraries/OpenNI2/Lib/OpenNI2.lib
OpenNI2 found (include: C:/libraries/OpenNI2/Include, lib: C:/libraries/OpenNI2/Lib/OpenNI2.lib)
OpenNI2 found (include: C:/libraries/OpenNI2/Include, lib: C:/libraries/OpenNI2/Lib/OpenNI2.lib)
Found Qhull: optimized;C:/libraries/PCL 1.9.1/3rdParty/Qhull/lib/qhullstatic.lib;debug;C:/libraries/PCL 1.9.1/3rdParty/Qhull/lib/qhullstatic_d.lib
QHULL found (include: C:/libraries/PCL 1.9.1/3rdParty/Qhull/include, lib: optimized;C:/libraries/PCL 1.9.1/3rdParty/Qhull/lib/qhullstatic.lib;debug;C:/libraries/PCL 1.9.1/3rdParty/Qhull/lib/qhullstatic_d.lib)
looking for PCL_COMMON
Found PCL_COMMON: C:/libraries/PCL 1.9.1/lib/pcl_common_release.lib
looking for PCL_KDTREE
Found PCL_KDTREE: C:/libraries/PCL 1.9.1/lib/pcl_kdtree_release.lib looking for PCL_OCTREE
Found PCL_OCTREE: C:/libraries/PCL 1.9.1/lib/pcl_octree_release.lib
looking for PCL_SEARCH
Found PCL_SEARCH: C:/libraries/PCL 1.9.1/lib/pcl_search_release.lib
looking for PCL_SAMPLE_CONSENSUS
Found PCL_SAMPLE_CONSENSUS: C:/libraries/PCL 1.9.1/lib/pcl_sample_consensus_release.lib
looking for PCL_FILTERS
Found PCL_FILTERS: C:/libraries/PCL 1.9.1/lib/pcl_filters_release.lib
looking for PCL_2D
Found PCL_2D: C:/libraries/PCL 1.9.1/include/pcl-1.9
looking for PCL_GEOMETRY
Found PCL_GEOMETRY: C:/libraries/PCL 1.9.1/include/pcl-1.9
looking for PCL_IO
Found PCL_IO: C:/libraries/PCL 1.9.1/lib/pcl_io_release.lib
looking for PCL_FEATURES
Found PCL_FEATURES: C:/libraries/PCL 1.9.1/lib/pcl_features_release.lib looking for PCL_ML
Found PCL_ML: C:/libraries/PCL 1.9.1/lib/pcl_ml_release.lib
looking for PCL_SEGMENTATION
Found PCL_SEGMENTATION: C:/libraries/PCL 1.9.1/lib/pcl_segmentation_release.lib
looking for PCL_VISUALIZATION
Found PCL_VISUALIZATION: C:/libraries/PCL 1.9.1/lib/pcl_visualization_release.lib
looking for PCL_SURFACE
Found PCL_SURFACE: C:/libraries/PCL 1.9.1/lib/pcl_surface_release.lib
looking for PCL_REGISTRATION
Found PCL_REGISTRATION: C:/libraries/PCL 1.9.1/lib/pcl_registration_release.lib
looking for PCL_KEYPOINTS
Found PCL_KEYPOINTS: C:/libraries/PCL 1.9.1/lib/pcl_keypoints_release.lib
looking for PCL_TRACKING
Found PCL_TRACKING: C:/libraries/PCL 1.9.1/lib/pcl_tracking_release.lib
looking for PCL_RECOGNITION
Found PCL_RECOGNITION: C:/libraries/PCL 1.9.1/lib/pcl_recognition_release.lib
looking for PCL_STEREO
Found PCL_STEREO: C:/libraries/PCL 1.9.1/lib/pcl_stereo_release.lib
looking for PCL_OUTOFCORE
Found PCL_OUTOFCORE: C:/libraries/PCL 1.9.1/lib/pcl_outofcore_release.lib
looking for PCL_PEOPLE
Found PCL_PEOPLE: C:/libraries/PCL 1.9.1/lib/pcl_people_release.lib
Found PCL: pcl_common;pcl_kdtree;pcl_octree;pcl_search;pcl_sample_consensus;pcl_filters;pcl_io;pcl_features;pcl_ml;pcl_segmentation;pcl_visualization;pcl_surface;pcl_registration;pcl_keypoints;pcl_tracking;pcl_recognition;pcl_stereo;pcl_outofcore;pcl_people;optimized;C:/libraries/PCL 1.9.1/3rdParty/Boost/lib/libboost_system-vc141-mt-x64-1_68.lib;debug;C:/libraries/PCL 1.9.1/3rdParty/Boost/lib/libboost_system-vc141-mt-gd-x64-1_68.lib;optimized;C:/libraries/PCL 1.9.1/3rdParty/Boost/lib/libboost_filesystem-vc141-mt-x64-1_68.lib;debug;C:/libraries/PCL 1.9.1/3rdParty/Boost/lib/libboost_filesystem-vc141-mt-gd-x64-1_68.lib;optimized;C:/libraries/PCL 1.9.1/3rdParty/Boost/lib/libboost_thread-vc141-mt-x64-1_68.lib;debug;C:/libraries/PCL 1.9.1/3rdParty/Boost/lib/libboost_thread-vc141-mt-gd-x64-1_68.lib;optimized;C:/libraries/PCL 1.9.1/3rdParty/Boost/lib/libboost_date_time-vc141-mt-x64-1_68.lib;debug;C:/libraries/PCL 1.9.1/3rdParty/Boost/lib/libboost_date_time-vc141-mt-gd-x64-1_68.lib;optimized;C:/libraries/PCL 1.9.1/3rdParty/Boost/lib/libboost_iostreams-vc141-mt-x64-1_68.lib;debug;C:/libraries/PCL 1.9.1/3rdParty/Boost/lib/libboost_iostreams-vc141-mt-gd-x64-1_68.lib;optimized;C:/libraries/PCL 1.9.1/3rdParty/Boost/lib/libboost_serialization-vc141-mt-x64-1_68.lib;debug;C:/libraries/PCL 1.9.1/3rdParty/Boost/lib/libboost_serialization-vc141-mt-gd-x64-1_68.lib;optimized;C:/libraries/PCL 1.9.1/3rdParty/Boost/lib/libboost_chrono-vc141-mt-x64-1_68.lib;debug;C:/libraries/PCL 1.9.1/3rdParty/Boost/lib/libboost_chrono-vc141-mt-gd-x64-1_68.lib;optimized;C:/libraries/PCL 1.9.1/3rdParty/Boost/lib/libboost_atomic-vc141-mt-x64-1_68.lib;debug;C:/libraries/PCL 1.9.1/3rdParty/Boost/lib/libboost_atomic-vc141-mt-gd-x64-1_68.lib;optimized;C:/libraries/PCL 1.9.1/3rdParty/Boost/lib/libboost_regex-vc141-mt-x64-1_68.lib;debug;C:/libraries/PCL 1.9.1/3rdParty/Boost/lib/libboost_regex-vc141-mt-gd-x64-1_68.lib;optimized;C:/libraries/PCL 1.9.1/3rdParty/Qhull/lib/qhullstatic.lib;debug;C:/libraries/PCL 1.9.1/3rdParty/Qhull/lib/qhullstatic_d.lib;C:/libraries/OpenNI2/Lib/OpenNI2.lib;optimized;C:/libraries/PCL 1.9.1/3rdParty/FLANN/lib/flann_cpp_s.lib;debug;C:/libraries/PCL 1.9.1/3rdParty/FLANN/lib/flann_cpp_s-gd.lib;vtksys;vtkCommonCore;vtkCommonMath;vtkCommonMisc;vtkCommonSystem;vtkCommonTransforms;vtkCommonDataModel;vtkCommonColor;vtkCommonExecutionModel;vtkCommonComputationalGeometry;vtkFiltersCore;vtkFiltersGeneral;vtkImagingCore;vtkImagingFourier;vtkalglib;vtkFiltersStatistics;vtkFiltersExtraction;vtkInfovisCore;vtkFiltersGeometry;vtkFiltersSources;vtkRenderingCore;vtkzlib;vtkfreetype;vtkRenderingFreeType;vtkRenderingContext2D;vtkChartsCore;vtkDICOMParser;vtklz4;vtkIOCore;vtkIOLegacy;vtkexpat;vtkIOXMLParser;vtkDomainsChemistry;vtkIOXML;vtkParallelCore;vtkFiltersAMR;vtkFiltersFlowPaths;vtkFiltersGeneric;vtkImagingSources;vtkFiltersHybrid;vtkFiltersHyperTree;vtkImagingGeneral;vtkFiltersImaging;vtkFiltersModeling;vtkFiltersParallel;vtkFiltersParallelImaging;vtkFiltersPoints;vtkFiltersProgrammable;vtkFiltersSMP;vtkFiltersSelection;vtkFiltersTexture;vtkFiltersTopology;verdict;vtkFiltersVerdict;vtkmetaio;vtkjpeg;vtkpng;vtktiff;vtkIOImage;vtkImagingHybrid;vtkInfovisLayout;vtkInteractionStyle;vtkImagingColor;vtkRenderingAnnotation;vtkRenderingVolume;vtkInteractionWidgets;vtkViewsCore;vtkproj4;vtkGeovisCore;vtkhdf5_hl;vtkhdf5;vtkIOAMR;vtkIOEnSight;vtkNetCDF;vtkexoIIc;vtkIOExodus;vtkRenderingOpenGL;vtkRenderingContextOpenGL;vtkgl2ps;vtkRenderingGL2PS;vtklibharu;vtkIOExport;vtkRenderingLabel;vtkIOExportOpenGL;vtkIOGeometry;vtkIOImport;vtklibxml2;vtkIOInfovis;vtkIOLSDyna;vtkIOMINC;vtkoggtheora;vtkIOMovie;vtknetcdfcpp;vtkIONetCDF;vtkIOPLY;vtkjsoncpp;vtkIOParallel;vtkIOParallelXML;vtksqlite;vtkIOSQL;vtkIOTecplotTable;vtkIOVideo;vtkImagingMath;vtkImagingMorphological;vtkImagingStatistics;vtkImagingStencil;vtkInteractionImage;vtkRenderingImage;vtkRenderingLIC;vtkRenderingLOD;vtkRenderingVolumeOpenGL;vtkViewsContext2D;vtkViewsInfovis (Required is at least version "1.2")
Configuring done
Generating done
After build, when I click open project and run it, I get this error.
Any solution for it?
The CMP0074 warning is not really a problem you as a user need to worry about. It's a warning for the developer of the CMakeLists.txt that a behavior in CMake has changed.
https://cmake.org/cmake/help/latest/policy/CMP0074.html
In CMake 3.12 and above the find_package() command now
searches prefixes specified by the _ROOT CMake variable
and the ROOT environment variable. Package roots are
maintained as a stack so nested calls to all find* commands inside
find modules also search the roots as prefixes. This policy provides
compatibility with projects that have not been updated to avoid using
_ROOT variables for other purposes.
The OLD behavior for this policy is to ignore _ROOT
variables. The NEW behavior for this policy is to use
_ROOT variables.
Basically the warning is that the developers of the CMakeLists.txt have not set the policy to enable the new behavior or to keep the old behavior however the PCL_ROOT was defined. CMake will not automatically use it because the new behavior is not enabled.
The ALL_BUILD error message is because the ALL_BUILD target / project is not an executable target. It's purpose is to force building of all projects in the solution. To fix that part you need to right click on an executable project / target in the Solution Explorer and click "Set this project as the startup project"

Building cpp-netlib with CMake

I've downloaded the cpp-netlib source, extracted it to a folder and for some reason I'm completely lost. I read the documentation carefully, it states I have to download CMake as well, which I did. Then I set the source directory and build directories, and upon clicking the "Generate" button I got this output:
The CXX compiler identification is MSVC 19.0.23506.0
Check for working C compiler using: Visual Studio 14 2015
Check for working C compiler using: Visual Studio 14 2015 -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler using: Visual Studio 14 2015
Check for working CXX compiler using: Visual Studio 14 2015 -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/FindBoost.cmake:1657 (message):
Unable to find the requested Boost libraries.
Unable to find the Boost header files. Please set BOOST_ROOT to the root
directory containing Boost or BOOST_INCLUDEDIR to the directory containing
Boost's headers.
Call Stack (most recent call first):
CMakeLists.txt:49 (find_package)
Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_LIBRARIES OPENSSL_INCLUDE_DIR)
Looking for pthread.h
Looking for pthread.h - not found
Found Threads: TRUE
CMake Error at CMakeLists.txt:131 (export):
export given target "cppnetlib-client-connections" which is not built by
this project.
Configuring incomplete, errors occurred!
See also "C:/Users/Nick/Documents/cpp-netlib/cpp-netlib-build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Nick/Documents/cpp-netlib/cpp-netlib-build/CMakeFiles/CMakeError.log"
It couldn't find the Boost libraries, and that's where I'm stuck. I installed boost, but I have no idea where to set "BOOST_ROOT". I did some research on that, tried to use the command line with the -DBOOST_ROOT option like so:
c:\Program Files>cmake -DBOOST_ROOT=/boost/boost_1_55_0
But it gives me the following error:
CMake Error: The source directory "C:/Program Files" does not appear to contain
CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
I'm really unsure as to what to do now and I feel this isn't the end of my problems... Is there anything obvious I'm missing?
You need to either run cmake from the source tree (which would contain CMakeLists.txt), or, more typically, run it from a build folder and tell it where the source tree is.
A common case would be creating a build folder next to the source tree and running cmake ../sourcedir.
You seem to have initially been using a gui; surely that provides a means to set the BOOST_ROOT variable?
Alternatively, if you just put boost in the VC++ include/lib paths (either in the vc dirs, or by setting %INCLUDE%/%LIB%), you probably would not need BOOST_ROOT. Same for OpenSSL.

Cmake error while building OGRE

I am building OGRE source using cmake ../../ogre_src_v1-8-1 in my build directory. I have looked into many similar errors but nothing has worked out for me.
The output of the cmake command mentioned above gives following output:
-- Configuring OGRE 1.8.1
-- Detected g++ 4.8
-- Enabling GCC visibility flags
-- Search path: /home/kamal/Documents/ogre_src_v1-8-1/build/Dependencies;/home/kamal/Documents/ogre_src_v1-8-1/Dependencies;/home/kamal/Documents/ogre_src_v1-8-1/build/../Dependencies;/home/kamal/Documents/ogre_src_v1-8-1/../Dependencies
-- Looking for ZLIB...
-- Found ZLIB: optimized;/usr/lib/x86_64-linux-gnu/libz.so;debug;/usr/lib/x86_64-linux-gnu/libz.so
-- Looking for ZZip...
-- Found ZZip: optimized;/usr/lib/x86_64-linux-gnu/libzzip.so;debug;/usr/lib/x86_64-linux-gnu/libzzip.so
-- Looking for FreeImage...
-- checking for module 'freeimage'
-- package 'freeimage' not found
-- Found FreeImage: optimized;/usr/lib/libfreeimage.so;debug;/usr/lib/libfreeimage.so
-- Looking for FREETYPE...
-- CMAKE_PREFIX_PATH: /home/kamal/Documents/ogre_src_v1-8-1/build/Dependencies;/home/kamal/Documents/ogre_src_v1-8-1/Dependencies;/home/kamal/Documents/ogre_src_v1-8-1/build/../Dependencies;/home/kamal/Documents/ogre_src_v1-8-1/../Dependencies;/usr/local;/usr/lib/x86_64-linux-gnu
-- CMAKE_PREFIX_PATH: /home/kamal/Documents/ogre_src_v1-8-1/build/Dependencies;/home/kamal/Documents/ogre_src_v1-8-1/Dependencies;/home/kamal/Documents/ogre_src_v1-8-1/build/../Dependencies;/home/kamal/Documents/ogre_src_v1-8-1/../Dependencies;/usr/local;/usr/lib/x86_64-linux-gnu
-- Could not locate FREETYPE
-- Looking for Cg...
-- checking for module 'Cg'
-- package 'Cg' not found
-- Found Cg: optimized;/usr/lib/x86_64-linux-gnu/libCg.so;debug;/usr/lib/x86_64-linux-gnu/libCg.so
-- Looking for POCO...
-- checking for module 'POCO'
-- package 'POCO' not found
-- Could not locate POCO
-- Looking for TBB...
-- Found TBB: optimized;/usr/lib/libtbb.so;debug;/usr/lib/libtbb.so
-- Looking for TBB_MALLOC...
-- Found TBB_MALLOC: optimized;/usr/lib/libtbbmalloc.so;debug;/usr/lib/libtbbmalloc.so
-- Looking for TBB_MALLOC_PROXY...
-- Found TBB_MALLOC_PROXY: optimized;/usr/lib/libtbbmalloc_proxy.so;debug;/usr/lib/libtbbmalloc_proxy.so
-- Looking for GLSL_Optimizer...
-- checking for module 'GLSL_Optimizer'
-- package 'GLSL_Optimizer' not found
-- Could not locate GLSL_Optimizer
-- Looking for HLSL2GLSL...
-- checking for module 'HLSL2GLSL'
-- package 'HLSL2GLSL' not found
-- Could not locate HLSL2GLSL
-- Looking for OIS...
-- Found OIS: optimized;/usr/lib/x86_64-linux-gnu/libOIS.so;debug;/usr/lib/x86_64-linux-gnu/libOIS.so
-- Looking for Softimage...
-- Could not locate Softimage
-- Looking for CppUnit...
-- checking for module 'cppunit'
-- package 'cppunit' not found
-- Could not locate CppUnit
CMake Error at CMake/Utils/MacroLogFeature.cmake:100 (MESSAGE):
-----------------------------------------------------------------------------
-- The following REQUIRED packages could NOT be located on your system.
-- Please install them before continuing this software installation.
-- If you are in Windows, try passing -DOGRE_DEPENDENCIES_DIR=<path to dependencies>
-----------------------------------------------------------------------------
+ freetype: Portable font engine <http://www.freetype.org>
-----------------------------------------------------------------------------
Call Stack (most recent call first):
CMake/Dependencies.cmake:234 (MACRO_DISPLAY_FEATURE_LOG)
CMakeLists.txt:194 (include)
-- Configuring incomplete, errors occurred!
How to resolve this issue? Any help shall be appreciated!
It's missing the freetype library which is required for building OGRE. Make sure that the lib itself and the development package is installed on your system.
This might help, the OGRE wiki page with installation instructions for the prerequisites for various linux distros Install OGRE Prerequisite

CMake error when configuring itkvtkglue

My question is similar to Emre's question. I am trying to build the itkImageToVTKImageFilter example from the wiki. I hope to use it for a Gaussian low pass filter that I plan to apply to an image. After I download the itkvtkglue, extract it to a folder, and then press configure in Cmake, I receive the following error message:
Check for working C compiler using: Visual Studio 9 2008
Check for working C compiler using: Visual Studio 9 2008 -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler using: Visual Studio 9 2008
Check for working CXX compiler using: Visual Studio 9 2008 -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
CMake Error at F:/ITK/ItkVtkGlue/bin/UseItkVtkGlue.cmake:10 (include):
include could not find load file:
G:/VTK/UseVTK.cmake
Call Stack (most recent call first):
CMakeLists.txt:13 (include)
Configuring incomplete, errors occurred!
I was not sure what could be causing the error but I suspected that it had something to do with my Windows system path. However, it also seems to be pointing to the correct folder (PATH goes to F: drive). The error indicates that Cmake is looking within G: drive for some unknown reason.
Here is the CMakeLists.txt for itkImageToVTKImageFilter:
cmake_minimum_required(VERSION 2.8)
project(DiscreteGaussianImageFilter)
find_package(ITK REQUIRED)
include(${ITK_USE_FILE})
if (ITKVtkGlue_LOADED)
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
else()
find_package(ItkVtkGlue REQUIRED)
include(${ItkVtkGlue_USE_FILE})
set(Glue ItkVtkGlue)
endif()
add_executable(DiscreteGaussianImageFilter MACOSX_BUNDLE DiscreteGaussianImageFilter.cxx)
target_link_libraries(DiscreteGaussianImageFilter
${Glue} ${VTK_LIBRARIES} ${ITK_LIBRARIES})
I read that this was a very common problem but I am unsure how to correct it. Any help would be greatly appreciated! I am still very new to Stackoverflow so let me know if I need to provide more info.
Works now. I needed to rebuild ITK with ITK_BUILD_ALL_MODULES on as well as checking the Module_ITKVtkGlue which I didn't do before.