cgal/Installation/cmake/modules/CGAL_SetupDependencies.cmake

78 lines
2.5 KiB
CMake

include(CGAL_Macros)
message ( STATUS "External libraries supported: ${CGAL_SUPPORTING_3RD_PARTY_LIRARIES}")
foreach (lib ${CGAL_SUPPORTING_3RD_PARTY_LIRARIES})
# Part 1: Try to find lib
set (vlib "${CGAL_EXT_LIB_${lib}_PREFIX}")
list(FIND CGAL_MANDATORY_3RD_PARTY_LIBRARIES "${lib}" POSITION)
#if ("${POSITION}" STRGREATER "-1" OR WITH_${lib})
if (WITH_${lib})
# message (STATUS "With ${lib} given")
message (STATUS "Preconfiguring library: ${lib} ...")
find_package( ${lib} )
if ( ${vlib}_FOUND )
message( STATUS "${lib} has been preconfigured:")
message( STATUS " CGAL_Use${lib}-file: ${${vlib}_USE_FILE}")
message( STATUS " ${lib} include: ${${vlib}_INCLUDE_DIR}" )
message( STATUS " ${lib} libraries: ${${vlib}_LIBRARIES}" )
message( STATUS " ${lib} definitions: ${${vlib}_DEFINITIONS}" )
# TODO EBEB delete CGAL_USE_${vlib} TRUE here as set in "use_lib" macro, what about Qt3, Qt4, zlib etc?
### set ( CGAL_USE_${vlib} TRUE )
# Part 2: Add some lib-specific definitions or obtain version
if (${lib} STREQUAL "GMP")
if ( MSVC AND NOT CGAL_AUTO_LINK_GMP )
add_to_cached_list(CGAL_3RD_PARTY_DEFINITIONS -DCGAL_NO_AUTOLINK_GMP )
endif()
get_dependency_version(GMP)
endif()
if (${lib} STREQUAL "MPFR")
if ( MSVC AND NOT CGAL_AUTO_LINK_MPFR )
add_to_cached_list(CGAL_3RD_PARTY_DEFINITIONS -DCGAL_NO_AUTOLINK_MPFR )
endif()
set( MPFR_DEPENDENCY_INCLUDE_DIR ${GMP_INCLUDE_DIR} )
set( MPFR_DEPENDENCY_LIBRARIES ${GMP_LIBRARIES} )
get_dependency_version(MPFR)
endif()
if (${lib} STREQUAL "LEDA")
# special case for LEDA - add a flag
message( STATUS "$LEDA cxx flags: ${LEDA_CXX_FLAGS}" )
uniquely_add_flags( CMAKE_CXX_FLAGS ${LEDA_CXX_FLAGS} )
endif()
else()
if ("${POSITION}" STRGREATER "-1")
message( FATAL_ERROR "CGAL requires ${lib} to be found" )
endif()
endif()
endif()
endforeach()
if( (GMP_FOUND AND NOT MPFR_FOUND) OR (NOT GMP_FOUND AND MPFR_FOUND) )
message( FATAL_ERROR "CGAL needs for its full functionality both GMP and MPFR.")
endif()
if( NOT GMP_FOUND )
set(CGAL_NO_CORE ON)
message( STATUS "CGAL_Core needs GMP, cannot be configured.")
endif( NOT GMP_FOUND )
# finally setup Boost
include(CGAL_SetupBoost)