From dc2fb9242a5183e4cedcd8e8b49b8bdbd150a421 Mon Sep 17 00:00:00 2001 From: Eric Berberich Date: Tue, 31 Jan 2012 10:47:45 +0000 Subject: [PATCH] make GMP+MPFR mandatory --- Installation/cmake/modules/CGAL_Macros.cmake | 70 ++++++++++++++++++++ Installation/cmake/modules/UseCGAL.cmake | 69 ++----------------- 2 files changed, 76 insertions(+), 63 deletions(-) diff --git a/Installation/cmake/modules/CGAL_Macros.cmake b/Installation/cmake/modules/CGAL_Macros.cmake index 42b2d5d3b75..83b0db5c1e8 100644 --- a/Installation/cmake/modules/CGAL_Macros.cmake +++ b/Installation/cmake/modules/CGAL_Macros.cmake @@ -262,6 +262,76 @@ if( NOT CGAL_MACROS_FILE_INCLUDED ) endmacro() + + macro( use_component component) + + message (STATUS "CGAL requested component: ${component}") + + if(WITH_CGAL_${component}) + if(TARGET CGAL_${component}) + add_to_list( CGAL_LIBRARIES CGAL_${component} ) + else() + add_to_list( CGAL_LIBRARIES ${CGAL_${component}_LIBRARY} ) + endif() + add_to_list( CGAL_3RD_PARTY_LIBRARIES ${CGAL_${component}_3RD_PARTY_LIBRARIES} ) + + add_to_list( CGAL_3RD_PARTY_INCLUDE_DIRS ${CGAL_${component}_3RD_PARTY_INCLUDE_DIRS} ) + add_to_list( CGAL_3RD_PARTY_DEFINITIONS ${CGAL_${component}_3RD_PARTY_DEFINITIONS} ) + add_to_list( CGAL_3RD_PARTY_LIBRARIES_DIRS ${CGAL_${component}_3RD_PARTY_LIBRARIES_DIRS} ) + + # TODO EBEB: What about GMP, MPFR, zlib used in other libCGALxyz + if (${component} STREQUAL "Qt3") + find_package( Qt3-patched ) + endif() + + if (${component} STREQUAL "Qt4") + find_package( Qt4 ) + endif() + + else(WITH_CGAL_${component}) + + # now we are talking about 3rd party libs + + if ( ${component} STREQUAL "ALL_PRECONFIGURED_LIBS" ) + + if (CGAL_ALLOW_ALL_PRECONFIGURED_LIBS_COMPONENT) + message( STATUS "External libraries are all used") + foreach ( CGAL_3RD_PARTY_LIB ${CGAL_SUPPORTING_3RD_PARTY_LIRARIES}) + if (${CGAL_3RD_PARTY_LIB}_FOUND) + use_lib( ${CGAL_3RD_PARTY_LIB} "###${${CGAL_3RD_PARTY_LIB}_USE_FILE}") + endif() + endforeach() + else() + message( SEND_ERROR "Component ALL_PRECONFIGURED_LIBS only allow with CGAL_ALLOW_ALL_PRECONFIGURED_LIBS_COMPONENT=ON") + endif() + + else() + + set( vlib "${CGAL_EXT_LIB_${component}_PREFIX}" ) + + if ( ${vlib}_FOUND) + + message( STATUS "External library ${component} has been preconfigured") + use_lib( ${component} "###${${vlib}_USE_FILE}") + + else() + + message( STATUS "External library ${component} has not been preconfigured") + find_package( ${component} ) + message( STATUS "External library ${vlib} after find") + if (${vlib}_FOUND) + use_lib( ${component} "###${${vlib}_USE_FILE}") + endif() + + endif() + + endif() + + endif(WITH_CGAL_${component}) + + endmacro() + + function( cgal_setup_module_path ) # Avoid to modify the modules path twice if(NOT CGAL_MODULE_PATH_IS_SET) diff --git a/Installation/cmake/modules/UseCGAL.cmake b/Installation/cmake/modules/UseCGAL.cmake index bb1fbf8c388..e15382bb9cc 100644 --- a/Installation/cmake/modules/UseCGAL.cmake +++ b/Installation/cmake/modules/UseCGAL.cmake @@ -21,72 +21,15 @@ if(NOT USE_CGAL_FILE_INCLUDED) set( CGAL_LIBRARIES ) - foreach ( CGAL_COMPONENT ${CGAL_REQUESTED_COMPONENTS} ) - message (STATUS "CGAL requested component: ${CGAL_COMPONENT}") + foreach ( component ${CGAL_REQUESTED_COMPONENTS} ) - if(WITH_CGAL_${CGAL_COMPONENT}) - if(TARGET CGAL_${CGAL_COMPONENT}) - add_to_list( CGAL_LIBRARIES CGAL_${CGAL_COMPONENT} ) - else() - add_to_list( CGAL_LIBRARIES ${CGAL_${CGAL_COMPONENT}_LIBRARY} ) - endif() - add_to_list( CGAL_3RD_PARTY_LIBRARIES ${CGAL_${CGAL_COMPONENT}_3RD_PARTY_LIBRARIES} ) - - add_to_list( CGAL_3RD_PARTY_INCLUDE_DIRS ${CGAL_${CGAL_COMPONENT}_3RD_PARTY_INCLUDE_DIRS} ) - add_to_list( CGAL_3RD_PARTY_DEFINITIONS ${CGAL_${CGAL_COMPONENT}_3RD_PARTY_DEFINITIONS} ) - add_to_list( CGAL_3RD_PARTY_LIBRARIES_DIRS ${CGAL_${CGAL_COMPONENT}_3RD_PARTY_LIBRARIES_DIRS} ) - - # TODO EBEB: What about GMP, MPFR, zlib used in other libCGALxyz - if (${CGAL_COMPONENT} STREQUAL "Qt3") - find_package( Qt3-patched ) - endif() - - if (${CGAL_COMPONENT} STREQUAL "Qt4") - find_package( Qt4 ) - endif() - - else(WITH_CGAL_${CGAL_COMPONENT}) - - # now we are talking about 3rd party libs - - if ( ${CGAL_COMPONENT} STREQUAL "ALL_PRECONFIGURED_LIBS" ) - - if (CGAL_ALLOW_ALL_PRECONFIGURED_LIBS_COMPONENT) - message( STATUS "External libraries are all used") - foreach ( CGAL_3RD_PARTY_LIB ${CGAL_SUPPORTING_3RD_PARTY_LIRARIES}) - if (${CGAL_3RD_PARTY_LIB}_FOUND) - use_lib( ${CGAL_3RD_PARTY_LIB} "###${${CGAL_3RD_PARTY_LIB}_USE_FILE}") - endif() - endforeach() - else() - message( SEND_ERROR "Component ALL_PRECONFIGURED_LIBS only allow with CGAL_ALLOW_ALL_PRECONFIGURED_LIBS_COMPONENT=ON") - endif() - - else() - - set( vlib "${CGAL_EXT_LIB_${CGAL_COMPONENT}_PREFIX}" ) - - if ( ${vlib}_FOUND) - - message( STATUS "External library ${CGAL_COMPONENT} has been preconfigured") - use_lib( ${CGAL_COMPONENT} "###${${vlib}_USE_FILE}") - - else() - - message( STATUS "External library ${CGAL_COMPONENT} has not been preconfigured") - find_package( ${CGAL_COMPONENT} ) - message( STATUS "External library ${vlib} after find") - if (${vlib}_FOUND) - use_lib( ${CGAL_COMPONENT} "###${${vlib}_USE_FILE}") - endif() - - endif() - - endif() - - endif(WITH_CGAL_${CGAL_COMPONENT}) + use_component( ${component} ) endforeach() + + # these two are mandatory + use_component( GMP ) + use_component( MPFR ) include_directories( "${CMAKE_CURRENT_BINARY_DIR}" )