| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
CMakeJSON provides a way to declare CMake projects and targets via *.json files. Furthermore, it also automatically export your targets and keeps track of your dependencies to generate correct <PackageName>Config.cmake files for find_package to simply work for your project/package.
CMake is the defactor standard for a cross platform (meta) buildsystem but some people do not like it due to its syntax and/or complexity. CMakeJSON gives those people another (maybe simpler&cleaner) approach to CMake.
In the current state, CMakeJSON is mainly targeted at smaller projects which have a not too complicated CMakeLists.txt. Bigger projects are also possible due to the possibility to mix normal CMake with CMakeJSON but further functionallity might be needed to ease the usage with CMakeJSON.
The recommended way to use CMakeJSON is to include it as a submodule in your project and use include(<submodulepath>/CMakeJSON/CMakeJSON.cmake). CMakeJSON is based on the experince with CMakeCS and the newly added JSON parser to CMake. Due to that a CMake version of at least 3.19 is required.
List of json members allowed for:
Other questions might be answered in the FAQ Parsing logic
Note: Currently no validation is done on the passed in *.json files. So make sure your field/members names are correctly spelled and have the correct type.
Examples for using CMakeJSON can be found in examples. The simplest CMakeJSON project looks like this:
CMakeLists.txt:
cmake_minimum_required(VERSION 3.19)
set(CMakeJSON_ENABLE_PROJECT_OVERRIDE ON) # defines a macro called project() to silence a CMake Warning
include("${CMAKE_CURRENT_SOURCE_DIR}/CMakeJSON/CMakeJSON.cmake")
project("<projectname>.json")
# alternativly: if you don't want to use CMakeJSON_ENABLE_PROJECT_OVERRIDE
# project(something) # this project call is mandatory since CMake throws a dev warning otherwise
# cmakejson_project_file("<projectname>.json")
<projectname>.json read via cmakejson_project_file(<filename>):
{
"homepage" : "<someurl>",
"description" : "<somedescription>",
"version" : "0.1.0",
"languages" : ["CXX"],
"list" : [
"<libname>.target.json"
]
}
<libname>.target.json read via cmakejson_target_file(<filename>):
{
"target_type" : "library",
"sources" : [
"src/somesource.cpp"
]
}
In the future:
Different Examples for using CMakeJSON can be found in examples.
| Back | FazBrowse Home | New Git URL |