THRIFT-3442 Run CMake tests on Appveyor
Client: Test
Patch: Nobuaki Sukegawa
This closes #713
diff --git a/build/cmake/DefineOptions.cmake b/build/cmake/DefineOptions.cmake
index 8f7659e..4fb086c 100644
--- a/build/cmake/DefineOptions.cmake
+++ b/build/cmake/DefineOptions.cmake
@@ -49,6 +49,10 @@
# but in future other libraries might reuse them.
# So they are not dependent on WITH_CPP but setting them without WITH_CPP currently
# has no effect.
+if(ZLIB_LIBRARY)
+ # FindZLIB.cmake does not normalize path so we need to do it ourselves.
+ file(TO_CMAKE_PATH ${ZLIB_LIBRARY} ZLIB_LIBRARY)
+endif()
find_package(ZLIB QUIET)
CMAKE_DEPENDENT_OPTION(WITH_ZLIB "Build with ZLIB support" ON
"ZLIB_FOUND" OFF)
diff --git a/build/cmake/FindLibevent.cmake b/build/cmake/FindLibevent.cmake
index 1eac315..2bcd709 100644
--- a/build/cmake/FindLibevent.cmake
+++ b/build/cmake/FindLibevent.cmake
@@ -6,14 +6,16 @@
# LIBEVENT_LIBRARIES, LibEvent libraries
# Libevent_FOUND, If false, do not try to use libevent
-set(LibEvent_EXTRA_PREFIXES /usr/local /opt/local "$ENV{HOME}")
+set(LIBEVENT_ROOT CACHE PATH "Root directory of libevent installation")
+set(LibEvent_EXTRA_PREFIXES /usr/local /opt/local "$ENV{HOME}" ${LIBEVENT_ROOT})
foreach(prefix ${LibEvent_EXTRA_PREFIXES})
list(APPEND LibEvent_INCLUDE_PATHS "${prefix}/include")
list(APPEND LibEvent_LIBRARIES_PATHS "${prefix}/lib")
endforeach()
find_path(LIBEVENT_INCLUDE_DIRS event.h PATHS ${LibEvent_INCLUDE_PATHS})
-find_library(LIBEVENT_LIBRARIES NAMES event PATHS ${LibEvent_LIBRARIES_PATHS})
+# "lib" prefix is needed on Windows
+find_library(LIBEVENT_LIBRARIES NAMES event libevent PATHS ${LibEvent_LIBRARIES_PATHS})
if (LIBEVENT_LIBRARIES AND LIBEVENT_INCLUDE_DIRS)
set(Libevent_FOUND TRUE)