Tag Archives: Osgearth compilation

[Solved] CMake Error: Could not create named generator Visual Studio 16 2019 -A Win64

Preface
CMake Error: Could not create named generator Visual Studio 16 2019 -A Win64
When using vcpkg to compile OsgEarth, the official compilation method is:
cmake -S osgearth -B build -G “Visual Studio 15 2017 Win64” -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWIN32_USE_MP=ON -DCMAKE_INSTALL_PREFIX=[installroot] -DCMAKE_TOOLCHAIN_FILE=[vcpkgroot]\scripts\buildsystems\vcpkg.cmake


Change the commands below:
cmake -S osgearth -B build -G “Visual Studio 15 2017 Win64” -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWIN32_USE_MP=ON -DCMAKE_INSTALL_PREFIX=[installroot] -DCMAKE_TOOLCHAIN_FILE=[vcpkgroot]\scripts\buildsystems\vcpkg.cmake
to:
cmake -S osgearth -B build -G “Visual Studio 16 2019” -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWIN32_USE_MP=ON -DCMAKE_INSTALL_PREFIX=E:\osgEarth\vcpkg\vcpkg\build -DCMAKE_TOOLCHAIN_FILE=E:\osgEarth\vcpkg\vcpkg\scripts\buildsystems\vcpkg.cmake
That is
(1) Remove Win64
(2) Then change installroot to your OsgEarth generation project path, for example, here is: the path to generate OsgEarth.sln project

(3) Set the path of vcpkg.cmake to
Here: