Modernize the CMakeLists.txt that use LEDA

The file `${CGAL_USE_FILE}` must be included before
`find_package(LEDA)` can be called. But that would require to verify
`CGAL_FOUND` first...

Actually, now that we require at least CMake 3.1, let's say that CGAL
is `REQUIRED`, but not the components. That is the basic truth, and
that avoids testing for `CGAL_FOUND`.

At the same time, I have modified the `cmake_minimum_required`:
  - placed as the first line,
  - set to `3.1...3.13`:
      https://cmake.org/cmake/help/latest/command/cmake_policy.html#setting-policies-by-cmake-version

I have also removed the comments that says the `CMakeLists.txt` was
generated. That may have been true... but before a lot of modifications.
This commit is contained in:
Laurent Rineau 2019-03-27 09:56:16 +01:00
parent 0c0d5e1cfb
commit d4e09c1d78
8 changed files with 57 additions and 87 deletions

View File

@ -1,16 +1,12 @@
# Created by the script cgal_create_cmake_script
# This is the CMake script for compiling a CGAL application.
cmake_minimum_required(VERSION 3.1...3.13)
project( Cone_spanners_2_Examples )
cmake_minimum_required(VERSION 3.1)
find_package(CGAL QUIET COMPONENTS Core)
find_package(CGAL REQUIRED QUIET OPTIONAL_COMPONENTS Core)
include(${CGAL_USE_FILE})
find_package(LEDA QUIET)
if ( CGAL_FOUND AND ( CGAL_Core_FOUND OR LEDA_FOUND ) )
include(${CGAL_USE_FILE})
if ( CGAL_Core_FOUND OR LEDA_FOUND )
if (MSVC)
# Turn off a boost related warning that appears with VC2015
# boost_1_65_1\boost\graph\named_function_params.hpp(240) :
@ -26,7 +22,7 @@ if ( CGAL_FOUND AND ( CGAL_Core_FOUND OR LEDA_FOUND ) )
else()
message(STATUS "This program requires the CGAL and CGAL_Core libraries, and will not be compiled.")
message(STATUS "This program requires the CGAL_Core library (or LEDA), and will not be compiled.")
endif()

View File

