From 6842c58adc2c882242a39b46fc45c50b32e1921f Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 30 Aug 2019 10:07:09 +0200 Subject: [PATCH] Fix CMake build with Emscripten When building with Emscripten, linkage to libm is neither required nor working. As find_library will fail, M_LIBRARY will be set to NOTFOUND and the build would fail later. The build works just fine without libm linkage. --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c85aa74cf..013f76e9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,7 @@ # Revised by Kyle Bentley, 2018 # Revised by David Callu, 2020 # Revised by Steve Robinson, 2020 +# Revised by Simon Hausmann, 2020 # This code is released under the libpng license. # For conditions of distribution and use, see the disclaimer @@ -45,7 +46,7 @@ if(NOT PNG_BUILD_ZLIB) include_directories(${ZLIB_INCLUDE_DIRS}) endif() -if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU) +if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU AND NOT EMSCRIPTEN) find_library(M_LIBRARY m) else() # libm is not needed and/or not available