Skip to content

[cmake] explicit feature=OFF should have hierarchical priority over cached or explicit builtin_feature=ON v2 #18467

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

ferdymercury
Copy link
Contributor

This Pull request:

Changes or fixes:

This v2 of #18413

Fixes https://its.cern.ch/jira/browse/ROOT-10743

Related:

https://its.cern.ch/jira/browse/ROOT-9385

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

@ferdymercury ferdymercury marked this pull request as ready for review April 22, 2025 18:25
@ferdymercury ferdymercury requested a review from bellenot as a code owner April 22, 2025 18:25
@ferdymercury
Copy link
Contributor Author

@pcanal I have tried to follow your suggestion.

My question now is, how do I prevent enabling fftw3=ON if I passed explicitly -Dfftw3=OFF ?

Right now the sequence

cmake -Dbuiltin_fftw3=ON ../root_src/
cmake -Dfftw3=OFF ../root_src/

still leaves fftw3 ON.

Do I need to do something like https://stackoverflow.com/a/54302498/7471760 or rather https://stackoverflow.com/a/61986176/7471760?

Sth like:

if (NOT fftw3 and NOT DEFINED CACHE{builtin_fftw3})
   set(fftw3 CACHE BOOL ON FORCE)
endif()

@pcanal
Copy link
Member

pcanal commented Apr 22, 2025

Try without the FORCE ...

Copy link

github-actions bot commented Apr 22, 2025

Test Results

0 tests   0 ✅  0s ⏱️
0 suites  0 💤
0 files    0 ❌

Results for commit 8998e58.

♻️ This comment has been updated with latest results.

Fixes https://its.cern.ch/jira/browse/ROOT-10743

feature=ON can force-enable builtin_feature=OFF, but not the other way round, a warning is issued in that case now instead of silently enabling.

This prevents automatic enablings of features that the user can not disable unless he writes feature=OFF builtin_feature=OFF.
@ferdymercury
Copy link
Contributor Author

ferdymercury commented Apr 23, 2025

Try without the FORCE ...

I tried and it does not solve the issue. Probably because the default option fftw3=OFF, so that has priority over the cache?

So without force -Dbuiltin_fftw3=ON does not turn fftw3=ON.

I tried also NOT DEFINED CACHE, to no avail.

It seems that this post is relevant:
https://stackoverflow.com/questions/43542381/set-a-cmake-variable-if-it-is-not-changed-by-the-user

But then we are back to the debate... is this extra complexity worth or can we stick with v1 #18413?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants