On Thursday 11 September 2008, Leo Breebaart wrote: > I am having a heck of a time correctly detecting Zlib (and other > libraries) properly on Windows. > > Being a newcomer to both CMake and the wonderful world of Windows > .dll and .lib files I fully expect that I am getting things wrong > left and right, and I am hoping people here are willing to help a > newbie along. > > The goal: > > I want to build a library that itself depends on Zlib, and I want > to build this library in both shared and static variants. > > The Zlib I want to use is a self-compiled version of the standard > www.zlib.net v1.2.3 release, and it can be located anywhere on > the system. > > I would like to keep my solution as generic as I can, and not > just hardcode paths that work on *my* setup. > > > The problems: > > (1) On Windows, FindPackage(ZLIB) does not work because Zlib can > be anywhere. So I wrote the following CMakeLists fragment in > order to either accept a ZLIB_DIR location from the cmake command > line, or from an environment variable, and use that to tweak the > paths for FindPackage:
I would recommend not to add environment variables for that. With cmake >= 2.6.0 you can set CMAKE_PREFIX_PATH to a list of custom directories where cmake should search. Add the install location of your zlib to it, then it should work. I would also suggest not to use a dll/ subdir. Just go with lib/. Then you also don't have to modify CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH anymore. Alex _______________________________________________ CMake mailing list [email protected] http://www.cmake.org/mailman/listinfo/cmake
