mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 09:23:03 -04:00
CMake: Make FindODE link against libccd when present
This fixes building against the macOS/Homebrew version of ODE.
This commit is contained in:
parent
7f8d7366dc
commit
f59c6bb2bf
@ -21,44 +21,46 @@
|
|||||||
# ODE::ODE_double - If available, this links against double-precision ODE
|
# ODE::ODE_double - If available, this links against double-precision ODE
|
||||||
#
|
#
|
||||||
|
|
||||||
if(NOT ODE_INCLUDE_DIR OR NOT ODE_LIBRARY_DIR)
|
# Find the libode include files
|
||||||
# Find the libode include files
|
find_path(ODE_INCLUDE_DIR "ode/ode.h")
|
||||||
find_path(ODE_INCLUDE_DIR "ode/ode.h")
|
|
||||||
|
|
||||||
# Find the libode library built for release
|
# Find the libode library built for release
|
||||||
find_library(ODE_RELEASE_LIBRARY
|
find_library(ODE_RELEASE_LIBRARY
|
||||||
NAMES "ode" "libode")
|
NAMES "ode" "libode")
|
||||||
|
|
||||||
# Find the libode library built for debug
|
# Find the libode library built for debug
|
||||||
find_library(ODE_DEBUG_LIBRARY
|
find_library(ODE_DEBUG_LIBRARY
|
||||||
NAMES "oded" "liboded")
|
NAMES "oded" "liboded")
|
||||||
|
|
||||||
# Find the single-precision library built for release
|
# Find the single-precision library built for release
|
||||||
find_library(ODE_SINGLE_RELEASE_LIBRARY
|
find_library(ODE_SINGLE_RELEASE_LIBRARY
|
||||||
NAMES "ode_single" "libode_single")
|
NAMES "ode_single" "libode_single")
|
||||||
|
|
||||||
# Find the single-precision library built for debug
|
# Find the single-precision library built for debug
|
||||||
find_library(ODE_SINGLE_DEBUG_LIBRARY
|
find_library(ODE_SINGLE_DEBUG_LIBRARY
|
||||||
NAMES "ode_singled" "libode_singled")
|
NAMES "ode_singled" "libode_singled")
|
||||||
|
|
||||||
# Find the double-precision library built for release
|
# Find the double-precision library built for release
|
||||||
find_library(ODE_DOUBLE_RELEASE_LIBRARY
|
find_library(ODE_DOUBLE_RELEASE_LIBRARY
|
||||||
NAMES "ode_double" "libode_double" )
|
NAMES "ode_double" "libode_double")
|
||||||
|
|
||||||
# Find the double-precision library built for debug
|
# Find the double-precision library built for debug
|
||||||
find_library(ODE_DOUBLE_DEBUG_LIBRARY
|
find_library(ODE_DOUBLE_DEBUG_LIBRARY
|
||||||
NAMES "ode_doubled" "libode_doubled")
|
NAMES "ode_doubled" "libode_doubled")
|
||||||
|
|
||||||
unset(_ODE_LIB_PATHS)
|
# Find libccd, which ODE sometimes links against, so we want to let the linker
|
||||||
|
# know about it if it's present.
|
||||||
|
find_library(ODE_LIBCCD_LIBRARY
|
||||||
|
NAMES "ccd" "libccd")
|
||||||
|
|
||||||
mark_as_advanced(ODE_INCLUDE_DIR)
|
mark_as_advanced(ODE_INCLUDE_DIR)
|
||||||
mark_as_advanced(ODE_RELEASE_LIBRARY)
|
mark_as_advanced(ODE_RELEASE_LIBRARY)
|
||||||
mark_as_advanced(ODE_DEBUG_LIBRARY)
|
mark_as_advanced(ODE_DEBUG_LIBRARY)
|
||||||
mark_as_advanced(ODE_SINGLE_RELEASE_LIBRARY)
|
mark_as_advanced(ODE_SINGLE_RELEASE_LIBRARY)
|
||||||
mark_as_advanced(ODE_SINGLE_DEBUG_LIBRARY)
|
mark_as_advanced(ODE_SINGLE_DEBUG_LIBRARY)
|
||||||
mark_as_advanced(ODE_DOUBLE_RELEASE_LIBRARY)
|
mark_as_advanced(ODE_DOUBLE_RELEASE_LIBRARY)
|
||||||
mark_as_advanced(ODE_DOUBLE_DEBUG_LIBRARY)
|
mark_as_advanced(ODE_DOUBLE_DEBUG_LIBRARY)
|
||||||
endif()
|
mark_as_advanced(ODE_LIBCCD_LIBRARY)
|
||||||
|
|
||||||
# Define targets for both precisions (and unspecified)
|
# Define targets for both precisions (and unspecified)
|
||||||
foreach(_precision _single _double "")
|
foreach(_precision _single _double "")
|
||||||
@ -72,6 +74,11 @@ foreach(_precision _single _double "")
|
|||||||
set_target_properties(ODE::ODE${_precision} PROPERTIES
|
set_target_properties(ODE::ODE${_precision} PROPERTIES
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "${ODE_INCLUDE_DIR}")
|
INTERFACE_INCLUDE_DIRECTORIES "${ODE_INCLUDE_DIR}")
|
||||||
|
|
||||||
|
if(ODE_LIBCCD_LIBRARY)
|
||||||
|
set_target_properties(ODE::ODE${_precision} PROPERTIES
|
||||||
|
INTERFACE_LINK_LIBRARIES "${ODE_LIBCCD_LIBRARY}")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(EXISTS "${ODE${_PRECISION}_RELEASE_LIBRARY}")
|
if(EXISTS "${ODE${_PRECISION}_RELEASE_LIBRARY}")
|
||||||
set_property(TARGET ODE::ODE${_precision} APPEND PROPERTY
|
set_property(TARGET ODE::ODE${_precision} APPEND PROPERTY
|
||||||
IMPORTED_CONFIGURATIONS RELEASE)
|
IMPORTED_CONFIGURATIONS RELEASE)
|
||||||
@ -121,6 +128,7 @@ if(NOT TARGET ODE::ODE)
|
|||||||
foreach(_prop
|
foreach(_prop
|
||||||
INTERFACE_INCLUDE_DIRECTORIES
|
INTERFACE_INCLUDE_DIRECTORIES
|
||||||
INTERFACE_COMPILE_DEFINITIONS
|
INTERFACE_COMPILE_DEFINITIONS
|
||||||
|
INTERFACE_LINK_LIBRARIES
|
||||||
IMPORTED_CONFIGURATIONS
|
IMPORTED_CONFIGURATIONS
|
||||||
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE
|
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE
|
||||||
IMPORTED_LOCATION_RELEASE
|
IMPORTED_LOCATION_RELEASE
|
||||||
@ -128,11 +136,12 @@ if(NOT TARGET ODE::ODE)
|
|||||||
IMPORTED_LOCATION_DEBUG)
|
IMPORTED_LOCATION_DEBUG)
|
||||||
|
|
||||||
get_target_property(_value "${_copy_from}" "${_prop}")
|
get_target_property(_value "${_copy_from}" "${_prop}")
|
||||||
if(DEFINED _value)
|
if(_value)
|
||||||
set_target_properties(ODE::ODE PROPERTIES "${_prop}" "${_value}")
|
set_target_properties(ODE::ODE PROPERTIES "${_prop}" "${_value}")
|
||||||
endif()
|
endif()
|
||||||
unset(_value)
|
unset(_value)
|
||||||
endforeach(_prop)
|
endforeach(_prop)
|
||||||
|
unset(_prop)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
unset(_copy_from)
|
unset(_copy_from)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user