Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake find_package command with a specific version of CGAL is failing #7645

Closed
VincentRouvreau opened this issue Aug 11, 2023 · 2 comments
Closed

Comments

@VincentRouvreau
Copy link
Contributor

Issue Details

When I specify a minimal CGAL version to CMake find_package command, CGAL is not and I have the following warning:

CMake Warning at CMakeLists.txt:4 (find_package):
  Could not find a configuration file for package "CGAL" that is compatible
  with requested version "4.12.0".

  The following configuration files were considered but not accepted:

    ~/miniconda3/envs/gudhi-devel/lib/cmake/CGAL/CGALConfig.cmake, version: 5.5.2

And CGAL is not found.

I work in a conda environment, where I installed cgal-cpp package.

Source Code

cmake_minimum_required(VERSION 3.14)
project(cgal_find_package CXX)

find_package(CGAL 4.12.0)

if(TARGET CGAL::CGAL)
  message("CGAL target found")
endif()

if(CGAL_FOUND)
  message("CGAL found")
endif()

Environment

  • Operating system (Windows/Mac/Linux, 32/64 bits): Ubuntu 22.04 64 bits
  • Compiler: g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
  • Release or debug mode: Release
  • Specific flags used (if any): cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$CONDA_PREFIX ..
  • CGAL version: 5.5.2
  • Boost version: 1.78.0
  • Other libraries versions if used (Eigen, TBB, etc.):
@mglisse
Copy link
Member

mglisse commented Aug 11, 2023

CGALConfigVersion.cmake has this logic:

if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
  set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
  if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CGAL_MAJOR_VERSION)
    set(PACKAGE_VERSION_COMPATIBLE TRUE)
  else()
    set(PACKAGE_VERSION_COMPATIBLE FALSE)
  endif()
  if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
    set(PACKAGE_VERSION_EXACT TRUE)
  endif()
endif()

i.e. to be compatible, the version of CGAL found must have the same major version as the one requested. I am not sure that makes sense for CGAL, there are small ABI breaks between the last 4.* and 5.0, but I don't think they were that much bigger than some that happened for minor releases.

@VincentRouvreau
Copy link
Contributor Author

Ok, thanks @mglisse
This should workaround the issue:

find_package(CGAL 4.12.0)
if(NOT CGAL_FOUND)
  find_package(CGAL 5.0.0)
endif()

@lrineau lrineau closed this as not planned Won't fix, can't repro, duplicate, stale Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants