Bläddra i källkod

cmake: build physfshttpd on unix platforms

(sys/socket.h is unavailable on Windows)
Anonymous Maarten 3 månader sedan
förälder
incheckning
ebf45d77d5
2 ändrade filer med 7 tillägg och 0 borttagningar
  1. 6 0
      CMakeLists.txt
  2. 1 0
      extras/physfshttpd.c

+ 6 - 0
CMakeLists.txt

@@ -246,6 +246,12 @@ if(PHYSFS_BUILD_TEST)
         target_compile_definitions(test_physfs PRIVATE PHYSFS_HAVE_READLINE=1)
     endif()
     list(APPEND PHYSFS_INSTALL_TARGETS test_physfs)
+
+    if(UNIX)
+        add_executable(physfshttpd extras/physfshttpd.c)
+        target_link_libraries(physfshttpd PRIVATE PhysFS::PhysFS)
+        sdl_add_warning_options(physfshttpd WARNING_AS_ERROR ${PHYSFS_WERROR})
+    endif()
 endif()
 
 option(PHYSFS_INSTALL "Enable PhysFS installation" ON)

+ 1 - 0
extras/physfshttpd.c

@@ -382,6 +382,7 @@ int main(int argc, char **argv)
         printf("listen socket failed to create.\n");
         return 42;
     } /* if */
+    printf("Listening on port %d\n", portnum);
 
     while (1)  /* infinite loop for now. */
     {