# How to handle manpages that have multiple items?

**URL:** <https://discourse.cmake.org/t/how-to-handle-manpages-that-have-multiple-items/13567>\
**Category:** Code\
**Created:** [February 12, 2025, 9:39pm UTC](https://discourse.cmake.org/t/how-to-handle-manpages-that-have-multiple-items/13567 "2025-02-12T21:39:06Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![rsalz](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rsalz/32/5179_2.png) [@rsalz](https://discourse.cmake.org/u/rsalz)\
**Post date:** [February 12, 2025, 9:39pm UTC](https://discourse.cmake.org/t/how-to-handle-manpages-that-have-multiple-items/13567/1 "2025-02-12T21:39:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![LegalizeAdulthood](https://discourse.cmake.org/user_avatar/discourse.cmake.org/legalizeadulthood/32/5282_2.png) [@LegalizeAdulthood](https://discourse.cmake.org/u/LegalizeAdulthood)\
**Post date:** [February 14, 2025, 5:25pm UTC](https://discourse.cmake.org/t/how-to-handle-manpages-that-have-multiple-items/13567/2 "2025-02-14T17:25:37Z")

</div>

Try this: [Symbolic links CMake - Stack Overflow](https://stackoverflow.com/a/41037224/139855)

---

<div class="post-metadata">

**Author:** ![rsalz](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rsalz/32/5179_2.png) [@rsalz](https://discourse.cmake.org/u/rsalz)\
**Post date:** [February 14, 2025, 10:27pm UTC](https://discourse.cmake.org/t/how-to-handle-manpages-that-have-multiple-items/13567/3 "2025-02-14T22:27:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![LegalizeAdulthood](https://discourse.cmake.org/user_avatar/discourse.cmake.org/legalizeadulthood/32/5282_2.png) [@LegalizeAdulthood](https://discourse.cmake.org/u/LegalizeAdulthood)\
**Post date:** [February 16, 2025, 2:24am UTC](https://discourse.cmake.org/t/how-to-handle-manpages-that-have-multiple-items/13567/4 "2025-02-16T02:24:25Z")

</div>

> [@rsalz](#):
>
> A small perl script will do it.

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

---

<div class="post-metadata">

**Author:** ![rsalz](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rsalz/32/5179_2.png) [@rsalz](https://discourse.cmake.org/u/rsalz)\
**Post date:** [February 16, 2025, 4:18pm UTC](https://discourse.cmake.org/t/how-to-handle-manpages-that-have-multiple-items/13567/5 "2025-02-16T16:18:01Z")

</div>

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

```auto
.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?

---

<div class="post-metadata">

**Author:** ![LegalizeAdulthood](https://discourse.cmake.org/user_avatar/discourse.cmake.org/legalizeadulthood/32/5282_2.png) [@LegalizeAdulthood](https://discourse.cmake.org/u/LegalizeAdulthood)\
**Post date:** [February 18, 2025, 4:46pm UTC](https://discourse.cmake.org/t/how-to-handle-manpages-that-have-multiple-items/13567/6 "2025-02-18T16:46:37Z")

</div>

> [@rsalz](#):
>
> But I need a way to get all the NAMES out of the manpage.

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

> [@rsalz](#):
>
> That is what I am surprised CMake doesn’t have.

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?

---

<div class="post-metadata">

**Author:** ![rsalz](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rsalz/32/5179_2.png) [@rsalz](https://discourse.cmake.org/u/rsalz)\
**Post date:** [February 18, 2025, 5:13pm UTC](https://discourse.cmake.org/t/how-to-handle-manpages-that-have-multiple-items/13567/7 "2025-02-18T17:13:19Z")

</div>

I am a cmake newbie, doing my first project ([cmake by richsalz · Pull Request #199 · quictls/quictls · GitHub](https://github.com/quictls/quictls/pull/199)) 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.

---

<div class="post-metadata">

**Author:** ![LegalizeAdulthood](https://discourse.cmake.org/user_avatar/discourse.cmake.org/legalizeadulthood/32/5282_2.png) [@LegalizeAdulthood](https://discourse.cmake.org/u/LegalizeAdulthood)\
**Post date:** [February 18, 2025, 9:32pm UTC](https://discourse.cmake.org/t/how-to-handle-manpages-that-have-multiple-items/13567/8 "2025-02-18T21:32:26Z")

</div>

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 `:)`

---

<div class="post-metadata">

**Author:** ![rsalz](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rsalz/32/5179_2.png) [@rsalz](https://discourse.cmake.org/u/rsalz)\
**Post date:** [February 18, 2025, 9:39pm UTC](https://discourse.cmake.org/t/how-to-handle-manpages-that-have-multiple-items/13567/9 "2025-02-18T21:39:18Z")

</div>

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.
