-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create .cmake file to allow higher flexibility of end user
- Loading branch information
Showing
2 changed files
with
35 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,3 @@ | ||
cmake_minimum_required(VERSION 3.22) | ||
|
||
# Setup generic source files | ||
set(lwjson_core_SRCS | ||
${CMAKE_CURRENT_LIST_DIR}/src/lwjson/lwjson.c | ||
${CMAKE_CURRENT_LIST_DIR}/src/lwjson/lwjson_stream.c | ||
) | ||
|
||
# Debug sources | ||
set(lwjson_debug_SRCS | ||
${CMAKE_CURRENT_LIST_DIR}/src/lwjson/lwjson_debug.c | ||
) | ||
|
||
# Setup include directories | ||
set(lwjson_include_DIRS | ||
${CMAKE_CURRENT_LIST_DIR}/src/include | ||
) | ||
|
||
# Register core library to the system | ||
add_library(lwjson INTERFACE) | ||
target_sources(lwjson PUBLIC ${lwjson_core_SRCS}) | ||
target_include_directories(lwjson INTERFACE ${lwjson_include_DIRS}) | ||
|
||
# Register lwjson debug module | ||
add_library(lwjson_debug INTERFACE) | ||
target_sources(lwjson_debug PUBLIC ${lwjson_debug_SRCS}) | ||
target_include_directories(lwjson_debug INTERFACE ${lwjson_include_DIRS}) | ||
|
||
# Create config file | ||
if(DEFINED LWJSON_OPTS_DIR AND NOT EXISTS ${LWJSON_OPTS_DIR}/lwjson_opts.h) | ||
configure_file(${CMAKE_CURRENT_LIST_DIR}/src/include/lwjson/lwjson_opts_template.h ${LWJSON_OPTS_DIR}/lwjson_opts.h COPYONLY) | ||
endif() | ||
include(${CMAKE_CURRENT_LIST_DIR}/library.cmake) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Setup generic source files | ||
set(lwjson_core_SRCS | ||
${CMAKE_CURRENT_LIST_DIR}/src/lwjson/lwjson.c | ||
${CMAKE_CURRENT_LIST_DIR}/src/lwjson/lwjson_stream.c | ||
) | ||
|
||
# Debug sources | ||
set(lwjson_debug_SRCS | ||
${CMAKE_CURRENT_LIST_DIR}/src/lwjson/lwjson_debug.c | ||
) | ||
|
||
# Setup include directories | ||
set(lwjson_include_DIRS | ||
${CMAKE_CURRENT_LIST_DIR}/src/include | ||
) | ||
|
||
# Register core library to the system | ||
add_library(lwjson INTERFACE) | ||
target_sources(lwjson PUBLIC ${lwjson_core_SRCS}) | ||
target_include_directories(lwjson INTERFACE ${lwjson_include_DIRS}) | ||
target_compile_options(lwjson PRIVATE ${LWJSON_COMPILE_OPTIONS}) | ||
target_compile_definitions(lwjson PRIVATE ${LWJSON_COMPILE_DEFINITIONS}) | ||
|
||
# Register lwjson debug module | ||
add_library(lwjson_debug INTERFACE) | ||
target_sources(lwjson_debug PUBLIC ${lwjson_debug_SRCS}) | ||
target_include_directories(lwjson_debug INTERFACE ${lwjson_include_DIRS}) | ||
target_compile_options(lwjson_debug PRIVATE ${LWJSON_COMPILE_OPTIONS}) | ||
target_compile_definitions(lwjson_debug PRIVATE ${LWJSON_COMPILE_DEFINITIONS}) | ||
|
||
# Create config file | ||
if(DEFINED LWJSON_OPTS_DIR AND NOT EXISTS ${LWJSON_OPTS_DIR}/lwjson_opts.h) | ||
configure_file(${CMAKE_CURRENT_LIST_DIR}/src/include/lwjson/lwjson_opts_template.h ${LWJSON_OPTS_DIR}/lwjson_opts.h COPYONLY) | ||
endif() |