@ -1,3 +1,5 @@
cmake_minimum_required(VERSION 3.1...3.13)
project (Hyperbolic_triangulation_2_Demo)
# Find includes in corresponding build directories
@ -6,9 +8,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
cmake_minimum_required(VERSION 3.1...3.13)
find_package(CGAL QUIET COMPONENTS Core Qt5)
find_package(CGAL REQUIRED QUIET OPTIONAL_COMPONENTS Core Qt5)
find_package(LEDA QUIET)
find_package(Qt5 QUIET COMPONENTS Widgets)
@ -25,5 +25,5 @@ if(CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND (CGAL_Core_FOUND OR LEDA_FOUN
add_executable ( HDT2_demo HDT2.cpp ${CGAL_Qt5_RESOURCE_FILES} ${RESOURCE_FILES} ${UIS})
target_link_libraries ( HDT2_demo CGAL::CGAL CGAL::CGAL_Qt5 CGAL::CGAL_Core Qt5::Widgets)
else()
message(STATUS "NOTICE: This demo requires CGAL, CGAL_Core, and Qt5 and will not be compiled.")
message(STATUS "NOTICE: This demo requires CGAL, CGAL_Core (or LEDA), and Qt5 and will not be compiled.")
endif()

View File

@ -1,24 +1,20 @@
# Created by the script cgal_create_cmake_script
# This is the CMake script for compiling a CGAL application.
cmake_minimum_required(VERSION 3.1...3.13)
project( Periodic_4_hyperbolic_triangulation_2_Examples )
cmake_minimum_required(VERSION 2.8.10)
find_package(CGAL QUIET COMPONENTS Core )
find_package(CGAL REQUIRED QUIET OPTIONAL_COMPONENTS Core )
include( ${CGAL_USE_FILE} )
find_package(LEDA QUIET)
if ( CGAL_FOUND AND (CGAL_Core_FOUND OR LEDA_FOUND) )
include( ${CGAL_USE_FILE} )
if ( CGAL_Core_FOUND OR LEDA_FOUND )
include( CGAL_CreateSingleSourceCGALProgram )
include( CGAL_CreateSingleSourceCGALProgram )
create_single_source_cgal_program( "p4ht2_example_insertion.cpp" )
create_single_source_cgal_program( "p4ht2_example_insertion.cpp" )
else()
message(STATUS "This program requires the CGAL library, and will not be compiled.")
message(STATUS "This program requires the CGAL library, and will not be compiled.")
endif()

View File

@ -31,7 +31,6 @@
#include <CGAL/Bbox_2.h>
#include <CGAL/Cartesian.h>
#include <CGAL/CORE_Expr.h>
#include <boost/tuple/tuple.hpp>
#include <boost/variant.hpp>

View File

@ -1,32 +1,27 @@
# Created by the script cgal_create_cmake_script
# This is the CMake script for compiling a CGAL application.
cmake_minimum_required(VERSION 3.1...3.13)
project( Periodic_4_hyperbolic_triangulation_2_Tests )
cmake_minimum_required(VERSION 2.8.10)
find_package(CGAL QUIET COMPONENTS Core )
find_package(CGAL REQUIRED QUIET OPTIONAL_COMPONENTS Core )
include( ${CGAL_USE_FILE} )
find_package(LEDA QUIET)
if ( CGAL_FOUND AND (CGAL_Core_FOUND OR LEDA_FOUND) )
include( ${CGAL_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram )
include( CGAL_CreateSingleSourceCGALProgram )
create_single_source_cgal_program( "test_p4ht2_construct_point_2.cpp" )
create_single_source_cgal_program( "test_p4ht2_exact_complex_numbers.cpp" )
create_single_source_cgal_program( "test_p4ht2_intersections.cpp" )
create_single_source_cgal_program( "test_p4ht2_locate.cpp" )
create_single_source_cgal_program( "test_p4ht2_matrix.cpp" )
create_single_source_cgal_program( "test_p4ht2_removal_iterator.cpp" )
create_single_source_cgal_program( "test_p4ht2_removal.cpp" )
create_single_source_cgal_program( "test_p4ht2_insert_degenerate.cpp" )
create_single_source_cgal_program( "test_p4ht2_construct_point_2.cpp" )
create_single_source_cgal_program( "test_p4ht2_exact_complex_numbers.cpp" )
create_single_source_cgal_program( "test_p4ht2_intersections.cpp" )
create_single_source_cgal_program( "test_p4ht2_locate.cpp" )
create_single_source_cgal_program( "test_p4ht2_matrix.cpp" )
create_single_source_cgal_program( "test_p4ht2_removal_iterator.cpp" )
create_single_source_cgal_program( "test_p4ht2_removal.cpp" )
create_single_source_cgal_program( "test_p4ht2_insert_degenerate.cpp" )
else()
message(STATUS "This program requires the CGAL library and the GMP library, and will not be compiled.")
message(STATUS "This program requires the CGAL library and the GMP library, and will not be compiled.")
endif()

View File

@ -99,6 +99,8 @@ create_cmake_script_with_options()
# Created by the script cgal_create_CMakeLists
# This is the CMake script for compiling a set of CGAL applications.
cmake_minimum_required(VERSION 3.1...3.13)
EOF
#---------------------------------------------------------------------------
if [ "$SINGLE_SOURCE" = "n" ]; then
@ -111,8 +113,6 @@ EOF
cat << 'EOF'
cmake_minimum_required(VERSION 2.8.11)
# CGAL and its components
EOF
if [ -n "$ENABLE_CTEST" ]; then
@ -172,7 +172,7 @@ fi
fi
echo "find_package( CGAL QUIET COMPONENTS ${CGAL_COMPONENTS//:/ } )"
echo "find_package( CGAL REQUIRED QUIET OPTIONAL_COMPONENTS ${CGAL_COMPONENTS//:/ } )"
#vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
cat << 'EOF'

View File

@ -40,19 +40,17 @@ create_cmake_script()
# Created by the script cgal_create_cmake_script
# This is the CMake script for compiling a CGAL application.
cmake_minimum_required(VERSION 3.1...3.13)
project( ${PROJECT}_${TYPE} )
EOF
cat <<'EOF'
cmake_minimum_required(VERSION 2.8.10)
set(CMAKE_CXX_STANDARD 14)
EOF
cat <<'EOF'
find_package(CGAL QUIET COMPONENTS Core )
find_package(CGAL REQUIRED QUIET OPTIONAL_COMPONENTS Core )
if ( CGAL_FOUND )

View File

@ -1,50 +1,36 @@
# Created by the script cgal_create_cmake_script
# This is the CMake script for compiling a CGAL application.
cmake_minimum_required(VERSION 3.1...3.13)
project( Surface_mesh_shortest_path_Tests )
cmake_minimum_required(VERSION 3.1)
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Core)
include(${CGAL_USE_FILE})
find_package(CGAL QUIET COMPONENTS Core)
find_package(LEDA QUIET)
if ( CGAL_FOUND )
include_directories (BEFORE "include")
include(${CGAL_USE_FILE})
include_directories (BEFORE "include")
create_single_source_cgal_program( "Surface_mesh_shortest_path_test_1.cpp" )
create_single_source_cgal_program( "Surface_mesh_shortest_path_test_2.cpp" )
create_single_source_cgal_program( "Surface_mesh_shortest_path_test_3.cpp" )
create_single_source_cgal_program( "Surface_mesh_shortest_path_test_4.cpp" )
create_single_source_cgal_program( "Surface_mesh_shortest_path_traits_test.cpp" )
create_single_source_cgal_program( "Surface_mesh_shortest_path_test_1.cpp" )
create_single_source_cgal_program( "Surface_mesh_shortest_path_test_2.cpp" )
create_single_source_cgal_program( "Surface_mesh_shortest_path_test_3.cpp" )
create_single_source_cgal_program( "Surface_mesh_shortest_path_test_4.cpp" )
create_single_source_cgal_program( "Surface_mesh_shortest_path_traits_test.cpp" )
# Link with Boost.ProgramOptions (optional)
find_package(Boost QUIET COMPONENTS program_options)
if(Boost_PROGRAM_OPTIONS_FOUND)
if( CGAL_AUTO_LINK_ENABLED )
message( STATUS "Boost.ProgramOptions library: found" )
else()
message( STATUS "Boost.ProgramOptions library: ${Boost_PROGRAM_OPTIONS_LIBRARY}" )
endif()
add_definitions( "-DCGAL_USE_BOOST_PROGRAM_OPTIONS" )
list(APPEND CGAL_3RD_PARTY_LIBRARIES ${Boost_PROGRAM_OPTIONS_LIBRARY})
if(CGAL_Core_FOUND OR LEDA_FOUND)
create_single_source_cgal_program( "TestMesh.cpp" )
else()
message(STATUS "NOTICE: Example TestMesh.cpp requires CGAL_Core library and will not be compiled.")
endif()
# Link with Boost.ProgramOptions (optional)
find_package(Boost QUIET COMPONENTS program_options)
if(Boost_PROGRAM_OPTIONS_FOUND)
if( CGAL_AUTO_LINK_ENABLED )
message( STATUS "Boost.ProgramOptions library: found" )
else()
message(STATUS "NOTICE: Example TestMesh.cpp requires boost program_option and will not be compiled.")
message( STATUS "Boost.ProgramOptions library: ${Boost_PROGRAM_OPTIONS_LIBRARY}" )
endif()
add_definitions( "-DCGAL_USE_BOOST_PROGRAM_OPTIONS" )
list(APPEND CGAL_3RD_PARTY_LIBRARIES ${Boost_PROGRAM_OPTIONS_LIBRARY})
if(CGAL_Core_FOUND OR LEDA_FOUND)
create_single_source_cgal_program( "TestMesh.cpp" )
else()
message(STATUS "NOTICE: Example TestMesh.cpp requires the CGAL_Core library (or LEDA) and will not be compiled.")
endif()
else()
message(STATUS "This program requires the CGAL library, and will not be compiled.")
message(STATUS "NOTICE: Example TestMesh.cpp requires boost program_option and will not be compiled.")
endif()