ned14 / outcome

Provides very lightweight outcome<T> and result<T> (non-Boost edition)
https://ned14.github.io/outcome
Other
675 stars 62 forks source link

The CMake bootstrap script should try to find an installed quickcpplib by default #279

Closed yurivict closed 11 months ago

yurivict commented 1 year ago

Despite the current revision of quickcpplib being installed, outcome still attempts to clone it:

-- quickcpplib not found, cloning git repository and installing into /usr/ports/devel/outcome/work/.build/quickcpplib ...
-- Found Git: /usr/local/bin/git (found version "2.40.1") 
BurningEnlightenment commented 1 year ago

~Have you verified that the CMake configs for quickcpplib have been installed to a location that is searched? Otherwise~ you need to manually specify the directory containing the configs with -Dquickcpplib_DIR=<:config-dir:>, otherwise the buildsystem won't call find_package(): https://github.com/ned14/outcome/blob/44da28c59d85f2245230931b6c25725b679b556c/cmake/QuickCppLibBootstrap.cmake#L31-L33

yurivict commented 1 year ago

This line alone:

find_package(quickcpplib REQUIRED QUIET CONFIG)

finds quickcpplib. I think that this is what cmake should do first, unconditionally.

BurningEnlightenment commented 1 year ago

I'm not overly familiar with (the quirks of) the superbuild or the design rationale behind it, so you will need @ned14's approval for such change requests, sorry.

I just can tell you that the buildsystem hasn't been written with a workflow of manually building and installing quickcpplib in mind, see 3e6aee14cef9651a21ff92494d03276631886b47 and the concessions made for vcpkg in ac552d1c69ef556a1327393a0c56092517ff92db and 6f39dc401a6205b998e0fddd3ec1967362388321.

yurivict commented 1 year ago

I think that you can have a SUPERBUILD cmake option (some other projects do it this way). If SUPERBUILD is set - it might default to git-cloning or using client-supplied paths like quickcpplib_DIR. If SUPERBUILD is not set - it should use find_package() first, and then maybe try to git-clone.

The way how it is now - it just fails to find quickcpplib when it is otherwise easily discoverable. This stops me from porting ossia-score to FreeBSD because they use "llfio" which in turn needs "outcome". I am trying to create FreeBSD ports for all these packages, and got stuck with this problem here.

ned14 commented 1 year ago

https://github.com/ned14/outcome/blob/develop/cmake/QuickCppLibBootstrap.cmake#L32 does indeed call find_package(quickcpplib QUIET CONFIG) as the first attempt to find quickcpplib.

Only you can tell us why it isn't finding it on your machine. Or rather, why when Outcome tries to find it, it doesn't find it, when later on your test of finding it does success.

(Try inserting some debug printing into that file, maybe figure out why it's not working?)

ned14 commented 1 year ago

BTW if you're creating FreeBSD ports, I'd suggest replicating what vcpkg does to wrap these up into its ports. You may find examining these useful:

Also, thank you very much for creating FreeBSD ports for my libraries! You know you're getting popular when FreeBSD includes your libraries into its ports tree!

BurningEnlightenment commented 1 year ago

https://github.com/ned14/outcome/blob/develop/cmake/QuickCppLibBootstrap.cmake#L32 does indeed call find_package(quickcpplib QUIET CONFIG) as the first attempt to find quickcpplib.

No, it does only call find_package first if you manually supplied quickcpplib_DIR on the commandline or prewarmed the CMakeCache with it. https://github.com/ned14/outcome/blob/44da28c59d85f2245230931b6c25725b679b556c/cmake/QuickCppLibBootstrap.cmake#L31-L32

ned14 commented 1 year ago

Yes you're right, sorry.

I see https://github.com/microsoft/vcpkg/blob/master/ports/outcome/portfile.cmake sets quickcpplib_DIR before cmake configure. @yurivict is that not possible in your BSD ports file?

ned14 commented 11 months ago

Fixed.