CGAL / cgal

The public CGAL repository, see the README below
https://github.com/CGAL/cgal#readme
Other
4.68k stars 1.35k forks source link

get_target_property of INCLUDE_DIRECTORIES on CGAL::CGAL is not set #8147

Closed VincentRouvreau closed 2 months ago

VincentRouvreau commented 2 months ago

Issue Details

It would be nice if get_target_property(CGAL_TARGET_INCLUDE_DIRECTORIES CGAL::CGAL INCLUDE_DIRECTORIES) was returning the CGAL include directory.

Source Code

Here is a CMake file to reproduce the behaviour:

cmake_minimum_required(VERSION 3.8)
project(minimal_cgal_dependency)

find_package(CGAL QUIET)

get_target_property(CGAL_TARGET_INTERFACE_INCLUDE_DIRECTORIES CGAL::CGAL INTERFACE_INCLUDE_DIRECTORIES)
message("*** CGAL_TARGET_INTERFACE_INCLUDE_DIRECTORIES = ${CGAL_TARGET_INTERFACE_INCLUDE_DIRECTORIES}")
# This seems OK, but not convenient
# *** CGAL_TARGET_INTERFACE_INCLUDE_DIRECTORIES = /miniconda3/envs/custom-cgal/include;/miniconda3/envs/custom-cgal/include;/miniconda3/envs/custom-cgal/include;$<BUILD_INTERFACE:/workspace/contrib/CGAL-5.5.3/include>;$<INSTALL_INTERFACE:include>

get_target_property(CGAL_TARGET_INCLUDE_DIRECTORIES CGAL::CGAL INCLUDE_DIRECTORIES)
message("*** CGAL_TARGET_INCLUDE_DIRECTORIES = ${CGAL_TARGET_INCLUDE_DIRECTORIES}")
# This behaviour would be convenient
# *** CGAL_TARGET_INCLUDE_DIRECTORIES = CGAL_TARGET_INCLUDE_DIRECTORIES-NOTFOUND

message("*** CGAL_INCLUDE_DIRS = ${CGAL_INCLUDE_DIRS}")
# The 'old' behaviour is still ok
# *** CGAL_INCLUDE_DIRS = /workspace/contrib/CGAL-5.5.3/include

...

Environment

lrineau commented 2 months ago

I do not get it. Target properties like INCLUDE_DIRECTORIES or INTERFACE_INCLUDE_DIRECTORIES are not meant to be consumed by users of the target. They are set by CMake.

CGAL::CGAL should actually have INTERFACE_INCLUDE_DIRECTORIES empty, in favor of INTERFACE_SYSTEM_INCLUDE_DIRECTORIES.

${CGAL_INCLUDE_DIRS} is the contract we have with CGAL users, and should stay stable over versions of CGAL. Why does it not fit your needs? What are you trying to do?