lunasvg icon indicating copy to clipboard operation
lunasvg copied to clipboard

CMake modernization

Open seanharmer opened this issue 2 years ago • 4 comments

These changes makes it much easier to use lunasvg in downstream projects either by hand or via CMake's FetchContent.

seanharmer avatar Apr 21 '22 12:04 seanharmer

Wonderful work... I'll take a closer look. <3

sammycage avatar Apr 21 '22 13:04 sammycage

Have you had a chance to take a look at this please?

seanharmer avatar May 17 '22 14:05 seanharmer

@seanharmer

  • Will include(GNUInstallDirs) bork the CMakeLists.txt for me on Windows?
  • Where is lunasvg_export.h defined? (or lunasvgexport.h per existing naming conventions) I don't see it in this PR.

fdwr avatar May 19 '22 07:05 fdwr

  • Will include(GNUInstallDirs) bork the CMakeLists.txt for me on Windows?

I think it's fine. It just helps put the build artifacts under install dir/bin install dir/include etc. It worked for me on Windows anyway.

  • Where is lunasvg_export.h defined? (or lunasvgexport.h per existing naming conventions) I don't see it in this PR.

Ah right. This header file is generated into the build dir when you run cmake. The line that generates it is:

include(GenerateExportHeader)
generate_export_header(lunasvg)

It just saves us hand crafting a suitable export header for shared/static libs. The full documentation is at:

https://cmake.org/cmake/help/latest/module/GenerateExportHeader.html

Hope this helps! :)

seanharmer avatar May 19 '22 07:05 seanharmer

Good job. This is an important change. Hope it lands at some point :)

Pospelove avatar Mar 17 '23 09:03 Pospelove

Thank you, @seanharmer. I apologize for the delay in responding.

sammycage avatar Mar 17 '23 10:03 sammycage