tomlplusplus: Installation and use with Meson doesn't seem to work
Environment
toml++ version and/or commit hash:
3.3.0 from meson subproject
Compiler:
Apple Clang 13
C++ standard mode:
not sure, the default one
Target arch:
x86_64
Library configuration overrides:
Relevant compilation flags:
Describe the bug
../main.cxx:2:10: fatal error: 'toml++/toml.hpp' file not found
#include <toml++/toml.hpp>
where main.cxx is this example
Steps to reproduce (or a small repro code sample)
Follow the instructions and use the following build configuration
meson.build
project('test_tomlplusplus', 'cpp')
tomlplusplus = dependency('tomlplusplus')
executable('main', 'main.cxx', dependencies : tomlplusplus)
then compile with meson compile -C build
Additional information
This is my meson setup output
The Meson build system
Version: 1.3.1
Source dir: /Users/michele/Documents/Programming/test_tomlplusplus
Build dir: /Users/michele/Documents/Programming/test_tomlplusplus/build_meson
Build type: native build
Project name: test_tomlplusplus
Project version: undefined
C++ compiler for the host machine: c++ (clang 13.0.0 "Apple clang version 13.0.0 (clang-1300.0.29.30)")
C++ linker for the host machine: c++ ld64 711
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: YES (/usr/local/bin/pkg-config) 0.29.2
Found CMake: /usr/local/bin/cmake (3.28.1)
Run-time dependency tomlplusplus found: NO (tried pkgconfig, framework and cmake)
Looking for a fallback subproject for the dependency tomlplusplus
Executing subproject tomlplusplus
tomlplusplus| Project name: tomlplusplus
tomlplusplus| Project version: 3.3.0
tomlplusplus| C++ compiler for the host machine: c++ (clang 13.0.0 "Apple clang version 13.0.0 (clang-1300.0.29.30)")
tomlplusplus| C++ linker for the host machine: c++ ld64 711
tomlplusplus| Message: target cpu_family: x86_64
tomlplusplus| Message: target cpu: x86_64
tomlplusplus| Message: target system: darwin
tomlplusplus| Message: target endian: little
tomlplusplus| Compiler for C++ supports arguments -ferror-limit=5: YES
tomlplusplus| Compiler for C++ supports arguments -fmax-errors=5: NO
tomlplusplus| Compiler for C++ supports arguments -Wno-unused-command-line-argument: YES
tomlplusplus| Compiler for C++ supports arguments -Wno-reserved-macro-identifier: NO
tomlplusplus| Compiler for C++ supports arguments -Wno-init-list-lifetime: NO
tomlplusplus| Compiler for C++ supports arguments -fchar8_t: YES
tomlplusplus| Compiler for C++ supports arguments /bigobj: NO
tomlplusplus| Compiler for C++ supports arguments /Gy: NO
tomlplusplus| Compiler for C++ supports arguments /GF: NO
tomlplusplus| Compiler for C++ supports arguments /openmp-: NO
tomlplusplus| Compiler for C++ supports arguments /permissive-: NO
tomlplusplus| Compiler for C++ supports arguments /utf-8: NO
tomlplusplus| Compiler for C++ supports arguments /volatile:iso: NO
tomlplusplus| Compiler for C++ supports arguments /Zc:__cplusplus: NO
tomlplusplus| Compiler for C++ supports arguments /Zc:inline: NO
tomlplusplus| Compiler for C++ supports arguments /Zc:externConstexpr: NO
tomlplusplus| Compiler for C++ supports arguments /Zc:preprocessor: NO
tomlplusplus| Compiler for C++ supports arguments /Zc:throwingNew: NO
tomlplusplus| Compiler for C++ supports arguments -D_HAS_EXCEPTIONS=1: YES
tomlplusplus| Compiler for C++ supports arguments -Wno-c++98-compat: YES
tomlplusplus| Compiler for C++ supports arguments -Wno-c++98-compat-pedantic: YES
tomlplusplus| Compiler for C++ supports arguments -Wno-documentation: YES
tomlplusplus| Compiler for C++ supports arguments -Wno-documentation-unknown-command: YES
tomlplusplus| Compiler for C++ supports arguments -Wno-switch-enum: YES
tomlplusplus| Compiler for C++ supports arguments -Wno-covered-switch-default: YES
tomlplusplus| Compiler for C++ supports arguments -Wno-padded: YES
tomlplusplus| Compiler for C++ supports arguments -Wno-float-equal: YES
tomlplusplus| Compiler for C++ supports arguments -DTOML_HEADER_ONLY=0: YES
tomlplusplus| Compiler for C++ supports arguments -DTOML_SHARED_LIB=1: YES
tomlplusplus| Build targets in project: 1
tomlplusplus| Subproject tomlplusplus finished.
Dependency tomlplusplus found: YES 3.3.0 (overridden)
Build targets in project: 2
test_tomlplusplus undefined
Subprojects
tomlplusplus: YES
Found ninja-1.11.1 at /usr/local/bin/ninja
while the following is the (working) CMake configuration
cmake_minimum_required(VERSION 3.27)
project(test_tomlplusplus)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
include(FetchContent)
FetchContent_Declare(
tomlplusplus
GIT_REPOSITORY https://github.com/marzer/tomlplusplus.git
GIT_TAG v3.4.0
)
FetchContent_MakeAvailable(tomlplusplus)
add_executable(main main.cxx)
# target_link_libraries(main PUBLIC tomlplusplus)
target_include_directories(main PUBLIC
${tomlplusplus_SOURCE_DIR}/include
)
About this issue
- Original URL
- State: closed
- Created 6 months ago
- Comments: 18 (10 by maintainers)
The header include has been fixed in the documentation, as now there’s a version selector - it’ll be the correct value if you switch it to v3.3.0 😃
This is the old style, for when your wrap file doesn’t support
[provide].This doesn’t work at all, since tomlplusplus_dep is a meson.build script variable, not the name of a registered dependency.
…
The documentation suggests this:
which works fine, but could be improved a bit:
since that will guarantee having “at least version 3.4.0”, and that’s something you want in order to provide consistency and reliability e.g. in terms of header include name. Plus, many of the examples for adding it to your project include minimum requirements like this.
Yep, the .h version isn’t going anywhere 😃