I've installed osgearth package with vcpkg with following command:
vcpkg.exe install osgearth:x64-windows
Now in a CMake I want to use it.
cmake_minimum_required (VERSION 3.10.0)
project (osgmap)
add_definitions (-DOSGMAP_EXPORTS)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/..)
find_package (Osg REQUIRED)
find_package(OsgEarth REQUIRED)
set (PROJECT_SRC
Dummy.cpp
)
add_library (${PROJECT_NAME} SHARED ${PROJECT_SRC})
target_link_libraries (${PROJECT_NAME} mapapi)
target_compile_features (${PROJECT_NAME} PUBLIC cxx_std_17)
The problem is that I cannot find osgearth package. I've tried different options.
How can I use OsgEarth installed with vcpkg in a CMake project?
The short answer is there are findosg* modules in the cmake distribution and there are not any osgEarth modules to automatically find package paths. Package is either a config or module definition locating both the libs and includes. Vcpkg does not seem to automate package definition and it relies on the modules installed with CMake. What is possible is using
find_libraryandfind_pathto locate the osgearth files.assuming you ran vcpkg integrate and use the
-DCMAKE_TOOLCHAIN_FILEwith cmake. All the libs that were built with vcpkg can be found but not all as packages.