I have a CMake project that uses gettext, and have installed gettext on my machine through vcpkg. Running vcpkg install gettext:x64-windows gave me this message:
The package gettext:x86-windows provides CMake targets:
find_package(unofficial-gettext CONFIG REQUIRED)
target_link_libraries(main PRIVATE unofficial::gettext::libintl)
I added that to my CMakeLists.txt file, and when Visual Studio 2017 tries to generate the CMake cache from it, it says:
1> C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2017\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe -G "Ninja" -DCMAKE_INSTALL_PREFIX:PATH="C:\Users\Enno\CMakeBuilds\1f25c7de-1ae7-7131-9c5a-889a4e831935\install\x64-Debug" -DCMAKE_CXX_COMPILER="C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe" -DCMAKE_C_COMPILER="C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe" -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2017\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "C:\Users\Enno\source\repos\echeck" returned with exit code: 1
CMake Error at CMakeLists.txt:8 (find_package):
Could not find a package configuration file provided by
"unofficial-gettext" with any of the following names:
unofficial-gettextConfig.cmake
unofficial-gettext-config.cmake
Add the installation prefix of "unofficial-gettext" to CMAKE_PREFIX_PATH or
set "unofficial-gettext_DIR" to a directory containing one of the above
files. If "unofficial-gettext" provides a separate development package or
SDK, be sure it has been installed.
The file exists as C:\vcpkg\installed\x64-windows\share\unofficial-gettext\unofficial-gettext-config.cmake, though.
I've added this to my CMakeSettings_schema.json, but it made no difference: "cmakeCommandArgs": "-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake",
I've never seen that unofficial::gettext::libintl syntax before, but since the failure already occurs in the find_package command, I assume that's unrelated for now. What is my mistake here?
unofficial::gettext::libintljust means that thelibintlis part of theunofficial::gettext::namespace. You'll find similar names in some other libs as well, e.g.Qt5::Widgetsorboost::unit_test_framework. This shouldn't change anything for you though. Not sure if your toolchain file is supposed to contain this info, but does adding the prefix path change anything:-D 'CMAKE_PREFIX_PATH=C:\vcpkg\installed\x64-windows'?