Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate CMake configuration file #20

Closed
traversaro opened this issue Apr 6, 2020 · 5 comments · Fixed by #22
Closed

Generate CMake configuration file #20

traversaro opened this issue Apr 6, 2020 · 5 comments · Fixed by #22
Assignees
Labels
cmake Issues relating to cmake. feature New feature or enhancement request

Comments

@traversaro
Copy link

traversaro commented Apr 6, 2020

Is your feature request related to a problem? Please describe.
It would be great if tomlplusplus could install a CMake config file to permit downstream users to use it in CMake by simply:

find_package(tomlplusplus REQUIRED)

// ...

target_link_libraries(<downstream_target> PRIVATE tomlplusplus::tomlplusplus)

Describe the solution you'd like
I think this is possible by using meson support for writing CMake configuration files, see https://mesonbuild.com/CMake-module.html#cmake-configuration-files .

Describe alternatives you've considered
The alternative is to leave to downstream users to write and install a Findtomlplusplus.cmake file, see ami-iit/bipedal-locomotion-framework#26 (comment)

Additional context
Depending on wheter we end up using toml++ in our projects, I may be happy to work on it myself. This should also simplify the integration of toml++ in vcpkg (see microsoft/vcpkg#10667).

cc @GiulioRomualdi @S-Dafarra

@marzer
Copy link
Owner

marzer commented Apr 6, 2020

Ah, thanks @traversaro. Since I'm largely a cmake novice this may take me a while to dig into, so if you do decide to work on this yourself I'd be very grateful!

An alternative short-term workaround is to eliminate the need for build systems and subprojects completely by dropping the single-file version of the library toml.hpp in your source tree.

@marzer marzer added good first issue Good for newcomers help wanted Extra attention is needed cmake Issues relating to cmake. labels Apr 6, 2020
@marzer
Copy link
Owner

marzer commented Apr 6, 2020

On an unrelated note, I just had a look at the linked issue and noticed that my use of <charconv> is problematic for you guys. Since I'm already forced to use stringstreams on some platforms, there's no significant reason why I can't add support for an entirely stringstream-based mode, if that's helpful.

@GiulioRomualdi
Copy link
Contributor

Hi @marzer, If it's ok for you I can propose a PR with the solution described by @traversaro in #20 (comment)

@marzer
Copy link
Owner

marzer commented Apr 7, 2020

Yup, go for it! I'm going to push a fix for the <charconv> issue and the locale issue later today, so I won't merge anything in until after that, but if it's just build configuration stuff I'm sure it'll be fairly simple to merge.

@marzer
Copy link
Owner

marzer commented Apr 7, 2020

@traversaro @GiulioRomualdi I've just done some minor cleanup to move the cmake stuff behind a configuration option GENERATE_CMAKE_CONFIG that defaults to auto (disabled when invoked as a submodule, enabled otherwise). It should still 'just work', but if you want to be explicit about it you can when you invoke meson, e.g.:

CXX=clang++ meson build-clang -DGENERATE_CMAKE_CONFIG=enabled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmake Issues relating to cmake. feature New feature or enhancement request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants