Fix automatic libofx detection
ClosedPublic

Authored by tbaumgart on Jan 1 2018, 11:09 AM.

Details

Summary

Commit 21338733bacaa53b8c53758d0b2c68e9ef543147 broke the autodetection
of LibOFX. This patch fixes this and allows successful compiliation
while ENABLE_OFXIMPORTER is ON and LibOFX is not being installed.

Test Plan

Installed LibOFX, ran cmake: OFX was enabled and KMyMoney compiled
Uninstalled LibOFX, ran cmake: OFX was disabled and KMyMoney compiled
Reinstalled LibOFX, ran cmake: OFX was enabled and KMyMoney compiled

Diff Detail

Repository
R261 KMyMoney
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
tbaumgart requested review of this revision.Jan 1 2018, 11:09 AM
tbaumgart created this revision.
wojnilowicz requested changes to this revision.Jan 1 2018, 12:16 PM
wojnilowicz added inline comments.
CMakeLists.txt
120–121

If OFX should be enabled by default, then maybe we should use CMAKE_DEPENDENT_OPTION somwhere here.

kmymoney/plugins/ofx/CMakeLists.txt
1 ↗(On Diff #24540)

This defies whole purpose of ENABLE_OFXIMPORTER.
OFX should be enabled if user explicitly says so and not if libofx is found or not.
On my system OFX is always found and I always want it disabled. This switch wouldn't work for me.

This revision now requires changes to proceed.Jan 1 2018, 12:16 PM
tbaumgart added inline comments.Jan 1 2018, 12:34 PM
kmymoney/plugins/ofx/CMakeLists.txt
1 ↗(On Diff #24540)

Then simply set ENABLE_OFXIMPORTER to OFF and you should be set. Maybe, we need to unset LIBOFX_FOUND outside of any condition to make this work properly.

BTW: OFX should be enabled without any further action if found. It might be disabled if user explicitly desires so. (this is the known and documented behavior based on the former variable ENABLE_LIBOFX and must not be changed.)

I did so and ofximporter got build anyway. Is that expected behaviour after your patch?
I think that building OFX based on LIBOFX_FOUND is misleading as it states that OFX should be build no matter what provided that LibOFX is present.
I think that ENABLE_OFXIMPORTER should be conditioned also by LIBOFX_FOUND and building of OFX should be based on ENABLE_OFXIMPORTER which clearly states the intent.

tbaumgart updated this revision to Diff 24547.Jan 1 2018, 2:33 PM

Improve detection and settings of OFX support

Allow to manually disable OFX support even if it LibOFX is detected.
Default of support is ON if LibOFX is detected.

Improve detection and settings of OFX support

Allow to manually disable OFX support even if it LibOFX is detected.
Default of support is ON if LibOFX is detected.

Is everything OK with this patch? I cannot apply it.

tbaumgart updated this revision to Diff 24550.Jan 1 2018, 3:27 PM

I must have made a mistake. Here's the next try of the same thing.

wojnilowicz accepted this revision.Jan 1 2018, 4:36 PM

It works as intended. Thank you.

This revision is now accepted and ready to land.Jan 1 2018, 4:36 PM
This revision was automatically updated to reflect the committed changes.

What was the final decision regarding default behavior if OFX is not mentioned at all explicitly in the cmake command? I am OK with either behavior, but want to be sure it is what is intended.

I now tend to agree with Lucas that the default should be OFF: if you want it, you have to ask for it. However, I understand this is not the historic default behavior.

To confirm, testing just now, without mentioning anything about OFX on the cmake command line, cmake does say it finds libofx 0.9.11 and it does find LIBOFX_HAVE_CLIENTUID, but the configure results says OFX plugin: no.