google / liquidfun

2D physics engine for games
http://google.github.io/liquidfun
4.68k stars 641 forks source link

Can't build liquidfun on Ubuntu. #110

Open AmigaBlitter opened 3 years ago

AmigaBlitter commented 3 years ago

Hello everyone,

following the procedure described in the https://google.github.io/liquidfun/Building/html/md__building_linux.html page, cd liquidfun/Box2D cmake -G'Unix Makefiles' make

i get many errors, as follow:

This warning is for project developers. Use -Wno-dev to suppress it.

CMake Error at CMakeLists.txt:158 (set_target_properties): set_target_properties Can not find target to add properties to: X11::X11

CMake Error at CMakeLists.txt:158 (set_target_properties): set_target_properties Can not find target to add properties to: X11::ICE

CMake Error at CMakeLists.txt:158 (set_target_properties): set_target_properties Can not find target to add properties to: X11::SM

CMake Error at CMakeLists.txt:158 (set_target_properties): set_target_properties Can not find target to add properties to: X11::Xau

How can i fix and complete the build?

Thank you very much

jhasse commented 2 years ago

Try this:

diff --git a/liquidfun/Box2D/CMakeLists.txt b/liquidfun/Box2D/CMakeLists.txt
index 4f2461c5..2329bb92 100644
--- a/liquidfun/Box2D/CMakeLists.txt
+++ b/liquidfun/Box2D/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.7)

 project(Box2D)

@@ -99,23 +99,6 @@ if (BOX2D_CODE_COVERAGE AND
   set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${GCOV_FLAGS}")
 endif()

-# The XCode generator ignores CMAKE_C_FLAGS AND CMAKE_CXX_FLAGS so flags
-# need to be added with target properties.
-# The following functions track the list of targets so that it's possible to
-# add flags to all targets using target properties.
-set(ALL_TARGETS "" CACHE INTERNAL "")
-# Override add_library() and adding the target to the ALL_TARGETS variable.
-function(add_library name)
-  _add_library(${name} ${ARGN})
-  set(ALL_TARGETS "${ALL_TARGETS}" "${name}" CACHE INTERNAL "")
-endfunction(add_library)
-
-# Override add_executable() and adding the target to the ALL_TARGETS variable.
-function(add_executable name)
-  _add_executable(${name} ${ARGN})
-  set(ALL_TARGETS "${ALL_TARGETS}" "${name}" CACHE INTERNAL "")
-endfunction(add_executable)
-
 # The Box2D library.
 add_subdirectory(Box2D)

@@ -141,7 +127,7 @@ endif(BOX2D_INSTALL_DOC)

 # Set the warning flags for all targets when using the Xcode generator.
 if(CMAKE_COMPILER_IS_CLANGXX)
-  foreach(target ${ALL_TARGETS})
+  foreach(target ${BUILDSYSTEM_TARGETS})
     set_target_properties(${target} PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS
                           "${C_FLAGS_WARNINGS}")
   endforeach(target)
@@ -161,7 +147,7 @@ endif()
 # Override / reset the output directory for all targets.
 set(LIB_OUTPUT_DIR "${OUTPUT_SUBDIR}")
 set(EXE_OUTPUT_DIR "${OUTPUT_SUBDIR}")
-foreach(target ${ALL_TARGETS})
+foreach(target ${BUILDSYSTEM_TARGETS})
   set_target_properties(
     ${target} PROPERTIES
     ARCHIVE_OUTPUT_DIRECTORY "${LIB_OUTPUT_DIR}"