From b52c7a09e93300db875e33c2a4be0d4c01d206e7 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 24 Sep 2008 10:32:44 +0000 Subject: [PATCH] - Fix soname and soversion of libraries (they were exchanged). - Make get_dependency_version found the print_${LIB}_version.cpp, even if the lib is compiled separately. - Rename FindQt3.cmake to FindQt3-patched.cmake and Qt3Macros to Qt3Macros-patched. - Make CGAL-Qt3 compilable separately. - Fix all commited CMakeLists.txt: - use Qt3-patched and Qt3Macros-patched, and s/QT_/QT3_/ - add a comment about FindQt3-patched, - wrap target creation with if(CGAL_FOUND AND QT3_FOUND)/else/endif - Modified cgal_create_cmake_script --- .gitattributes | 4 +- .../demo/Alpha_shapes_2/CMakeLists.txt | 39 ++++--- .../demo/Apollonius_graph_2/CMakeLists.txt | 39 ++++--- .../Arrangement_on_surface_2/CMakeLists.txt | 38 ++++--- .../Boolean_set_operations_2/CMakeLists.txt | 35 +++--- CGALimageIO/src/CGALimageIO/CMakeLists.txt | 2 +- Core/src/CGALCore/CMakeLists.txt | 2 +- GraphicsView/src/CGALQt4/CMakeLists.txt | 21 +--- Installation/cmake/modules/CGALcommon.cmake | 2 +- .../CreateSingleSourceCGALQt3Program.cmake | 6 +- .../{FindQt3.cmake => FindQt3-patched.cmake} | 0 ...t3Macros.cmake => Qt3Macros-patched.cmake} | 0 Installation/src/CGAL/CMakeLists.txt | 2 +- Mesh_2/demo/Mesh_2/CMakeLists.txt | 48 +++++++++ Nef_3/demo/Nef_3/CMakeLists.txt | 21 ++-- PDB/src/CGALPDB/CMakeLists.txt | 2 +- Qt_widget/src/CGALQt/CMakeLists.txt | 27 +++-- Scripts/scripts/cgal_create_cmake_script | 102 +++++++++--------- 18 files changed, 244 insertions(+), 146 deletions(-) rename Installation/cmake/modules/{FindQt3.cmake => FindQt3-patched.cmake} (100%) rename Installation/cmake/modules/{Qt3Macros.cmake => Qt3Macros-patched.cmake} (100%) create mode 100644 Mesh_2/demo/Mesh_2/CMakeLists.txt diff --git a/.gitattributes b/.gitattributes index 7ee9d9a5496..8ab654cd890 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1660,13 +1660,13 @@ Installation/cmake/modules/FindMPFR.cmake -text Installation/cmake/modules/FindOpenGL.cmake -text Installation/cmake/modules/FindPackageHandleStandardArgs.cmake -text Installation/cmake/modules/FindQGLViewer.cmake -text -Installation/cmake/modules/FindQt3.cmake -text +Installation/cmake/modules/FindQt3-patched.cmake -text Installation/cmake/modules/FindTAUCS.cmake -text Installation/cmake/modules/GeneratorSpecificSettings.cmake -text Installation/cmake/modules/MacroFindOptionalCGALDependency.cmake -text Installation/cmake/modules/MacroOptionalFindPackage.cmake -text Installation/cmake/modules/OptionalAddSubdirectory.cmake -text -Installation/cmake/modules/Qt3Macros.cmake -text +Installation/cmake/modules/Qt3Macros-patched.cmake -text Installation/cmake/modules/UseCGAL.cmake -text Installation/config/support/S05-BOOST -text Installation/config/support/S06a-BOOST_PROGRAM_OPTIONS -text diff --git a/Alpha_shapes_2/demo/Alpha_shapes_2/CMakeLists.txt b/Alpha_shapes_2/demo/Alpha_shapes_2/CMakeLists.txt index 8bfaac8e4a0..a9bcf88e275 100644 --- a/Alpha_shapes_2/demo/Alpha_shapes_2/CMakeLists.txt +++ b/Alpha_shapes_2/demo/Alpha_shapes_2/CMakeLists.txt @@ -9,21 +9,32 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) find_package(CGAL REQUIRED Qt3 ) include( ${CGAL_USE_FILE} ) -find_package(Qt3 REQUIRED) +find_package(Qt3-patched QUIET) +# FindQt3-patched.cmake is FindQt3.cmake patched by CGAL developers, so +# that it can be used together with FindQt4: all its variables are prefixed +# by "QT3_" instead of "QT_". -# use the Qt MOC preprocessor on classes that derives from QObject -include( Qt3Macros ) -qt3_generate_moc( Qt_widget_move_point.h Qt_widget_move_point.moc ) -qt3_generate_moc( Qt_widget_toolbar.h Qt_widget_toolbar.moc ) -qt3_generate_moc( Qt_widget_toolbar_layers.h Qt_widget_toolbar_layers.moc ) -qt3_generate_moc( alpha_shapes_2.cpp alpha_shapes_2.moc ) +if ( CGAL_FOUND AND QT3_FOUND ) + + # use the Qt MOC preprocessor on classes that derives from QObject + include( Qt3Macros-patched ) + qt3_generate_moc( Qt_widget_move_point.h Qt_widget_move_point.moc ) + qt3_generate_moc( Qt_widget_toolbar.h Qt_widget_toolbar.moc ) + qt3_generate_moc( Qt_widget_toolbar_layers.h Qt_widget_toolbar_layers.moc ) + qt3_generate_moc( alpha_shapes_2.cpp alpha_shapes_2.moc ) -# The executable itself. -add_executable ( alpha_shapes_2 - alpha_shapes_2.cpp alpha_shapes_2.moc - Qt_widget_move_point.cpp Qt_widget_move_point.moc - Qt_widget_toolbar.cpp Qt_widget_toolbar.moc - Qt_widget_toolbar_layers.cpp Qt_widget_toolbar_layers.moc ) + # The executable itself. + add_executable ( alpha_shapes_2 + alpha_shapes_2.cpp alpha_shapes_2.moc + Qt_widget_move_point.cpp Qt_widget_move_point.moc + Qt_widget_toolbar.cpp Qt_widget_toolbar.moc + Qt_widget_toolbar_layers.cpp Qt_widget_toolbar_layers.moc ) -target_link_libraries( alpha_shapes_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) + target_link_libraries( alpha_shapes_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) + +else() + + message(STATUS "NOTICE: This demo requires CGAL and Qt3, and will not be compiled.") + +endif() diff --git a/Apollonius_graph_2/demo/Apollonius_graph_2/CMakeLists.txt b/Apollonius_graph_2/demo/Apollonius_graph_2/CMakeLists.txt index 42f4b74c0d1..60ddb273683 100644 --- a/Apollonius_graph_2/demo/Apollonius_graph_2/CMakeLists.txt +++ b/Apollonius_graph_2/demo/Apollonius_graph_2/CMakeLists.txt @@ -9,22 +9,33 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) find_package(CGAL REQUIRED Qt3 ) include( ${CGAL_USE_FILE} ) -find_package(Qt3 REQUIRED) +find_package(Qt3-patched QUIET) +# FindQt3-patched.cmake is FindQt3.cmake patched by CGAL developers, so +# that it can be used together with FindQt4: all its variables are prefixed +# by "QT3_" instead of "QT_". -include_directories (BEFORE ./include) +if ( CGAL_FOUND AND QT3_FOUND ) -# use the Qt MOC preprocessor on classes that derives from QObject -include( Qt3Macros ) -qt3_generate_moc( apollonius_graph_2.cpp apollonius_graph_2.moc ) -qt3_generate_moc( qt_file_toolbar.h qt_file_toolbar.moc ) -qt3_generate_moc( qt_layers_toolbar.h qt_layers_toolbar.moc ) -qt3_generate_moc( edit_vertex_layer.h edit_vertex_layer.moc ) + include_directories (BEFORE ./include) + + # use the Qt MOC preprocessor on classes that derives from QObject + include( Qt3Macros-patched ) + qt3_generate_moc( apollonius_graph_2.cpp apollonius_graph_2.moc ) + qt3_generate_moc( qt_file_toolbar.h qt_file_toolbar.moc ) + qt3_generate_moc( qt_layers_toolbar.h qt_layers_toolbar.moc ) + qt3_generate_moc( edit_vertex_layer.h edit_vertex_layer.moc ) + + + # The executable itself. + add_executable ( apollonius_graph_2 + apollonius_graph_2.cpp apollonius_graph_2.moc + qt_file_toolbar.moc qt_layers_toolbar.moc edit_vertex_layer.moc ) + + + target_link_libraries( apollonius_graph_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ) +else() -# The executable itself. -add_executable ( apollonius_graph_2 - apollonius_graph_2.cpp apollonius_graph_2.moc - qt_file_toolbar.moc qt_layers_toolbar.moc edit_vertex_layer.moc ) + message(STATUS "NOTICE: This demo requires CGAL and Qt3, and will not be compiled.") - -target_link_libraries( apollonius_graph_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ) +endif() diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CMakeLists.txt b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CMakeLists.txt index 4a3ccfe7730..4b00c026cf2 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CMakeLists.txt +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CMakeLists.txt @@ -9,22 +9,32 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) find_package(CGAL REQUIRED Qt3 ) include( ${CGAL_USE_FILE} ) -find_package(Qt3 REQUIRED) +find_package(Qt3-patched QUIET) +# FindQt3-patched.cmake is FindQt3.cmake patched by CGAL developers, so +# that it can be used together with FindQt4: all its variables are prefixed +# by "QT3_" instead of "QT_". -# use the Qt MOC preprocessor on classes that derives from QObject -include( Qt3Macros ) -qt3_generate_moc( arrangement_2.h arrangement_2.moc ) -qt3_generate_moc( forms.h forms.moc ) +if ( CGAL_FOUND AND QT3_FOUND ) + + # use the Qt MOC preprocessor on classes that derives from QObject + include( Qt3Macros-patched ) + qt3_generate_moc( arrangement_2.h arrangement_2.moc ) + qt3_generate_moc( forms.h forms.moc ) -# The executable itself. -add_executable ( arrangement_2 - arrangement_2.cpp arrangement_2.moc - forms.cpp forms.moc - demo_tab.cpp - MyWindow_files.cpp - MyWindow_operations.cpp - at_layer.cpp - ) + # The executable itself. + add_executable ( arrangement_2 + arrangement_2.cpp arrangement_2.moc + forms.cpp forms.moc + demo_tab.cpp + MyWindow_files.cpp + MyWindow_operations.cpp + at_layer.cpp + ) + target_link_libraries( arrangement_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) +else() + message(STATUS "NOTICE: This demo requires CGAL and Qt3, and will not be compiled.") + +endif() diff --git a/Boolean_set_operations_2/demo/Boolean_set_operations_2/CMakeLists.txt b/Boolean_set_operations_2/demo/Boolean_set_operations_2/CMakeLists.txt index 03e716b2c21..7c20883df2d 100644 --- a/Boolean_set_operations_2/demo/Boolean_set_operations_2/CMakeLists.txt +++ b/Boolean_set_operations_2/demo/Boolean_set_operations_2/CMakeLists.txt @@ -9,19 +9,30 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) find_package(CGAL REQUIRED Qt3 ) include( ${CGAL_USE_FILE} ) -find_package(Qt3 REQUIRED) +find_package(Qt3-patched QUIET) +# FindQt3-patched.cmake is FindQt3.cmake patched by CGAL developers, so +# that it can be used together with FindQt4: all its variables are prefixed +# by "QT3_" instead of "QT_". -# use the Qt MOC preprocessor on classes that derives from QObject -include( Qt3Macros ) -qt3_generate_moc( boolean_operations_2_toolbar.h boolean_operations_2_toolbar.moc ) -qt3_generate_moc( boolean_operations_2.h boolean_operations_2.moc ) +if ( CGAL_FOUND AND QT3_FOUND ) + + # use the Qt MOC preprocessor on classes that derives from QObject + include( Qt3Macros-patched ) + qt3_generate_moc( boolean_operations_2_toolbar.h boolean_operations_2_toolbar.moc ) + qt3_generate_moc( boolean_operations_2.h boolean_operations_2.moc ) -# The executable itself. -add_executable ( boolean_operations_2 - boolean_operations_2.cpp boolean_operations_2.moc - boolean_operations_2_toolbar.cpp boolean_operations_2_toolbar.moc - Qt_widget_locate_layer.cpp - ) + # The executable itself. + add_executable ( boolean_operations_2 + boolean_operations_2.cpp boolean_operations_2.moc + boolean_operations_2_toolbar.cpp boolean_operations_2_toolbar.moc + Qt_widget_locate_layer.cpp + ) -target_link_libraries( boolean_operations_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ) + target_link_libraries( boolean_operations_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ) + +else() + + message(STATUS "NOTICE: This demo requires CGAL and Qt3, and will not be compiled.") + +endif() diff --git a/CGALimageIO/src/CGALimageIO/CMakeLists.txt b/CGALimageIO/src/CGALimageIO/CMakeLists.txt index 5332c34b6d0..7f26fe62681 100644 --- a/CGALimageIO/src/CGALimageIO/CMakeLists.txt +++ b/CGALimageIO/src/CGALimageIO/CMakeLists.txt @@ -69,7 +69,7 @@ if(ZLIB_FOUND AND OPENGL_FOUND) add_definitions( ${CGAL_3RD_PARTY_DEFINITIONS} ${CGAL_ImageIO_3RD_PARTY_DEFINITIONS} ) - set_target_properties(CGAL_ImageIO PROPERTIES VERSION "${CGAL_SONAME_VERSION}" SOVERSION "${CGAL_SOVERSION}") + set_target_properties(CGAL_ImageIO PROPERTIES VERSION "${CGAL_SOVERSION}" SOVERSION "${CGAL_SONAME_VERSION}") target_link_libraries( CGAL_ImageIO ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${CGAL_ImageIO_3RD_PARTY_LIBRARIES} ) diff --git a/Core/src/CGALCore/CMakeLists.txt b/Core/src/CGALCore/CMakeLists.txt index 58e6180559a..f9481abfb36 100644 --- a/Core/src/CGALCore/CMakeLists.txt +++ b/Core/src/CGALCore/CMakeLists.txt @@ -29,7 +29,7 @@ if( GMP_FOUND AND MPFR_FOUND ) target_link_libraries( CGAL_CORE ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ) - set_target_properties(CGAL_CORE PROPERTIES VERSION "${CGAL_SONAME_VERSION}" SOVERSION "${CGAL_SOVERSION}") + set_target_properties(CGAL_CORE PROPERTIES VERSION "${CGAL_SOVERSION}" SOVERSION "${CGAL_SONAME_VERSION}") # ${CGAL_CORE_BASENAME} comes defined from FindCGAL_CORE.cmake diff --git a/GraphicsView/src/CGALQt4/CMakeLists.txt b/GraphicsView/src/CGALQt4/CMakeLists.txt index e88cb3c83bd..53bd22b20d5 100644 --- a/GraphicsView/src/CGALQt4/CMakeLists.txt +++ b/GraphicsView/src/CGALQt4/CMakeLists.txt @@ -1,21 +1,8 @@ # src/CGALQt4/CMakeLists.txt # -# The following variables must be set from the parent script: -# The first two cannot be empty +# The following variables can be set from the parent script: # -# CGAL_BINARY_DIR -# CGAL_LIB_INSTALL_DIR -# -# CGAL_INCLUDE_DIRS -# GMP_INCLUDE_DIRS -# CGAL_DEFINITIONS -# CGAL_3RD_PARTY_INCLUDE_DIRS -# CGAL_3RD_PARTY_LIBRARIES -# CGAL_3RD_PARTY_DEFINITIONS -# CGAL_LIB_SHARED_LINKER_FLAGS -# CGAL_VERSION -# CGAL_MAJOR_VERSION -# CGAL_MINOR_VERSION +# CGAL_SONAME_VERSION # CGAL_SOVERSION project (CGALQt4) @@ -38,7 +25,7 @@ if( QT4_FOUND ) include(${QT_USE_FILE}) get_dependency_version(OPENGL OpenGL) - get_dependency_version(QT4 Qt4) + get_dependency_version(QT4) if(COMMAND add_config_flag) set( CGAL_HAS_QT4 TRUE ) @@ -86,7 +73,7 @@ if( QT4_FOUND ) add_definitions ( ${CGAL_3RD_PARTY_DEFINITIONS} ) if(CGAL_SOVERSION AND CGAL_SONAME_VERSION) - set_target_properties(CGAL_Qt4 PROPERTIES VERSION "${CGAL_SONAME_VERSION}" SOVERSION "${CGAL_SOVERSION}") + set_target_properties(CGAL_Qt4 PROPERTIES VERSION "${CGAL_SOVERSION}" SOVERSION "${CGAL_SONAME_VERSION}") endif() if (NOT AUTO_LINK_ENABLED ) diff --git a/Installation/cmake/modules/CGALcommon.cmake b/Installation/cmake/modules/CGALcommon.cmake index e3235e3a3cc..8a6e3ebf2aa 100644 --- a/Installation/cmake/modules/CGALcommon.cmake +++ b/Installation/cmake/modules/CGALcommon.cmake @@ -94,7 +94,7 @@ if( NOT CGAL_COMMON_FILE_INCLUDED ) try_run( ${LIB}_RUN_RES ${LIB}_COMPILE_RES ${CMAKE_BINARY_DIR} - ${CMAKE_SOURCE_DIR}/config/support/print_${LIB}_version.cpp + ${CGAL_SOURCE_DIR}/config/support/print_${LIB}_version.cpp CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${${PKG}_DEPENDENCY_INCLUDE_DIR};${${PKG}_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${${PKG}_DEPENDENCY_LIBRARIES};${${PKG}_LIBRARIES}" "-DLINK_DIRECTORIES:STRING=${${PKG}_DEPENDENCY_LIBRARY_DIR};${${PKG}_LIBRARY_DIR}" diff --git a/Installation/cmake/modules/CreateSingleSourceCGALQt3Program.cmake b/Installation/cmake/modules/CreateSingleSourceCGALQt3Program.cmake index 21b21e0961f..4cb8442c696 100644 --- a/Installation/cmake/modules/CreateSingleSourceCGALQt3Program.cmake +++ b/Installation/cmake/modules/CreateSingleSourceCGALQt3Program.cmake @@ -15,7 +15,7 @@ macro(create_single_source_cgal_qt3_program first ) include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}) - include_directories( ${QT_INCLUDE_DIR} ) + include_directories( ${QT3_INCLUDE_DIR} ) add_executable (${exe_name} ${all}) @@ -23,9 +23,9 @@ macro(create_single_source_cgal_qt3_program first ) # Link the executable to CGAL and third-party libraries if ( AUTO_LINK_ENABLED ) - target_link_libraries(${exe_name} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ) + target_link_libraries(${exe_name} ${CGAL_3RD_PARTY_LIBRARIES} ${QT3_LIBRARIES} ) else() - target_link_libraries(${exe_name} ${CGAL_LIBRARIES} ${CGAL_QT_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES}) + target_link_libraries(${exe_name} ${CGAL_LIBRARIES} ${CGAL_QT_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${QT3_LIBRARIES}) endif() endif(EXISTS ${first}) diff --git a/Installation/cmake/modules/FindQt3.cmake b/Installation/cmake/modules/FindQt3-patched.cmake similarity index 100% rename from Installation/cmake/modules/FindQt3.cmake rename to Installation/cmake/modules/FindQt3-patched.cmake diff --git a/Installation/cmake/modules/Qt3Macros.cmake b/Installation/cmake/modules/Qt3Macros-patched.cmake similarity index 100% rename from Installation/cmake/modules/Qt3Macros.cmake rename to Installation/cmake/modules/Qt3Macros-patched.cmake diff --git a/Installation/src/CGAL/CMakeLists.txt b/Installation/src/CGAL/CMakeLists.txt index ad83a0e3510..12967b27e00 100644 --- a/Installation/src/CGAL/CMakeLists.txt +++ b/Installation/src/CGAL/CMakeLists.txt @@ -29,7 +29,7 @@ target_link_libraries(CGAL ${CGAL_3RD_PARTY_LIBRARIES}) set( CGAL_BASENAME CGAL ) -set_target_properties(CGAL PROPERTIES VERSION "${CGAL_SONAME_VERSION}" SOVERSION "${CGAL_SOVERSION}") +set_target_properties(CGAL PROPERTIES VERSION "${CGAL_SOVERSION}" SOVERSION "${CGAL_SONAME_VERSION}") if (NOT AUTO_LINK_ENABLED ) diff --git a/Mesh_2/demo/Mesh_2/CMakeLists.txt b/Mesh_2/demo/Mesh_2/CMakeLists.txt new file mode 100644 index 00000000000..7f7d7226774 --- /dev/null +++ b/Mesh_2/demo/Mesh_2/CMakeLists.txt @@ -0,0 +1,48 @@ +# Created by the script cgal_create_cmake_script (and then adapted manually). +# This is the CMake script for compiling a CGAL application. + + +project( Mesh_2_demo ) + +CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5) + +set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) + +find_package(CGAL REQUIRED CORE Qt3 ) +include( ${CGAL_USE_FILE} ) + +find_package(Qt3-patched QUIET ) +# FindQt3-patched.cmake is FindQt3.cmake patched by CGAL developers, so +# that it can be used together with FindQt4: all its variables are prefixed +# by "QT3_" instead of "QT_". + +if ( CGAL_FOUND AND QT3_FOUND ) + + include( Qt3Macros-patched ) + QT3_AUTOMOC( conform.cpp icons.cpp mesh.cpp mesh_demo.cpp Qt_widget_styled_layer.cpp Qt_widget_style_editor.cpp Show_points.cpp Show_segments_base.cpp ) + + # Make sure the compiler can find generated .moc files + include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) + + include_directories( ${QT3_INCLUDE_DIR} ) + + add_executable (Mesh_2_demo icons.cpp mesh_demo.cpp Qt_widget_styled_layer.cpp Qt_widget_style_editor.cpp Show_points.cpp Show_segments_base.cpp) + + add_to_cached_list( CGAL_EXECUTABLE_TARGETS Mesh_2_demo ) + + # Link the main executable to CGAL and third-party libraries + target_link_libraries(Mesh_2_demo ${QT3_LIBRARIES} ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ) + + # conform target + add_executable (conform conform.cpp) + target_link_libraries(conform ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ) + + # mesh target + add_executable (mesh mesh.cpp) + target_link_libraries(mesh ${QT3_LIBRARIES} ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ) + +else() + + message(STATUS "NOTICE: This demo requires CGAL and Qt3, and will not be compiled.") + +endif() diff --git a/Nef_3/demo/Nef_3/CMakeLists.txt b/Nef_3/demo/Nef_3/CMakeLists.txt index 5c66a7fadd1..6ea02c4d804 100644 --- a/Nef_3/demo/Nef_3/CMakeLists.txt +++ b/Nef_3/demo/Nef_3/CMakeLists.txt @@ -1,19 +1,22 @@ -# Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. - project (Nef_3_Demo) +CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5) + set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) -find_package(CGAL) +find_package(CGAL REQUIRED Qt3) +include(${CGAL_USE_FILE}) -find_package(Qt3) +find_package(Qt3-patched QUIET ) +# FindQt3-patched.cmake is FindQt3.cmake patched by CGAL developers, so +# that it can be used together with FindQt4: all its variables are prefixed +# by "QT3_" instead of "QT_". -if ( CGAL_FOUND AND QT_FOUND ) +if ( CGAL_FOUND AND QT3_FOUND ) - include(${CGAL_USE_FILE}) - include(Qt3Macros) + include(Qt3Macros-patched) include(CreateSingleSourceCGALQt3Program) include_directories (BEFORE include) @@ -27,6 +30,6 @@ if ( CGAL_FOUND AND QT_FOUND ) else() - message( STATUS "This demo requires CGAL and Qt3" ) - + message(STATUS "NOTICE: This demo requires CGAL and Qt3, and will not be compiled.") + endif() diff --git a/PDB/src/CGALPDB/CMakeLists.txt b/PDB/src/CGALPDB/CMakeLists.txt index 3036791a820..26cde5e20b0 100644 --- a/PDB/src/CGALPDB/CMakeLists.txt +++ b/PDB/src/CGALPDB/CMakeLists.txt @@ -23,7 +23,7 @@ include_directories( ${CGAL_3RD_PARTY_INCLUDE_DIRS} ) add_library(CGAL_PDB "all_files.cpp") -set_target_properties(CGAL_PDB PROPERTIES VERSION "${CGAL_SONAME_VERSION}" SOVERSION "${CGAL_SOVERSION}") +set_target_properties(CGAL_PDB PROPERTIES VERSION "${CGAL_SOVERSION}" SOVERSION "${CGAL_SONAME_VERSION}") target_link_libraries( CGAL_PDB ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ) diff --git a/Qt_widget/src/CGALQt/CMakeLists.txt b/Qt_widget/src/CGALQt/CMakeLists.txt index e813e5534a7..3ec2ef24bc8 100644 --- a/Qt_widget/src/CGALQt/CMakeLists.txt +++ b/Qt_widget/src/CGALQt/CMakeLists.txt @@ -1,6 +1,6 @@ # src/CGALQt/CMakeLists.txt # -# The following variables must be set from the parent script: +# The following variables can be set from the parent script: # The first two cannot be empty # # CGAL_BINARY_DIR @@ -16,18 +16,31 @@ # CGAL_MAJOR_VERSION # CGAL_MINOR_VERSION -assert(CGAL_BINARY_DIR) +project (CGALQt3) + +find_package(CGAL REQUIRED) +include(${CGAL_USE_FILE}) find_package(OpenGL QUIET ) -find_package(Qt3 QUIET ) + +find_package(Qt3-patched QUIET ) +# FindQt3-patched.cmake is FindQt3.cmake patched by CGAL developers, so +# that it can be used together with FindQt4: all its variables are prefixed +# by "QT3_" instead of "QT_". if( QT3_FOUND ) if( OPENGL_FOUND ) get_dependency_version(OPENGL OpenGL) - get_dependency_version(QT) + get_dependency_version(QT3) + if(COMMAND add_config_flag) + set( CGAL_HAS_QT3 TRUE ) + add_config_flag( CGAL_HAS_QT3 ) + endif() + + message( STATUS "OpenGL include: ${OPENGL_INCLUDE_DIR}" ) message( STATUS "OpenGL include: ${OPENGL_INCLUDE_DIR}" ) message( STATUS "OpenGL libraries: ${OPENGL_LIBRARIES}" ) message( STATUS "OpenGL definitions: ${OPENGL_DEFINITIONS}" ) @@ -41,7 +54,7 @@ if( QT3_FOUND ) cache_set(CGAL_Qt3_3RD_PARTY_LIBRARIES ${QT3_LIBRARIES} ${OPENGL_LIBRARIES} ) cache_set(CGAL_Qt3_3RD_PARTY_DEFINITIONS ${QT3_DEFINITIONS} ${OPENGL_DEFINITIONS} ) - include(Qt3Macros) + include(Qt3Macros-patched) include_directories( ${CGAL_3RD_PARTY_INCLUDE_DIRS} ${CGAL_Qt3_3RD_PARTY_INCLUDE_DIRS} ) @@ -91,7 +104,9 @@ if( QT3_FOUND ) add_dependencies( CGAL_Qt3 CGAL ) - set_target_properties(CGAL_Qt3 PROPERTIES VERSION "${CGAL_SONAME_VERSION}" SOVERSION "${CGAL_SOVERSION}") + if(CGAL_SOVERSION AND CGAL_SONAME_VERSION) + set_target_properties(CGAL_Qt3 PROPERTIES VERSION "${CGAL_SOVERSION}" SOVERSION "${CGAL_SONAME_VERSION}") + endif() target_link_libraries( CGAL_Qt3 ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${CGAL_Qt3_3RD_PARTY_LIBRARIES} ) diff --git a/Scripts/scripts/cgal_create_cmake_script b/Scripts/scripts/cgal_create_cmake_script index d40338b9f33..bdc979d66e4 100755 --- a/Scripts/scripts/cgal_create_cmake_script +++ b/Scripts/scripts/cgal_create_cmake_script @@ -35,71 +35,73 @@ create_cmake_script() { # print makefile header - echo '# Created by the script cgal_create_cmake_script' - echo '# This is the CMake script for compiling a CGAL application.' - echo - - echo "project( ${PROJECT}_${TYPE} ) " - echo - echo 'CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5)' - echo - echo 'set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)' - echo + cat </dev/null | sort` ; do all="$all $file" done - + cat <<'EOF' +find_package(CGAL REQUIRED CORE Qt3 ) +include( ${CGAL_USE_FILE} ) + +find_package(Qt3-patched QUIET ) +# FindQt3-patched.cmake is FindQt3.cmake patched by CGAL developers, so +# that it can be used together with FindQt4: all its variables are prefixed +# by "QT3_" instead of "QT_". + +include( Qt3Macros ) +EOF echo "QT3_AUTOMOC( ${all} )" - echo - - echo '# Make sure the compiler can find generated .moc files' - echo 'include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})' - - echo 'include_directories( ${QT_INCLUDE_DIR} )' + cat<<'EOF' + +# Make sure the compiler can find generated .moc files +include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) + +include_directories( ${QT3_INCLUDE_DIR} ) + +EOF if [ -d include ] ; then echo 'include_directories (BEFORE include)' + echo fi - echo - - echo "add_executable (${target_name} ${all})" - echo - echo "add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${target_name} )" - echo - - echo '# Link the executable to CGAL and third-party libraries' - echo 'if ( AUTO_LINK_ENABLED )' - echo " target_link_libraries(${target_name}"' ${QT_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )' - echo 'else()' - echo " target_link_libraries(${target_name}" ' ${QT_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${CGAL_LIBRARIES} )' - echo 'endif()' + cat </dev/null | sort` ; do @@ -123,7 +125,7 @@ usage() echo "Usage: cgal_create_cmake_script [TYPE]" echo echo " TYPE must be any of example, demo or test." - echo " Defaukt is example." + echo " Default is example." echo }