kainjow / Mustache

Mustache text templates for modern C++
Boost Software License 1.0
357 stars 49 forks source link

build(cmake): improve cmake for header only lib #37

Closed gocarlos closed 4 years ago

gocarlos commented 5 years ago

this MR improves the usage of this library in the context of a cmake based project.

this MR adds the needed patches to install the header file as well as cmake files which can be used to do find_package by consumer projects

codecov-io commented 5 years ago

Codecov Report

Merging #37 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #37   +/-   ##
=======================================
  Coverage   99.59%   99.59%           
=======================================
  Files           2        2           
  Lines        1479     1479           
=======================================
  Hits         1473     1473           
  Misses          6        6

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c34f602...f12bc8a. Read the comment docs.

gocarlos commented 5 years ago

@kainjow do know why the appveyor pipeline is failing?

kainjow commented 5 years ago

The Windows tests are failing because you renamed the mustache executable.

'Release\mustache.exe' is not recognized as an internal or external command, operable program or batch file.

See https://github.com/kainjow/Mustache/blob/master/appveyor.yml#L16

kainjow commented 5 years ago

Can you add a cross-platform test for this so we know it works on Mac, Windows, and Linux? I imagine it could be a CMake file with an extremely minimal use of the library. The CMake file would then use this existing CMake file like the example you created. The project would then be built and executed, exiting on error.

gocarlos commented 5 years ago

We can set CMAKE_INSTALL_PREFIX to be what ever we want e.g. home directory.

Though cmake only searches in the default paths for the platform e.g. /usr/ or C://Program Files....(have no idea about windows)

To install files to /usr you need sudo

kainjow commented 4 years ago

I've decided to keep the project simple and restrict the CMakeLists.txt and Makefile to tests only, which was the original intention all along. I appreciate the contribution though.

gocarlos commented 4 years ago

Humm, using mustache in context of packaging e.g. debian, yocto, conan is defficult with the existing solition...

Probably is cpp still a mess in regards to package managers as lib maintainers still want to distribute headers instead of a well defined package...

Sorry for the rant, just you cannot imagine how much time the consumers of this lib spend because you do not accept simple changes and this one....

And packagers will have to maintain patches for ever downstream