# CMAKE\_FIND\_LIBRARY\_PREFIXES on older CMake versions

**URL:** <https://discourse.cmake.org/t/cmake-find-library-prefixes-on-older-cmake-versions/6649>\
**Category:** Code\
**Tags:** os:windows\
**Created:** [October 12, 2022, 5:13pm UTC](https://discourse.cmake.org/t/cmake-find-library-prefixes-on-older-cmake-versions/6649 "2022-10-12T17:13:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Scott\_Michel](https://discourse.cmake.org/user_avatar/discourse.cmake.org/scott_michel/32/946_2.png) [@Scott\_Michel](https://discourse.cmake.org/u/Scott_Michel)\
**Post date:** [October 12, 2022, 5:13pm UTC](https://discourse.cmake.org/t/cmake-find-library-prefixes-on-older-cmake-versions/6649/1 "2022-10-12T17:13:23Z")

</div>

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:

```auto
-- 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:

```auto
if (WIN32)
    list(APPEND CMAKE_FIND_LIBRARY_PREFIXES "" "lib")
    list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a")
endif ()

```

What’s the proper workaround/fix?

---

<div class="post-metadata">

**Author:** ![Scott\_Michel](https://discourse.cmake.org/user_avatar/discourse.cmake.org/scott_michel/32/946_2.png) [@Scott\_Michel](https://discourse.cmake.org/u/Scott_Michel)\
**Post date:** [October 12, 2022, 5:50pm UTC](https://discourse.cmake.org/t/cmake-find-library-prefixes-on-older-cmake-versions/6649/2 "2022-10-12T17:50:47Z")

</div>

The backstory for this question: I’ve been building CMake support for the github `open-simh` project (simulators for historic computing systems, e.g., PDP-8, PDP-11, VAXen). The original `simh` maintainer _absolutely insists_ that older versions of CMake and MSVC _have_ to be supported. The closest I can get is using appveyor, which has older MSVC compilers in their image set.
