Description
What version of protobuf and what language are you using?
Version: main
Language: C++
What operating system (Linux, Windows, ...) and version?
Windows 11 24H2
What runtime / compiler are you using (e.g., python version or gcc version)
cmake 3.30.5
msvc 19.41.34123.0
What did you do?
Steps to reproduce the behavior:
find_package(Protobuf CONFIG)
Configure CMake using '--warn-uninitialized'
What did you expect to see
No warnings/errors
What did you see instead?
CMake Error (dev) vcpkg_installed/x64-windows-target/share/protobuf/protobuf-config-version.cmake:7 (set):
uninitialized variable 'Protobuf_FIND_VERSION_PRERELEASE'
Call Stack (most recent call first):
vcpkg_installed/x64-windows-target/share/protobuf/vcpkg-cmake-wrapper.cmake:3 (_find_package)
cmake/tools/VCPkg/scripts/buildsystems/vcpkg.cmake:811 (include)
CMake Error (dev) at vcpkg_installed/x64-windows-target/share/protobuf/protobuf-config-version.cmake:11 (set):
uninitialized variable 'Protobuf_FIND_VERSION_PRERELEASE'
Call Stack (most recent call first):
vcpkg_installed/x64-windows-target/share/protobuf/vcpkg-cmake-wrapper.cmake:3 (_find_package)
cmake/tools/VCPkg/scripts/buildsystems/vcpkg.cmake:811 (include)
CMake Error (dev) at vcpkg_installed/x64-windows-target/share/protobuf/protobuf-module.cmake:188 (set):
uninitialized variable 'Protobuf_SRC_ROOT_FOLDER'
Call Stack (most recent call first):
vcpkg_installed/x64-windows-target/share/protobuf/protobuf-config.cmake:21 (include)
vcpkg_installed/x64-windows-target/share/protobuf/vcpkg-cmake-wrapper.cmake:3 (_find_package)
cmake/tools/VCPkg/scripts/buildsystems/vcpkg.cmake:811 (include)
// Same error for:
// Protobuf_IMPORT_DIRS
// Protobuf_DEBUG
// Protobuf_INCLUDE_DIR
// Protobuf_LIBRARY_DEBUG
// Protobuf_PROTOC_LIBRARY_DEBUG
// Protobuf_LITE_LIBRARY_DEBUG
Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).
The first two warnings are related to #1778. However, that change failed to correct the similar variable dereference in the subsequent 'set'.
# Prerelease versions cannot be passed in directly via the find_package command,
# so we allow users to specify it in a variable
if(NOT DEFINED "${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE") // fixed
set("${${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE}" "") // not fixed
else()
The remaining warnings are due to the camel case to uppercase conversion dereferencing variables that weren't set.
string(TOUPPER ${Camel} UPPER)
set(${UPPER} ${${Camel}}) // No check that ${Camel} is defined
Anything else we should know about your project / environment