ref: 2eb722d3a4053eadef3da207c45e644adf17baa8
parent: 42b80fe839535f4f477ff91e300bf06fc7cdc711
author: Alex Mayfield <alexmax2742@gmail.com>
date: Sat May 26 13:12:02 EDT 2018
Link against libpng and libm Tested against Ubuntu 18.04.
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,6 +29,14 @@
find_package(SDL2_mixer 2.0.0)
find_package(SDL2_net 2.0.0)
+# Check for libpng.
+find_package(PNG)
+if(PNG_FOUND)
+ set(HAVE_LIBPNG TRUE)
+endif()
+
+find_package(m)
+
include(CheckFunctionExists)
check_function_exists(strcasecmp HAVE_DECL_STRCASECMP)
check_function_exists(strncasecmp HAVE_DECL_STRNCASECMP)
--- a/config.h.cin
+++ b/config.h.cin
@@ -4,5 +4,6 @@
#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@"
#cmakedefine PROGRAM_PREFIX "@PROGRAM_PREFIX@"
+#cmakedefine01 HAVE_LIBPNG
#cmakedefine01 HAVE_DECL_STRCASECMP
#cmakedefine01 HAVE_DECL_STRNCASECMP
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -106,6 +106,9 @@
set(SOURCE_FILES_WITH_DEH ${SOURCE_FILES} ${DEHACKED_SOURCE_FILES})
set(EXTRA_LIBS textscreen pcsound opl SDL2::SDL2main SDL2::SDL2 SDL2::mixer SDL2::net)
+if(PNG_FOUND)
+ list(APPEND EXTRA_LIBS PNG::PNG)
+endif()
if(WIN32)
add_executable("${PROGRAM_PREFIX}doom" WIN32 ${SOURCE_FILES_WITH_DEH} "${CMAKE_CURRENT_BINARY_DIR}/resource.rc")
--- a/textscreen/CMakeLists.txt
+++ b/textscreen/CMakeLists.txt
@@ -25,4 +25,4 @@
target_include_directories(textscreen
INTERFACE "."
PRIVATE "../src/")
-target_link_libraries(textscreen SDL2::SDL2)
+target_link_libraries(textscreen m SDL2::SDL2)