Use cmake find_package for ZLIB and PNG libraries
authorThomas Spurden <thomas.spurden@broadcom.com>
Fri, 25 Oct 2019 10:50:34 +0000 (11:50 +0100)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Wed, 20 Nov 2019 08:34:44 +0000 (03:34 -0500)
This is the standard cmake way to find packages.

Change-Id: I193290c413fe917ceaad47519ababfb435c363cb

CMakeLists.txt

index 4f25138..e0d7d43 100644 (file)
@@ -55,8 +55,10 @@ include_directories(
 include(targets/${DEQP_TARGET}/${DEQP_TARGET}.cmake)
 
 # zlib
-find_path(ZLIB_INCLUDE_PATH    zlib.h)
-find_library(ZLIB_LIBRARY      z)
+find_package(ZLIB)
+# dEQP CMake compatibility (as for libpng)
+set(ZLIB_INCLUDE_PATH ${ZLIB_INCLUDE_DIRS})
+set(ZLIB_LIBRARY ${ZLIB_LIBRARIES})
 
 if (NOT ZLIB_INCLUDE_PATH OR NOT ZLIB_LIBRARY)
        message(STATUS "System version of zlib not found, using external/zlib")
@@ -72,7 +74,7 @@ include_directories(${ZLIB_INCLUDE_PATH})
 # CMake files expect the non-standard PNG_INCLUDE_PATH and PNG_LIBRARY. Set the
 # non-standard variables here to retain compatibility with dEQP's existing
 # CMake files.
-include(FindPNG)
+find_package(PNG)
 set(PNG_INCLUDE_PATH ${PNG_INCLUDE_DIRS})
 set(PNG_LIBRARY ${PNG_LIBRARIES})