CMakeLists.txt
changeset 13881 99b265e0d1d0
parent 13349 40742f3f7dd9
child 13906 d4874de4736b
--- a/CMakeLists.txt	Thu Oct 11 23:43:31 2018 +0200
+++ b/CMakeLists.txt	Fri Oct 12 03:40:21 2018 +0200
@@ -27,10 +27,8 @@
 option(BUILD_SHARED_LIBS "Build libraries as shared modules (on)" ON)
 
 if(WIN32 OR APPLE)
-    option(PHYSFS_SYSTEM "Use system physfs (off)" OFF)
     option(LUA_SYSTEM "Use system lua (off)" OFF)
 else()
-    option(PHYSFS_SYSTEM "Use system physfs (on)" ON)
     option(LUA_SYSTEM "Use system lua (on)" ON)
 endif()
 
@@ -61,7 +59,6 @@
     set(BUILD_ENGINE_C ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
     set(BUILD_ENGINE_LIBRARY ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
     set(NOAUTOUPDATE ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
-    set(PHYSFS_SYSTEM OFF CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
     set(LUA_SYSTEM OFF CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
     set(NOVIDEOREC ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
     set(NOSERVER ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
@@ -199,40 +196,32 @@
 
 
 #physfs discovery
-if(PHYSFS_SYSTEM)
-    if(NOT PHYSFS_LIBRARY OR NOT PHYSFS_INCLUDE_DIR)
-        find_package(PhysFS)
-    endif()
-
-    find_file(physfs_h physfs.h ${PHYSFS_INCLUDE_DIR})
-    if(physfs_h)
-        file(STRINGS ${physfs_h} physfs_majorversion REGEX "PHYSFS_VER_MAJOR[\t' ']+[0-9]+")
-        file(STRINGS ${physfs_h} physfs_minorversion REGEX "PHYSFS_VER_MINOR[\t' ']+[0-9]+")
-        file(STRINGS ${physfs_h} physfs_patchversion REGEX "PHYSFS_VER_PATCH[\t' ']+[0-9]+")
-        string(REGEX MATCH "([0-9]+)" physfs_majorversion "${physfs_majorversion}")
-        string(REGEX MATCH "([0-9]+)" physfs_minorversion "${physfs_minorversion}")
-        string(REGEX MATCH "([0-9]+)" physfs_patchversion "${physfs_patchversion}")
-        set(physfs_detected_ver "${physfs_majorversion}.${physfs_minorversion}.${physfs_patchversion}")
+if(NOT PHYSFS_LIBRARY OR NOT PHYSFS_INCLUDE_DIR)
+    find_package(PhysFS)
+endif()
 
-        if(${physfs_detected_ver} VERSION_LESS 2.0.0)
-            message(FATAL_ERROR "PhysFS version is too old (detected ${physfs_detected_ver}, required 2.0.0)\n"
-                                "Perform an update or rerun cmake with -DPHYSFS_SYSTEM=off to build the internal version")
-        endif()
-    endif()
+find_file(physfs_h physfs.h ${PHYSFS_INCLUDE_DIR})
+if(physfs_h)
+    file(STRINGS ${physfs_h} physfs_majorversion REGEX "PHYSFS_VER_MAJOR[\t' ']+[0-9]+")
+    file(STRINGS ${physfs_h} physfs_minorversion REGEX "PHYSFS_VER_MINOR[\t' ']+[0-9]+")
+    file(STRINGS ${physfs_h} physfs_patchversion REGEX "PHYSFS_VER_PATCH[\t' ']+[0-9]+")
+    string(REGEX MATCH "([0-9]+)" physfs_majorversion "${physfs_majorversion}")
+    string(REGEX MATCH "([0-9]+)" physfs_minorversion "${physfs_minorversion}")
+    string(REGEX MATCH "([0-9]+)" physfs_patchversion "${physfs_patchversion}")
+    set(physfs_detected_ver "${physfs_majorversion}.${physfs_minorversion}.${physfs_patchversion}")
 
-    if(PHYSFS_LIBRARY AND PHYSFS_INCLUDE_DIR)
-        #use an IMPORTED tharget so that we can just use 'physfs' to link
-        add_library(physfs UNKNOWN IMPORTED)
-        set_target_properties(physfs PROPERTIES IMPORTED_LOCATION ${PHYSFS_LIBRARY})
-    else()
-        message(FATAL_ERROR "Missing PhysFS! Rerun cmake with -DPHYSFS_SYSTEM=off to build the internal version")
+    if(${physfs_detected_ver} VERSION_LESS 3.0.0)
+        message(FATAL_ERROR "PhysFS version is too old (detected ${physfs_detected_ver}, required 3.0.0)\n"
+                            "Perform an update of PhysFS to fix this.")
     endif()
+endif()
+
+if(PHYSFS_LIBRARY AND PHYSFS_INCLUDE_DIR)
+    #use an IMPORTED tharget so that we can just use 'physfs' to link
+    add_library(physfs UNKNOWN IMPORTED)
+    set_target_properties(physfs PROPERTIES IMPORTED_LOCATION ${PHYSFS_LIBRARY})
 else()
-    if(NOT PHYSFS_LIBRARY OR NOT PHYSFS_INCLUDE_DIR)
-        message(STATUS "PhysFS will be provided by the bundled sources")
-    endif()
-    set(physfs_output_name "hwphysfs")
-    add_subdirectory(misc/libphysfs)
+    message(FATAL_ERROR "Missing PhysFS! Install PhysFS to fix this.")
 endif()
 
 find_package_or_disable_msg(LIBAV NOVIDEOREC "Video recording will not be built")