← All tasks
cppCGAL/cgal #8981Repaired task

Problems building demos/examples against installed headers

envgap__CGAL__cgal-8981

01 / FAILURE SIGNATURE

Captured in a clean container

Could not find a package configuration file provided by "CGAL" with any of

02 / ENVIRONMENT RECIPE

Base commit
b0e2e44894e5615e30dd53e2b9556970e061f781
Manifest
Installation/demo/CMakeLists.txt
Reproduce
cmake -S Installation/demo -B build -DBUILD_TESTING=OFF && cmake --build build -j4
Run under trace
cmake --build build -j4
Reference environment fix used for admission
diff --git a/Installation/cmake/modules/CGALHelpers.cmake b/Installation/cmake/modules/CGALHelpers.cmake
index de42f8cf269..f29fd11111b 100644
--- a/Installation/cmake/modules/CGALHelpers.cmake
+++ b/Installation/cmake/modules/CGALHelpers.cmake
@@ -9,7 +9,7 @@ function(process_CGAL_subdirectory entry subdir type_name)
     make_directory("${CMAKE_BINARY_DIR}/${subdir}/${ENTRY_DIR_NAME}")
   endif()
 
-  message("\n-- Configuring ${subdir} in ${subdir}/${ENTRY_DIR_NAME}")
+  message("-- Configuring ${subdir} in ${subdir}/${ENTRY_DIR_NAME}")
 
   set(source_dir "")
   if(EXISTS ${entry}/CMakeLists.txt)
diff --git a/Installation/demo/CMakeLists.txt b/Installation/demo/CMakeLists.txt
index 92606a5b9d2..011b436cc53 100644
--- a/Installation/demo/CMakeLists.txt
+++ b/Installation/demo/CMakeLists.txt
@@ -1,7 +1,16 @@
+project(CGAL_Demos)
+
 cmake_minimum_required(VERSION 3.12...3.31)
 
-if(NOT CGAL_MODULES_DIR)
-  find_package(CGAL REQUIRED)
-endif()
-include(${CGAL_MODULES_DIR}/CGALHelpers.cmake)
-CGAL_handle_subdirectories(demo demos)
+file(GLOB pkgs RELATIVE ${CMAKE_SOURCE_DIR} "*")
+list(SORT pkgs)
+
+message("== Generating build files for demos ==")
+foreach(pkg ${pkgs})
+  set(pkg_dir ${CMAKE_SOURCE_DIR}/${pkg})
+  if(IS_DIRECTORY "${pkg_dir}" AND EXISTS "${pkg_dir}/CMakeLists.txt")
+    message("\n-- Configuring ${pkg}")
+    add_subdirectory(${pkg_dir} "${CMAKE_BINARY_DIR}/${pkg}")
+  endif()
+endforeach()
+message("== Generating build files for done (DONE) ==")
diff --git a/Installation/examples/CMakeLists.txt b/Installation/examples/CMakeLists.txt
index e0034b4727f..9fc6ac0858b 100644
--- a/Installation/examples/CMakeLists.txt
+++ b/Installation/examples/CMakeLists.txt
@@ -1,6 +1,16 @@
+project(CGAL_Examples)
+
 cmake_minimum_required(VERSION 3.12...3.31)
-if(NOT CGAL_MODULES_DIR)
-  find_package(CGAL REQUIRED)
-endif()
-include(${CGAL_MODULES_DIR}/CGALHelpers.cmake)
-CGAL_handle_subdirectories(examples examples)
+
+file(GLOB pkgs RELATIVE ${CMAKE_SOURCE_DIR} "*")
+list(SORT pkgs)
+
+message("== Generating build files for examples ==")
+foreach(pkg ${pkgs})
+  set(pkg_dir ${CMAKE_SOURCE_DIR}/${pkg})
+  if(IS_DIRECTORY "${pkg_dir}" AND EXISTS "${pkg_dir}/CMakeLists.txt")
+    message("\n-- Configuring ${pkg}")
+    add_subdirectory(${pkg_dir} "${CMAKE_BINARY_DIR}/${pkg}")
+  endif()
+endforeach()
+message("== Generating build files for done (DONE) ==")
diff --git a/Installation/test/CMakeLists.txt b/Installation/test/CMakeLists.txt
index 64d616edd57..e8e81f0c032 100644
--- a/Installation/test/CMakeLists.txt
+++ b/Installation/test/CMakeLists.txt
@@ -1,8 +1,16 @@
+project(CGAL_Tests)
+
 cmake_minimum_required(VERSION 3.12...3.31)
 
