cgal icon indicating copy to clipboard operation
cgal copied to clipboard

Unable to install CGAL using FetchContent

Open lewiswolf opened this issue 1 year ago • 4 comments

Issue Details

Hi. I'm trying to get CGAL working with CMake's FetchContent, so that I don't have to have CGAL manually installed on my system.

fatal error: 'CGAL/Polygon_2.h' file not found
#include <CGAL/Polygon_2.h>

I have tried various attempts with CGAL::CGAL and CGAL::CGAL_Core but nothing seems to work.

CMake Error at CMakeLists.txt:33 (target_link_libraries):
  The link interface of target "kac_core" contains:

    CGAL::CGAL

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Source Code

include(FetchContent)
FetchContent_Declare(
        Boost
        GIT_REPOSITORY https://github.com/boostorg/boost.git
)
FetchContent_Declare(
	CGAL
	GIT_REPOSITORY https://github.com/CGAL/cgal.git
	OVERRIDE_FIND_PACKAGE
)
find_package(CGAL)
FetchContent_MakeAvailable(Boost CGAL)
target_link_libraries(${PROJECT_NAME} INTERFACE Boost CGAL)
// dependencies
#include <CGAL/Polygon_2.h>

...

Environment

  • Operating system (Windows/Mac/Linux, 32/64 bits): macos Catalina
  • Compiler: Clang 15.0.5
  • Release or debug mode:
  • Specific flags used (if any):
  • CGAL version: 5.6-I-900
  • Boost version: 1.81
  • Other libraries versions if used (Eigen, TBB, etc.):

lewiswolf avatar Nov 24 '22 16:11 lewiswolf