diff --git a/Installation/cmake/modules/CGALConfig_binary.cmake.in b/Installation/cmake/modules/CGALConfig_binary.cmake.in index 543e3f95fe2..8c265048d6e 100644 --- a/Installation/cmake/modules/CGALConfig_binary.cmake.in +++ b/Installation/cmake/modules/CGALConfig_binary.cmake.in @@ -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 ) diff --git a/Installation/cmake/modules/CGAL_Macros.cmake b/Installation/cmake/modules/CGAL_Macros.cmake index 69dd0dad606..a4d721c417a 100644 --- a/Installation/cmake/modules/CGAL_Macros.cmake +++ b/Installation/cmake/modules/CGAL_Macros.cmake @@ -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") diff --git a/Mesh_3/applications/CMakeLists.txt b/Mesh_3/applications/CMakeLists.txt index 7324e7ef359..4ee0572a9ec 100644 --- a/Mesh_3/applications/CMakeLists.txt +++ b/Mesh_3/applications/CMakeLists.txt @@ -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() diff --git a/Mesh_3/examples/Mesh_3/CMakeLists.txt b/Mesh_3/examples/Mesh_3/CMakeLists.txt index 2f1baa95d69..99c63f93150 100644 --- a/Mesh_3/examples/Mesh_3/CMakeLists.txt +++ b/Mesh_3/examples/Mesh_3/CMakeLists.txt @@ -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() diff --git a/Mesh_3/test/Mesh_3/CMakeLists.txt b/Mesh_3/test/Mesh_3/CMakeLists.txt index 47a766b7d45..e502792e3d7 100644 --- a/Mesh_3/test/Mesh_3/CMakeLists.txt +++ b/Mesh_3/test/Mesh_3/CMakeLists.txt @@ -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()