build-cpp / cmkr

Modern build system based on CMake and TOML.
https://cmkr.build
MIT License
439 stars 27 forks source link

Improve the error message for `[fetch-content]` subkeys #80

Open mrexodia opened 1 year ago

mrexodia commented 1 year ago
# Reference: https://build-cpp.github.io/cmkr/cmake-toml
[project]
name = "ConsoleApplication1"

# TODO: define a target for each of your executables/libraries like this:
#[target.myexecutable]
#type = "executable" # static, shared
#sources = ["src/ConsoleApplication1/*.cpp", "include/ConsoleApplication1/*.hpp"]
#include-directories = ["include"]
#compile-features = ["cxx_std_11"]
#link-libraries = ["target-or-library"]

[fetch-content]
fmt = { git = "https://github.com/fmtlib/fmt", tag = "7.1.3" }

compile-features = ["cxx_std_20"]
[target.example]
type = "executable"
sources = ["src/Source.cpp"]
link-libraries = ["fmt::fmt"]

The error is:

[error] toml::value::contains(key): bad_cast to table
 --> D:\CodeBlocks\cmkr-atul\cmake.toml
    |
 17 | compile-features = ["cxx_std_20"]
    |                    ~~~~~~~~~~~~~~ the actual type is array