mirror of
https://github.com/google/brotli.git
synced 2026-07-08 17:56:58 +00:00
Unknown CMake command "_add_library". #449
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @eehlers on GitHub (Mar 22, 2023).
Configuration of my project fails with:
CMake Error at C:/repos/vcpkg/packages/brotli_x64-windows/share/unofficial-brotli/unofficial-brotli-config.cmake:5 (_add_library):
Unknown CMake command "_add_library".
What am I doing wrong?
I fixed it temporarily by hacking the above mentioned file and deleting the leading underscore from "_add_library".
@nimcomputing commented on GitHub (Apr 6, 2023):
I believe the issue is with the vcpkg port of Brotli rather than Brotli itself: https://github.com/microsoft/vcpkg/tree/master/ports/brotli
Seems to be a typo in the file unofficial-brotli-config.cmake
I'm using a hacky work-around in my projects using Brotli from vcpkg with this in my CMakeLists.txt file:
Raised this issue against the Brotli port on the Vcpkg repo.
@eehlers commented on GitHub (Apr 18, 2023):
Thank you!
It seems that when you redefine a cmake function, the original function gets renamed with a leading underscore.
brotlivcpkg redefines add_library which explains the call to _add_library. I see the response to the ticket you raised over on the other repo. It seems that the error arises because I am not calling unofficial-brotli-config.cmake in the way that it wants to be called but I do not understand their explanation so for now I am still stuck with my local hack.Edit: Following their advice, I cleared the cache, and now it is working. Many thanks again for your thorough followup!
@eustas commented on GitHub (Jun 20, 2023):
Thanks for investigating / checking!