examples - further simplify linking

This commit is contained in:
Andrej730
2025-12-12 18:58:04 +05:00
parent b237fac4b8
commit dd683d1115
5 changed files with 18 additions and 22 deletions
+1 -1
View File
@@ -319,7 +319,7 @@ endif()
# Otherwise it will find components needed for CGAL and we might some libraries.
if(WITH_CGAL)
find_package(CGAL REQUIRED)
set(CGAL_LIBRARIES CGAL::CGAL_INTERFACE)
set(CGAL_LIBRARIES IFCOPENSHELL_CGAL)
list(APPEND GEOMETRY_KERNELS cgal)
endif()
+8 -6
View File
@@ -10,10 +10,10 @@
# Input variables could also be provided as environment variables.
#
# Output targets:
# - `CGAL::CGAL_INTERFACE`
# - `IFCOPENSHELL_CGAL`
#
if(TARGET CGAL::CGAL_INTERFACE)
if(TARGET IFCOPENSHELL_CGAL)
return()
endif()
@@ -59,9 +59,11 @@ else()
message(STATUS "CGAL: found config at '${CGAL_DIR}'.")
endif()
# Adding another `CGAL_INTERFACE` target, because we want to add compile definitions to it,
# Adding another `IFCOPENSHELL_CGAL` target, because we want to add compile definitions to it,
# but in `CGALconfig.cmake` `CGAL::CGAL` is an alias, so you can't add properties to it.
add_library(CGAL::CGAL_INTERFACE INTERFACE IMPORTED)
target_link_libraries(CGAL::CGAL_INTERFACE INTERFACE CGAL::CGAL)
target_compile_definitions(CGAL::CGAL_INTERFACE INTERFACE IFOPSH_WITH_CGAL)
add_library(IFCOPENSHELL_CGAL INTERFACE)
target_link_libraries(IFCOPENSHELL_CGAL INTERFACE CGAL::CGAL)
target_compile_definitions(IFCOPENSHELL_CGAL INTERFACE IFOPSH_WITH_CGAL)
set(SWIG_DEFINES ${SWIG_DEFINES} -DIFOPSH_WITH_CGAL)
install(TARGETS IFCOPENSHELL_CGAL
EXPORT ${IFCOPENSHELL_EXPORT_TARGETS})