+file(GLOB pkgs RELATIVE ${CMAKE_SOURCE_DIR} "*")
+list(SORT pkgs)
 
-if(NOT CGAL_MODULES_DIR)
-  find_package(CGAL REQUIRED)
-endif()
-include(${CGAL_MODULES_DIR}/CGALHelpers.cmake)
-CGAL_handle_subdirectories(test tests)
+message("== Generating build files for tests ==")
+foreach(pkg ${pkgs})
+  set(pkg_dir ${CMAKE_SOURCE_DIR}/${pkg})
+  if(IS_DIRECTORY "${pkg_dir}" AND EXISTS "${pkg_dir}/CMakeLists.txt")
+    message("\n-- Configuring ${pkg}")
+    add_subdirectory(${pkg_dir} "${CMAKE_BINARY_DIR}/${pkg}")
+  endif()
+endforeach()
+message("== Generating build files for done (DONE) ==")

03 / ORIGINAL ISSUE TEXT

CGAL/cgal #8981 · read the original issue
## Issue Details

In 6.1 Beta, the cmake scripts for demos and examples seem to no longer work with installed headers (independently of the remainder of the source code tarball).

The Debian package `libcgal-dev` contains the installed headers plus cmake support scripts. The package `libcgal-demo` contains tarballs of the `demo`, `examples` and `data` subdirectories. In past releases, it was possible to extract these tarballs and build all demos/examples against the installed headers and cmake scripts.

This does no longer work. `demo/CMakeLists.txt` and `examples/CMakeLists.txt` lack a project() line to use them independently. Adding that and changing the directory argument on the last line to "." makes the cmake configure step working again. But the generated default target does not seem to depend on anything. Building each demo/example individually works, but there does not seem to be a simple way to build them all anymore.

Maybe I need to adapt the packaging to some changes, but I couldn't find anything relevant in the changelog.

## Environment

* Operating system (Linux, 64 bits): Debian Sid
* CGAL version: 6.1 Beta
Continue on GitHub ↗

04 / LABELS

Labels checked by running the task · needs human review

misspecificationunderspecification
Label rules and the text that matched
[
  {
    "category": "underspecification",
    "rule": "signature.missing_system_requirement",
    "source": "failure_signature",
    "excerpt": "Could not find a package configuration file provided by \"CGAL\" with any of"
  },
  {
    "category": "misspecification",
    "rule": "diff.changes_existing_manifest_line",
    "source": "manifest_diff:Installation/demo/CMakeLists.txt",
    "excerpt": "-if(NOT CGAL_MODULES_DIR)\n-  find_package(CGAL REQUIRED)\n-endif()\n-include(${CGAL_MODULES_DIR}/CGALHelpers.cmake)\n-CGAL_handle_subdirectories(demo demos)\n+project(CGAL_Demos)\n+\n+file(GLOB pkgs RELATIVE ${CMAKE_SOURCE_DIR} \"*\")\n+list(SORT pkgs)\n+\n+message(\"== Generating build files for demos ==\")\n+foreach(pkg ${pkgs})\n+  set(pkg_dir ${CMAKE_SOURCE_DIR}/${pkg})\n+  if(IS_DIRECTORY \"${pkg_dir}\" AND EXISTS \"${pkg_dir}/CMakeLists.txt\")\n+    message(\"\\n-- Configuring ${pkg}\")\n+    add_subdirectory(${pkg_dir} \"${CMAKE_BINARY_DIR}/${pkg}\")\n+  endif()\n+endforeach()\n+message(\"== Generating build files for done (DONE) ==\")"
  }
]

Mined from a merged pull request linked to the issue whose changed files are all environment files.

The base commit is the pull request's base, not the dated default-branch commit; the registry is pinned to the merge date so the pull request's own pins resolve.

Default commands from envgap default-recipe synthesizer v1; gold_files are the pull request's environment diff.

Preparation uses current registries. Historical package availability is not enforced here; execution metadata records this limitation separately from the oracle's date-bounding policy.