Skip to content

Simplify cmake targets exporting#930

Merged
tpadioleau merged 2 commits intoCExA-project:mainfrom
tpadioleau:simplify-cmake-target-exporting
Oct 8, 2025
Merged

Simplify cmake targets exporting#930
tpadioleau merged 2 commits intoCExA-project:mainfrom
tpadioleau:simplify-cmake-target-exporting

Conversation

@tpadioleau
Copy link
Member

@tpadioleau tpadioleau commented Oct 5, 2025

The PR both simplifies the logic of exporting targets and makes DDC compliant with the new policy of namespaces, see https://www.kitware.com/psa-your-package-name-and-target-namespace-should-match/. This is done by removing the intermediate impl:: namespace and renaming the DDC targets in the install phase.

The file DDCTargets.cmake is also renamed DDCCoreTargets.cmake.

@tpadioleau tpadioleau self-assigned this Oct 5, 2025
@codecov
Copy link

codecov bot commented Oct 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.63%. Comparing base (1b63b40) to head (edd99b4).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #930   +/-   ##
=======================================
  Coverage   92.63%   92.63%           
=======================================
  Files          55       55           
  Lines        2673     2673           
  Branches      839      839           
=======================================
  Hits         2476     2476           
  Misses        112      112           
  Partials       85       85           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot how the CMake install mechanism works in detail, but do we need to keep the alias target declarations?

add_library(DDC::core ALIAS ddc_core)
# ...
add_library(DDC::fft ALIAS ddc_fft)
# etc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is meant for evil users that want to mix add_subdirectory(ddc) and find_package(DDC) :). The alias makes it transparent to use both. If it were not present, doing add_subdirectory(ddc), they could only access ddc_core.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I see

CMakeLists.txt Outdated
## installation

install(EXPORT DDCTargets NAMESPACE DDC::impl:: DESTINATION ${DDC_INSTALL_CMAKEDIR})
install(EXPORT DDCTargets NAMESPACE DDC:: DESTINATION ${DDC_INSTALL_CMAKEDIR})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it be better to call DDCTargets as DDCCoreTargets and first modify install(TARGETS ddc_core EXPORT DDCTargets FILE_SET HEADERS) as install(TARGETS ddc_core EXPORT DDCCoreTargets FILE_SET HEADERS)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes seems reasonable, let me try.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in edd99b4

Copy link
Member

@science-enthusiast science-enthusiast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@tpadioleau tpadioleau merged commit fc6a29e into CExA-project:main Oct 8, 2025
82 checks passed
@tpadioleau tpadioleau deleted the simplify-cmake-target-exporting branch October 8, 2025 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants