From d157adcb6ec39ae8c51a545cbda913a0f29f334b Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 23 Nov 2022 08:27:39 +0000 Subject: [PATCH 1/2] CGAL: Fixes for cmake 3.25 --- .../examples/Barycentric_coordinates_2/CMakeLists.txt | 4 ++-- .../test/Barycentric_coordinates_2/CMakeLists.txt | 4 ++-- .../examples/Polygonal_surface_reconstruction/CMakeLists.txt | 4 ++-- .../test/Polygonal_surface_reconstruction/CMakeLists.txt | 4 ++-- .../examples/Shape_regularization/CMakeLists.txt | 4 ++-- Shape_regularization/test/Shape_regularization/CMakeLists.txt | 4 ++-- Weights/examples/Weights/CMakeLists.txt | 4 ++-- Weights/test/Weights/CMakeLists.txt | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Barycentric_coordinates_2/examples/Barycentric_coordinates_2/CMakeLists.txt b/Barycentric_coordinates_2/examples/Barycentric_coordinates_2/CMakeLists.txt index 772e3bb17a0..cc3c33324b5 100644 --- a/Barycentric_coordinates_2/examples/Barycentric_coordinates_2/CMakeLists.txt +++ b/Barycentric_coordinates_2/examples/Barycentric_coordinates_2/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_cmake_script. # This is the CMake script for compiling a CGAL application. -project(Barycentric_coordinates_2_Examples) - cmake_minimum_required(VERSION 3.1...3.22) +project(Barycentric_coordinates_2_Examples) + find_package(CGAL REQUIRED COMPONENTS Core) create_single_source_cgal_program("segment_coordinates.cpp") diff --git a/Barycentric_coordinates_2/test/Barycentric_coordinates_2/CMakeLists.txt b/Barycentric_coordinates_2/test/Barycentric_coordinates_2/CMakeLists.txt index aa85e483ff4..c1706930f9d 100644 --- a/Barycentric_coordinates_2/test/Barycentric_coordinates_2/CMakeLists.txt +++ b/Barycentric_coordinates_2/test/Barycentric_coordinates_2/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_cmake_script. # This is the CMake script for compiling a CGAL application. -project(Barycentric_coordinates_2_Tests) - cmake_minimum_required(VERSION 3.1...3.22) +project(Barycentric_coordinates_2_Tests) + find_package(CGAL REQUIRED COMPONENTS Core) create_single_source_cgal_program("test_almost_degenerate_segment.cpp") diff --git a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt index 78163e83f4d..e242a60619e 100644 --- a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt +++ b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -project(Polygonal_surface_reconstruction_Examples) - cmake_minimum_required(VERSION 3.1...3.22) +project(Polygonal_surface_reconstruction_Examples) + # CGAL and its components find_package(CGAL REQUIRED) diff --git a/Polygonal_surface_reconstruction/test/Polygonal_surface_reconstruction/CMakeLists.txt b/Polygonal_surface_reconstruction/test/Polygonal_surface_reconstruction/CMakeLists.txt index fc715b2c92e..c417ae3898d 100644 --- a/Polygonal_surface_reconstruction/test/Polygonal_surface_reconstruction/CMakeLists.txt +++ b/Polygonal_surface_reconstruction/test/Polygonal_surface_reconstruction/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications. -project(Polygonal_surface_reconstruction_Tests) - cmake_minimum_required(VERSION 3.1...3.22) +project(Polygonal_surface_reconstruction_Tests) + # CGAL and its components find_package(CGAL REQUIRED) diff --git a/Shape_regularization/examples/Shape_regularization/CMakeLists.txt b/Shape_regularization/examples/Shape_regularization/CMakeLists.txt index 83cb84969cd..94b9bfa588c 100644 --- a/Shape_regularization/examples/Shape_regularization/CMakeLists.txt +++ b/Shape_regularization/examples/Shape_regularization/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists. # This is the CMake script for compiling a set of CGAL applications. -project(Shape_regularization_Examples) - cmake_minimum_required(VERSION 3.1...3.22) +project(Shape_regularization_Examples) + find_package(CGAL REQUIRED COMPONENTS Core) # Find OSQP library and headers. diff --git a/Shape_regularization/test/Shape_regularization/CMakeLists.txt b/Shape_regularization/test/Shape_regularization/CMakeLists.txt index 3060457e2e2..17ed9754335 100644 --- a/Shape_regularization/test/Shape_regularization/CMakeLists.txt +++ b/Shape_regularization/test/Shape_regularization/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_CMakeLists. # This is the CMake script for compiling a set of CGAL applications. -project(Shape_regularization_Tests) - cmake_minimum_required(VERSION 3.1...3.22) +project(Shape_regularization_Tests) + find_package(CGAL REQUIRED COMPONENTS Core) # Find OSQP library and headers. diff --git a/Weights/examples/Weights/CMakeLists.txt b/Weights/examples/Weights/CMakeLists.txt index 6d8beeaf6e7..74e406bfec5 100644 --- a/Weights/examples/Weights/CMakeLists.txt +++ b/Weights/examples/Weights/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_cmake_script. # This is the CMake script for compiling a CGAL application. -project(Weights_Examples) - cmake_minimum_required(VERSION 3.1...3.22) +project(Weights_Examples) + find_package(CGAL REQUIRED COMPONENTS Core) create_single_source_cgal_program("weights.cpp") diff --git a/Weights/test/Weights/CMakeLists.txt b/Weights/test/Weights/CMakeLists.txt index fee76719f00..eefbbda9a6d 100644 --- a/Weights/test/Weights/CMakeLists.txt +++ b/Weights/test/Weights/CMakeLists.txt @@ -1,10 +1,10 @@ # Created by the script cgal_create_cmake_script. # This is the CMake script for compiling a CGAL application. -project(Weights_Tests) - cmake_minimum_required(VERSION 3.1...3.22) +project(Weights_Tests) + find_package(CGAL REQUIRED COMPONENTS Core) create_single_source_cgal_program("test_uniform_weights.cpp") From 20dacdb0c766ea1c715b0829ae1ec43eed0a1c3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 23 Nov 2022 10:03:25 +0100 Subject: [PATCH 2/2] add check that cmake_minimum_required is the first line --- .../developer_scripts/test_merge_of_branch | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Scripts/developer_scripts/test_merge_of_branch b/Scripts/developer_scripts/test_merge_of_branch index 50e7f8c8c37..5ddb20bcf9c 100755 --- a/Scripts/developer_scripts/test_merge_of_branch +++ b/Scripts/developer_scripts/test_merge_of_branch @@ -117,6 +117,30 @@ if [ -n "${project_name_demo}" ]; then exit 1 fi +# check minimal version is the first instruction in cmake scripts +echo '.. Checking if all CMakeLists.txt starts with cmake_minimum_required...' +cmr_tests=$(for i in ^build*/test/*/CMakeLists.txt; do pkg=$(echo $i | awk -F "/" '{print $3}'); res=$(egrep -v "^\s*#" $i | grep -v "^\s*$" | head -n 1 | grep -v cmake_minimum_required); if [ -n "${res}" ]; then echo $pkg; fi; done) +cmr_examples=$(for i in ^build*/examples/*/CMakeLists.txt; do pkg=$(echo $i | awk -F "/" '{print $3}'); res=$(egrep -v "^s*#" $i | grep -v "^\s*$" | head -n 1 | grep -v cmake_minimum_required); if [ -n "${res}" ]; then echo $pkg; fi; done) +cmr_demo=$(for i in ^build*/demo/*/CMakeLists.txt; do pkg=$(echo $i | awk -F "/" '{print $3}'); res=$(egrep -v "^s*#" $i | grep -v "^\s*$" | head -n 1 | grep -v cmake_minimum_required); if [ -n "${res}" ]; then echo $pkg; fi; done) + +if [ -n "${cmr_tests}" ]; then + echo "CMakeLists in test with issues:" + echo ${cmr_tests} + exit 1 +fi + +if [ -n "${cmr_examples}" ]; then + echo "CMakeLists in examples with issues:" + echo ${cmr_examples} + exit 1 +fi + +if [ -n "${cmr_demo}" ]; then + echo "CMakeLists in demo with issues:" + echo ${cmr_demo} + exit 1 +fi + #check header files without SPDX license identifier echo '.. Checking SPDX license identifier presence in header files...' file_without_SPDX_identifiers=$(for pkg in `find */package_info -name 'license.txt' | awk -F "/" '{print $1}'`; do if [ -e ${pkg}/include ]; then find ${pkg}/include -type f \( -name '*.h' -o -name '*.hpp' \) | xargs -r grep -L "SPDX-License-Identifier"; fi; done)