I ran into the following while trying to configure a project on appveyor, which has CMake 3.16.2 installed, and independently with CMake 3.18.5:
-- Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_FIND_LIBRARY_PREFIXES
For what’s worth, I downloaded the CMake 3.18.5 zip archive to produce this manually.
The CMakeLists.txt
configures without this issue on CMake 3.23, which is what I usually use. If I set CMAKE_FIND_LIBRARY_PREFIXES
manually for WIN32
, FindPNG doesn’t find the library:
if (WIN32)
list(APPEND CMAKE_FIND_LIBRARY_PREFIXES "" "lib")
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a")
endif ()
What’s the proper workaround/fix?