Added a CMakeLists.txt

This commit is contained in:
Patrick Urbanke
2023-10-04 20:03:00 +02:00
parent 6d03f28eb2
commit 679021d030
3 changed files with 27 additions and 1 deletions
+1
View File
@@ -37,3 +37,4 @@
**/*.cmake
**/CMakeFiles/**
**/reflect-cpp-tests
**/build/**
+12
View File
@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.4)
project(reflectcpp)
include_directories(
"include"
)
add_library(reflectcpp SHARED "src/yyjson.c")
add_library(reflectcpp_static STATIC "src/yyjson.c")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O2")
+14 -1
View File
@@ -146,12 +146,25 @@ At the moment, this is work-in-progress. Here are some things that are still mis
## Installation
### Option 1: Header-only
If you **do not** need JSON support, then reflect-cpp is header-only. Simply copy the contents of the folder `include` into your source repository or add it to your include path.
If you **do** need JSON support, then you should also add `src/yyjson.c` to your source files for compilation. Note that `yyjson.c` is written in ANSI C.
### Option 2: Include source files into your own build
Simply copy the contents of the folder `include` into your source repository or add it to your include path and also add `src/yyjson.c` to your source files for compilation.
If you need support for other serialization formats like XML or flexbuffers, you should also include and link the respective libraries, as listed in the previous section.
### Option 3: Compilation using cmake
```
mkdir build
cd build
cmake ..
make
```
## Compiling the tests
To compile the tests, do the following: