Add cmake.org as a search engine?

I often need to look stuff up in cmake.

It would be really nice if I could add cmake as a search engine in my browser.

Example:
image

cppreference.com (https://en.cppreference.com/w/Main_Page) offers this functionality and I think it would be a really nice quality of life.

1 Like

The documentation at https://cmake.org/cmake/help/latest/ offers a “Quick search” bar on the left hand side. Is this what you’re looking for?

No that is not what I’m looking for.

As you pointed out cmake.org already offers searching functionality.

What I’m asking for is the ability to add cmake.org’s search functionality as a search engine in browsers:

This would most likely involve writing a browser extension, and I don’t think we’re likely to do that (though the community is free to take a crack at it themselves if there is demand for it.)

For what it’s worth, it doesn’t require writing a browser extension. This can be done in a standard way by writing an OpenSearch description. See Mozilla’s documentation here:

But since you’re using Sphinx to generate the docs, I’m pretty sure you can ask it to generate the OpenSearch description for you:

https://www.sphinx-doc.org/en/master/usage/configuration.html

See the html_use_opensearch option. It’s quite likely this would require only adding:

html_use_opensearch = 'https://cmake.org/cmake/help'

to Utilities/Sphinx/conf.py.in

3 Likes

With Chrome it’s very easy: Add a new search engine in the settings with the URL:
https://cmake.org/cmake/help/latest/search.html?q=%s
Or replace latest by whatever version you want.

Very interesting, thanks. I think we’d be willing to accept such a change into CMake if someone can prove that it works - and it sounds like it wouldn’t require writing much code.

The html_use_opensearch option mentioned above must be set for specific publication URLs, so I don’t think it makes sense to do that in CMake’s upstream source. Kitware uses an internal branch with a few tweaks for publication on the cmake.org site, so this could be added to that.

1 Like

I’ve updated the cmake.org docs such that starting with CMake 3.18 (currently the latest), the Sphinx documentation pages contain an OpenSearch description link in their header. The OpenSearch description tells browsers how to search under the Sphinx documentation for CMake’s latest version. Visit https://cmake.org/cmake/help/latest/ with an OpenSearch-capable browser to see this in action.

5 Likes

This is fantastic quality of life I’m extremely happy about this!
:partying_face: