Update cmakes to deal with ZLIB in header only mode.

This commit is contained in:
Guillaume Damiand 2016-06-09 15:39:56 +02:00
parent 6e92eafab7
commit a5e04dcfd0
5 changed files with 64 additions and 3 deletions

View File

@ -160,7 +160,8 @@ macro(check_cgal_component COMPONENT)
endif()
else()
if ("${CGAL_LIB}" STREQUAL "CGAL_ImageIO")
find_package( OpenGL )
find_package( OpenGL QUIET )
find_package( ZLIB QUIET )
if(OPENGL_FOUND)
set( ${CGAL_LIB}_FOUND TRUE )

View File

@ -284,6 +284,32 @@ if( NOT CGAL_MACROS_FILE_INCLUDED )
if (${component} STREQUAL "ImageIO")
find_package( OpenGL QUIET )
find_package( ZLIB QUIET )
if (OPENGL_FOUND)
add_definitions("${OPENGL_DEFINITIONS}")
include_directories( SYSTEM "${OPENGL_INCLUDE_DIR}" )
link_directories()
endif(OPENGL_FOUND)
if(ZLIB_FOUND)
cache_set(CGAL_ImageIO_USE_ZLIB "ON")
add_definitions("-DCGAL_USE_ZLIB")
include_directories( SYSTEM ${ZLIB_INCLUDE_DIR} )
endif(ZLIB_FOUND)
if(WITH_VTK)
if( VTK_FOUND )
add_definitions("-DCGAL_USE_VTK")
include_directories( SYSTEM ${VTK_INCLUDE_DIRS} )
link_directories(${vtkImagingCore_RUNTIME_LIBRARY_DIRS} ${vtkImagingCore_LIBRARY_DIRS} ${vtkIOImage_RUNTIME_LIBRARY_DIRS} ${vtkIOImage_LIBRARY_DIRS} ${vtkFiltersImaging_RUNTIME_LIBRARY_DIRS} ${vtkFiltersImaging_LIBRARY_DIRS})
endif()
endif()
endif()
if (${component} STREQUAL "Qt5")
find_package(OpenGL QUIET)
find_package(Qt5 COMPONENTS OpenGL Gui Core Script ScriptTools QUIET)
endif()
else(WITH_CGAL_${component})
@ -307,8 +333,29 @@ if( NOT CGAL_MACROS_FILE_INCLUDED )
####message( STATUS "External library ${component} has not been preconfigured")
if (${component} STREQUAL "ImageIO")
find_package( OpenGL )
find_package( ZLIB )
find_package( OpenGL QUIET )
find_package( ZLIB QUIET )
if (OPENGL_FOUND)
add_definitions("${OPENGL_DEFINITIONS}")
include_directories( SYSTEM "${OPENGL_INCLUDE_DIR}" )
link_directories()
endif(OPENGL_FOUND)
if(ZLIB_FOUND)
cache_set(CGAL_ImageIO_USE_ZLIB "ON")
add_definitions("-DCGAL_USE_ZLIB")
include_directories( SYSTEM ${ZLIB_INCLUDE_DIR} )
endif(ZLIB_FOUND)
if(WITH_VTK)
if( VTK_FOUND )
add_definitions("-DCGAL_USE_VTK")
include_directories( SYSTEM ${VTK_INCLUDE_DIRS} )
link_directories(${vtkImagingCore_RUNTIME_LIBRARY_DIRS} ${vtkImagingCore_LIBRARY_DIRS} ${vtkIOImage_RUNTIME_LIBRARY_DIRS} ${vtkIOImage_LIBRARY_DIRS} ${vtkFiltersImaging_RUNTIME_LIBRARY_DIRS} ${vtkFiltersImaging_LIBRARY_DIRS})
endif()
endif()
endif()
if (${component} STREQUAL "Qt5")

View File

@ -33,6 +33,7 @@ if ( CGAL_FOUND )
create_single_source_cgal_program( "mesh_implicit_domains.cpp" "../examples/Mesh_3/implicit_functions.cpp" )
if( CGAL_ImageIO_USE_ZLIB )
create_single_source_cgal_program( "mesh_3D_image.cpp" )
target_link_libraries(mesh_3D_image ${ZLIB_LIBRARY})
else()
message( STATUS "NOTICE: The example mesh_3D_image.cpp needs CGAL_ImageIO to be configured with ZLIB support, and will not be compiled." )
endif()

View File

@ -81,10 +81,19 @@ if ( CGAL_FOUND )
if( CGAL_ImageIO_USE_ZLIB )
create_single_source_cgal_program( "mesh_optimization_example.cpp" )
target_link_libraries(mesh_optimization_example ${ZLIB_LIBRARY})
create_single_source_cgal_program( "mesh_optimization_lloyd_example.cpp" )
target_link_libraries(mesh_optimization_lloyd_example ${ZLIB_LIBRARY})
create_single_source_cgal_program( "mesh_3D_image.cpp" )
target_link_libraries(mesh_3D_image ${ZLIB_LIBRARY})
create_single_source_cgal_program( "mesh_3D_gray_image.cpp" )
target_link_libraries(mesh_3D_gray_image ${ZLIB_LIBRARY})
create_single_source_cgal_program( "mesh_3D_image_variable_size.cpp" )
target_link_libraries(mesh_3D_image_variable_size ${ZLIB_LIBRARY})
else()
message( STATUS "NOTICE: The examples mesh_3D_image.cpp, mesh_3D_image_variable_size.cpp, mesh_optimization_example.cpp and mesh_optimization_lloyd_example.cpp need CGAL_ImageIO to be configured with ZLIB support, and will not be compiled." )
endif()

View File

@ -39,7 +39,10 @@ if ( CGAL_FOUND )
create_single_source_cgal_program( "test_mesh_criteria_creation.cpp" )
if(CGAL_ImageIO_USE_ZLIB)
create_single_source_cgal_program( "test_meshing_3D_image.cpp" )
target_link_libraries(test_meshing_3D_image ${ZLIB_LIBRARY})
create_single_source_cgal_program( "test_meshing_3D_gray_image.cpp" )
target_link_libraries(test_meshing_3D_gray_image ${ZLIB_LIBRARY})
else()
message(STATUS "test_meshing_3D_image requires the ZLIB library, and will not be compiled.")
endif()