Vcpkg: CGAL package installs, but does not work

Created on 24 Sep 2019  路  10Comments  路  Source: microsoft/vcpkg

Describe the bug
find_package() fails to find all CGAL libraries

Environment

  • OS: [macOS 10.14.6]
  • Compiler: Apple LLVM version 10.0.1 (clang-1001.0.46.4)

To Reproduce
https://github.com/acgetchell/CDT-test

Expected behavior
Code compiles using CGAL.

Failure logs

CMake Error at /Users/adam/vcpkg/scripts/buildsystems/vcpkg.cmake:166 (_add_executable):
  Target "cdt-opt" links to target "CGAL::" but the target was not found.
  Perhaps a find_package() call is missing for an IMPORTED target, or an
  ALIAS target is missing?
Call Stack (most recent call first):
  CMakeLists.txt:71 (add_executable)


CMake Error at /Users/adam/vcpkg/scripts/buildsystems/vcpkg.cmake:166 (_add_executable):
  Target "cdt-opt" links to target "CGAL::Qt5_moc_and_resources" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?
Call Stack (most recent call first):
  CMakeLists.txt:71 (add_executable)

Additional context
mpfr was fixed[#5910], so this is next along the chain of using CGAL.

port-bug

Most helpful comment

I have created the pull-request https://github.com/acgetchell/CDT-test/pull/4 on you repo, to fix the CMake issues.

On Linux, before my fixes, I had the same CMake errors as you had, and the two commits of the pull-requests fix that, on Linux at least.

All 10 comments

The errors seem in your CMakeLists.txt:

  • the variable cgal_lib does not seem filled by anything, and that is why cdt-opt is incorrectly linked with that incorrect name CGAL::,
  • cdt-opt is also linked with

    • CGAL_Qt5_moc_and_resources and

    • CGAL::Qt5_moc_and_resources,

that do not exist, or are internals of CGAL CMake scripts that you are not supposed to use.

I have created the pull-request https://github.com/acgetchell/CDT-test/pull/4 on you repo, to fix the CMake issues.

On Linux, before my fixes, I had the same CMake errors as you had, and the two commits of the pull-requests fix that, on Linux at least.

The errors seem in your CMakeLists.txt:

* the variable `cgal_lib` does not seem filled by anything, and that is why `cdt-opt` is incorrectly linked with that incorrect name `CGAL::`,

* `cdt-opt` is also linked with

  * `CGAL_Qt5_moc_and_resources` and
  * `CGAL::Qt5_moc_and_resources`,

  that do not exist, or are internals of CGAL CMake scripts that you are not supposed to use.

Merging your pull request I get the following errors:

"/Users/adam/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-2/192.6817.18/CLion.app/Contents/bin/cmake/mac/bin/cmake" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=/Users/adam/vcpkg/scripts/buildsystems/vcpkg.cmake -G "CodeBlocks - Unix Makefiles" /Users/adam/CDT-test
-- Found Boost: /Users/adam/vcpkg/installed/x64-osx/include (found version "1.71.0")  
-- Found Boost: /Users/adam/vcpkg/installed/x64-osx/include (found suitable version "1.71.0", minimum required is "1.48")  
-- Boost include dirs: /Users/adam/vcpkg/installed/x64-osx/include
-- Boost libraries:    
-- Configuring done
CMake Error in CMakeLists.txt:
  Imported target "CGAL::CGAL" includes non-existent path

    "/Users/adam/cgal/Point_set_shape_detection_3/include"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.



CMake Error in CMakeLists.txt:
  Imported target "CGAL::CGAL" includes non-existent path

    "/Users/adam/cgal/Point_set_shape_detection_3/include"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.



CMake Error in CMakeLists.txt:
  Imported target "CGAL::CGAL" includes non-existent path

    "/Users/adam/cgal/Point_set_shape_detection_3/include"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.

The real reason is the find_package is incorrect.
foreach( CGAL_COMPONENT ${CGAL_FIND_COMPONENTS} ) shows we need to use find_package(CGAL CONFIG COMPONENTS CGAL::CGAL_Core CGAL::CGAL_ImageIO ...).

It might be related to that pull-request: https://github.com/CGAL/cgal/pull/4285.

I did a fresh install of macOS 10.15 and it works.

https://github.com/acgetchell/CDT-test

I think my last error was that I had also cloned the cgal repo and done a branch build, hence the references to my repo Users/Adam/cgal/Point_set_shape_detection_3/include. The error message did actually mention a faulty installation as a possible reason.

So @lrineau fixes to my CMakeLists.txt worked.

Thanks for your help!

@acgetchell so, should I close my PR?

Not sure, the usage directions are still incorrect.

https://travis-ci.com/acgetchell/CDT-test/jobs/246543736#L3083

I'm going to attempt to get my Windows build to work tomorrow.

That will be fixed soon by #8659.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LilyWangL picture LilyWangL  路  3Comments

tzbo picture tzbo  路  3Comments

cjvaijo picture cjvaijo  路  3Comments

oahzuw picture oahzuw  路  3Comments

angelmixu picture angelmixu  路  3Comments