How to handle manpages that have multiple items?

man malloc, man realloc, etc., all point to the same page – they’re ln’d together. How do I handle it in cmake?

Try this: Symbolic links CMake - Stack Overflow

Thanks, that helps. I am a bit surprised cmake can’t figure it out on its own, text parsing of the .1, .pod, etc., files. Shrug. A small perl script will do it.

I thought you were trying to get away from perl scripts? :-P

But I need a way to get all the NAMES out of the manpage. That is what I am surprised CMake doesn’t have. So for example

.TH MALLOC 3  2020-06-09 "GNU" "Linux Programmer's Manual"
.SH NAME
malloc, free, calloc, realloc, reallocarray \- allocate and free dynamic memory
.SH SYNOPSIS
...

My little script can get the names (it also works for OpenBSD and POD variants).

And then I can use cmake facilities do install the symlinks.

Does this make sense?

A simple .cmake script should be sufficient to scrape that out; no need for perl!

Why would CMake (a system for building source code, primarily C/C++ source code) know anything about man pages and symbolic linking conventions for POSIX-like platforms at install time?

I am a cmake newbie, doing my first project (cmake by richsalz · Pull Request #199 · quictls/quictls · GitHub) and I was surprised to see that’s not handled, that’s all. No criticism intended. Perhaps I’ll rewrite the script into cmake at some point.

Oh I didn’t take it as criticism of me or of cmake :), it just seemed an odd expectation, which is why I asked.

Since in your profile you stated that you’re trying to get OpenSSL to a sane build system, I’d suggest trying to write the necessary script in CMake instead of perl. One of the AI chatbots can assist in generating the script :). If you write a perl script to extract the bits, you still have to communicate the result back to CMake anyway and that means writing CMake to parse the output of your perl script; might as well do it straight in CMake, I think you’ll find it takes about the same amount of work to do it directly in CMake as it does to write a perl script, have CMake invoke the perl script and parse the resulting output.

BTW, if I recognize the name correctly, I’m an old 90s usenet boy myself :)

Yes, you recognize the name correctly :). I’ll try to do it in cmake, now that I have the perl thing done. And I’ve given up on OpenSSL, doing this in a fork thereof.