Doing a version of tutorial using zlib. Questions about provided CMakeLists.txt

Having completed the CMake tutorial decided to do it again but with a different dance partner, instead of a simple square root function will be using zlib (Home page, GitHub, Wikipedia)

The code on GitHub provides a CMakeLists.txt.

Being a CMake newbie am not sure if the CMakeLists.txt can be improved.

One of the first questions that pops to mind is that

cmake_minimum_required(VERSION 2.4.4)

is at 2.4.4.

That could be good or bad. Good in that it is low enough that other code including this in a build would not need to upgrade CMake, bad in that it is not requiring Modern CMake practices.

Feedback desired.

I would not use zlib as a paragon of CMake code (it’s not horrible, but it’s not something I’d use as a template either). If you look at some of my PRs, that can point you at where improvements can be made at least.

1 Like