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

741 views Asked by At

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.
1

There are 1 answers

0
Jason Beverage On

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.