Using cmake with nginx

Dmitry Petrov dmitry.petroff at gmail.com
Fri Dec 2 11:07:43 UTC 2022


Hello!

I'm sure many developers have faced issues with manual dependency handling
in the nginx build system. I've tried several workarounds which were
semi-acceptable for personal use, but definitely not something that you
would offer other people to use.

Then I thought that it would be easy to add objs/Makefile -> CMakeList.txt
converted, because makefile is strictly-formatted, but what if we add a
primitive CMakeLists.txt generator to auto/make?

I've made a quick and dirty prototype and it was quite successful (for *nix
environment as it relies on sed-ing compiler/linker flags).

I'm attaching a small patch of that proof-of-concept attempt (based on v
1.17.10). And I just want to ask if the community is interested in having
some kind of cmake support. The advantages for developers are:
- automatic dependency handling
- easier integration with clang-based tools (cmake can generate
compile_commands.json on its own rather that using tools such as
https://github.com/rizsotto/Bear)
- cmake can target not only makefiles (for example Visual Studio, if anyone
uses it)
- it's easier to use C++ with cmake as it inherently has an ability to use
different set of compiler flags for C and C++ compilers

-- 
Regards,
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20221202/5544a27b/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: auto-cmake.diff
Type: text/x-patch
Size: 3868 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20221202/5544a27b/attachment.bin>


More information about the nginx-devel mailing list