Cmake not able to find a directory even if it is specified in CmakeSettings.json in visual studio 2022 - windows

I am trying to build a project which requires to have OsgEarth installed from source code and not vcpkg. I build the Osgearth and now I have set the OSGEARTH_DIR (in the CmakeSettings.json) to the place where I build it from the source. I am using visual studio on Windows 11 64 bit. Even after setting ALL the OSGEARTH variables to its appropriate path in CMakeSettings.json (obtained by clicking on Project from the top menu and clicking "CMake Settings for hsave-top-level"), I am getting the following error.
I checked it many times to make sure that the OSGEARTH_INCLUDE_DIR is set to C:/Users/14077/osgearth/install/include but still I am getting this error. I also tried delete cache and reconfigure, but no success. Please help me to resolve this NOTFOUND error.
PS C:\Users\14077\HSA_VE\build> cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=C:/Users/14077/HSA_VE/install -DCMAKE_TOOLCHAIN_FILE=C:/Users/14077/vcpkg/scripts/buildsystems/vcpkg.cmake
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.22000.
CMake Warning (dev) at C:/Users/14077/vcpkg/scripts/buildsystems/vcpkg.cmake:816 (_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.
CMake variable OpenVR_ROOT is set to:
C:/Users/14077/vcpkg/installed/x64-windows
For compatibility, CMake is ignoring the variable.
Call Stack (most recent call first):
src/hsave/CMakeLists.txt:6 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Found the OpenVR
-- Found ZLIB: optimized;C:/Users/14077/vcpkg/installed/x64-windows/lib/zlib.lib;debug;C:/Users/14077/vcpkg/installed/x64-windows/debug/lib/zlibd.lib (found suitable version "1.2.12", minimum required is "1")
-- Found ZLIB: optimized;C:/Users/14077/vcpkg/installed/x64-windows/lib/zlib.lib;debug;C:/Users/14077/vcpkg/installed/x64-windows/debug/lib/zlibd.lib (found version "1.2.12")
-- Reading C:/Users/14077/vcpkg/installed/x64-windows/share/GeoTIFF/geotiff-config.cmake
-- GeoTIFF configuration, version 1.7.1
-- include directory: ${GeoTIFF_INCLUDE_DIRS}
-- ${GeoTIFF_LIBRARIES} set to shared library
-- Found ZLIB: optimized;C:/Users/14077/vcpkg/installed/x64-windows/lib/zlib.lib;debug;C:/Users/14077/vcpkg/installed/x64-windows/debug/lib/zlibd.lib (found suitable version "1.2.12", minimum required is "1")
-- Found ZLIB: optimized;C:/Users/14077/vcpkg/installed/x64-windows/lib/zlib.lib;debug;C:/Users/14077/vcpkg/installed/x64-windows/debug/lib/zlibd.lib (found version "1.2.12")
COMPONENT = openvdb
-- OpenVDB ABI Version: 9
CMake Warning at C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.22/Modules/FindBoost.cmake:1369 (message):
New Boost version may have incorrect or missing dependencies and imported
targets
Call Stack (most recent call first):
C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.22/Modules/FindBoost.cmake:1492 (_Boost_COMPONENT_DEPENDENCIES)
C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.22/Modules/FindBoost.cmake:2102 (_Boost_MISSING_DEPENDENCIES)
C:/Users/14077/vcpkg/installed/x64-windows/share/boost/vcpkg-cmake-wrapper.cmake:11 (_find_package)
C:/Users/14077/vcpkg/scripts/buildsystems/vcpkg.cmake:770 (include)
C:/Users/14077/vcpkg/installed/x64-windows/share/openvdb/FindOpenVDB.cmake:499 (find_package)
C:/Users/14077/vcpkg/installed/x64-windows/share/openvdb/vcpkg-cmake-wrapper.cmake:10 (_find_package)
C:/Users/14077/vcpkg/scripts/buildsystems/vcpkg.cmake:770 (include)
src/VoxelDatabase/CMakeLists.txt:8 (find_package)
CMake Warning at C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.22/Modules/FindBoost.cmake:1369 (message):
New Boost version may have incorrect or missing dependencies and imported
targets
Call Stack (most recent call first):
C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.22/Modules/FindBoost.cmake:1492 (_Boost_COMPONENT_DEPENDENCIES)
C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.22/Modules/FindBoost.cmake:2102 (_Boost_MISSING_DEPENDENCIES)
C:/Users/14077/vcpkg/installed/x64-windows/share/boost/vcpkg-cmake-wrapper.cmake:11 (_find_package)
C:/Users/14077/vcpkg/scripts/buildsystems/vcpkg.cmake:770 (include)
C:/Users/14077/vcpkg/installed/x64-windows/share/openvdb/FindOpenVDB.cmake:499 (find_package)
C:/Users/14077/vcpkg/installed/x64-windows/share/openvdb/vcpkg-cmake-wrapper.cmake:10 (_find_package)
C:/Users/14077/vcpkg/scripts/buildsystems/vcpkg.cmake:770 (include)
src/VoxelDatabase/CMakeLists.txt:8 (find_package)
CMake Warning at C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.22/Modules/FindBoost.cmake:1369 (message):
New Boost version may have incorrect or missing dependencies and imported
targets
Call Stack (most recent call first):
C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.22/Modules/FindBoost.cmake:1492 (_Boost_COMPONENT_DEPENDENCIES)
C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.22/Modules/FindBoost.cmake:2102 (_Boost_MISSING_DEPENDENCIES)
C:/Users/14077/vcpkg/installed/x64-windows/share/boost/vcpkg-cmake-wrapper.cmake:11 (_find_package)
C:/Users/14077/vcpkg/scripts/buildsystems/vcpkg.cmake:770 (include)
C:/Users/14077/vcpkg/installed/x64-windows/share/openvdb/FindOpenVDB.cmake:499 (find_package)
C:/Users/14077/vcpkg/installed/x64-windows/share/openvdb/vcpkg-cmake-wrapper.cmake:10 (_find_package)
C:/Users/14077/vcpkg/scripts/buildsystems/vcpkg.cmake:770 (include)
src/VoxelDatabase/CMakeLists.txt:8 (find_package)
CMake Warning (dev) at C:/Users/14077/vcpkg/scripts/buildsystems/vcpkg.cmake:816 (_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.
CMake variable OpenVR_ROOT is set to:
C:/Users/14077/vcpkg/installed/x64-windows
For compatibility, CMake is ignoring the variable.
Call Stack (most recent call first):
src/voxeldb_seed/CMakeLists.txt:7 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Found the OpenVR
-- 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:
C:/Users/14077/HSA_VE/src/VoxelDatabase/OSGEARTH_INCLUDE_DIR
used as include directory in directory C:/Users/14077/HSA_VE/src/VoxelDatabase
C:/Users/14077/HSA_VE/src/hsave/OSGEARTH_INCLUDE_DIR
used as include directory in directory C:/Users/14077/HSA_VE/src/hsave
C:/Users/14077/HSA_VE/src/voxeldb_seed/OSGEARTH_INCLUDE_DIR
used as include directory in directory C:/Users/14077/HSA_VE/src/voxeldb_seed
OSGEARTH_LIBRARY
linked by target "hsave" in directory C:/Users/14077/HSA_VE/src/hsave
linked by target "VoxelDatabase" in directory C:/Users/14077/HSA_VE/src/VoxelDatabase
linked by target "voxeldb_seed" in directory C:/Users/14077/HSA_VE/src/voxeldb_seed
CMake Error at C:/Users/14077/vcpkg/scripts/buildsystems/vcpkg.cmake:568 (_add_executable):
Cannot find source file:
OSGEARTH_INCLUDE_DIR-NOTFOUND/osgEarth/ImGui/ImGui.cpp
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h
.hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc
Call Stack (most recent call first):
src/hsave/CMakeLists.txt:120 (add_executable)
-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.

It looks like it can't find the ImGui.cpp file that is distributed with osgearth. Make sure you are building the master osgearth and not the 3.2 release, the master distributes the ImGui.cpp headers but 3.2 does not. Also make sure to run the INSTALL target when you build osgEarth so that it copies the headers to the correct location. For building hsave you can also feel free to email my work address and I'll try to help you out.

Related

The C compiler cl.exe is not able to compile a simple test program

I'm trying to set up VTK with cmake visual studio 16 2019 and Qt 6,
But when i try to configure cmake i have the following pb :
Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19042.
The C compiler identification is MSVC 19.28.29337.0
The CXX compiler identification is MSVC 19.28.29337.0
Detecting C compiler ABI info
CMake Error at C:/Program Files/CMake/share/cmake-3.19/Modules/CMakeDetermineCompilerABI.cmake:48 (try_compile):
Failed to open
C:/Users/mathi/Documents/VTK/VTK-9.0.1/build/CMakeFiles/CMakeTmp/CMakeLists.txt
Permission denied
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.19/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)
CMakeLists.txt:19 (project)
Detecting C compiler ABI info - failed
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe
CMake Error at C:/Program Files/CMake/share/cmake-3.19/Modules/CMakeTestCCompiler.cmake:53 (try_compile):
Failed to open
C:/Users/mathi/Documents/VTK/VTK-9.0.1/build/CMakeFiles/CMakeTmp/CMakeLists.txt
Permission denied
Call Stack (most recent call first):
CMakeLists.txt:19 (project)
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.19/Modules/CMakeTestCCompiler.cmake:66 (message):
The C compiler
"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:19 (project)
Configuring incomplete, errors occurred!
See also "C:/Users/mathi/Documents/VTK/VTK-9.0.1/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/mathi/Documents/VTK/VTK-9.0.1/build/CMakeFiles/CMakeError.log".

cmake-gui, What is ZLIB_INCLUDE_DIR error?

I want built OBS with cmake-gui. but "confirgure" is print error.
CMake Error at C:/Program Files/CMake/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find Libx264 (missing: X264_LIB X264_INCLUDE_DIR)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
cmake/Modules/FindLibx264.cmake:62 (find_package_handle_standard_args)
plugins/obs-x264/CMakeLists.txt:3 (find_package)
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:
ZLIB_INCLUDE_DIR (ADVANCED)
used as include directory in directory C:/Users/LHS/Documents/obs/obs-studio/libobs
used as include directory in directory C:/Users/LHS/Documents/obs/obs-studio/libobs
used as include directory in directory C:/Users/LHS/Documents/obs/obs-studio/libobs
How do i do?

CMake can't find Freetype

I'm trying to setup Freetype in my CMakeLists.txt file. (CMake 3.13)
cmake_policy(SET CMP0074 NEW)
find_package(Freetype REQUIRED)
But I got the error message:
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
[cmake] Could NOT find Freetype (missing: FREETYPE_LIBRARY) (found version "2.5.5")
[cmake] Call Stack (most recent call first):
[cmake] C:/Program Files/CMake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
[cmake] C:/Program Files/CMake/share/cmake-3.13/Modules/FindFreetype.cmake:156 (find_package_handle_standard_args)
[cmake] CMakeLists.txt:18 (find_package)
I opened the file of FindFreetype.cmake, it says:
The user may set the environment variable FREETYPE_DIR to the root
directory of a Freetype installation.
so I did.My FREETYPE_DIR is set to MY FOLDER OF\freetype\include, the folder looks like this:
freetype folder
but I got the same error, no difference. (I have quit all cmd windows and my VSCode)
I also set the FREETYPE_ROOT to the same folder, just in case.
So which environment variable should I set?
Do I need to compile the Freetype project? (I only downloaded the source code but have not compiled)

How to use FindGDAL on Windows?

Our program needs gdal, so we got it, and compiled it using their directions. As such, C:\warmerda\bld\include has .h files, C:\warmerda\bld\lib has gdal.lib and gdal_i.lib, and so on.
I have this in my CMakeLists.txt:
set(GDAL_DIR C:/warmerda/bld)
find_package(GDAL REQUIRED)
However, when I run cmake, all I get is this:
$ cmake . -G"Visual Studio 14 2015 Win64"
-- Boost version: 1.59.0
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find GDAL (missing: GDAL_LIBRARY GDAL_INCLUDE_DIR)
Call Stack (most recent call first):
C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/FindGDAL.cmake:116 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
main/CMakeLists.txt:31 (find_package)

cmake cannot find the version of boost 1.59

I want to setup CGAL-4.7 and, in order to do that, i need to install boost. Specifically, i use boost-1.59. Cmake version is 3.4.0. I get the following message:
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/FindBoost.cmake:1247 (message):
Unable to find the requested Boost libraries.
Boost version: 0.0.0
Boost include path: C:/local/boost_1_59_0/boost
Detected version of Boost is too old. Requested version was 1.39 (or
newer).
Call Stack (most recent call first):
cmake/modules/CGAL_SetupBoost.cmake:6 (find_package)
cmake/modules/CGAL_SetupDependencies.cmake:85 (include)
CMakeLists.txt:649 (include)
EDIT
The main error is this:
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/FindBoost.cmake:721
(file): file STRINGS file "C:/local/boost_1_59_0/boost/boost/version.hpp" cannot be read. Call Stack (most recent call first): cmake/modules/CGAL_SetupBoost.cmake:6
(find_package) cmake/modules/CGAL_SetupDependencies.cmake:85(include)
CMakeLists.txt:649 (include)
What could be the problem?

Resources