Skip to content

Deprecate exported cmake CGAL target? #9183

@Andrej730

Description

@Andrej730

Hi! I've stumbled upon an issue - I needed to define a macro in cmake library if it's using CGAL, see the snippet below.

find_package(CGAL CONFIG REQUIRED)
target_compile_definitions(CGAL::CGAL INTERFACE ENABLE_CGAL_SUPPORT)

Which results in an error target_compile_definitions can not be used on an ALIAS target.
Since libraries typically export namespace::target, I was assuming this name would work for this. But investigating cgalconfig.cmake I've learned that it's actually an alias to CGAL target created in a global namespace.

Since I would like to support both official cgalconfig.cmake and also the configs coming from conan and conan is using CGAL::CGAL as the main target (see https://conan.io/center/recipes/cgal), then I need to use some kind of strategy to support both. Currently I'm thinking to create another CGAL::CGAL_INTERFACE target and link CGAL::CGAL to it, as a workaround.

Maybe it's worth considering deprecating CGAL exported target as some point?
As it's the best practice to export targets only to it's own namespace and then there's no need for aliases.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions