mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
Make/CMake: Fix use of compiler flags
CMake: Option was not enabled by default as intended. Makefile: Flags were not passed when building the tests
This commit is contained in:
parent
d0a9f46888
commit
4703f01cf4
@ -12,7 +12,7 @@ set(CJSON_VERSION_SO 1)
|
|||||||
set(CJSON_UTILS_VERSION_SO 1)
|
set(CJSON_UTILS_VERSION_SO 1)
|
||||||
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
||||||
|
|
||||||
option(ENABLE_CUSTOM_COMPILER_FLAGS ON)
|
option(ENABLE_CUSTOM_COMPILER_FLAGS "Enables custom compiler flags for Clang and GCC" ON)
|
||||||
if (ENABLE_CUSTOM_COMPILER_FLAGS)
|
if (ENABLE_CUSTOM_COMPILER_FLAGS)
|
||||||
if(("${CMAKE_C_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_C_COMPILER_ID}" MATCHES "Clang"))
|
if(("${CMAKE_C_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_C_COMPILER_ID}" MATCHES "Clang"))
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c89 -pedantic -Wall -Wextra -Werror -Wstrict-prototypes -Wwrite-strings")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c89 -pedantic -Wall -Wextra -Werror -Wstrict-prototypes -Wwrite-strings")
|
||||||
|
6
Makefile
6
Makefile
@ -62,15 +62,15 @@ test: tests
|
|||||||
./$(UTILS_TEST)
|
./$(UTILS_TEST)
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$(CC) -ansi -pedantic -c $(R_CFLAGS) $<
|
$(CC) -c $(R_CFLAGS) $<
|
||||||
|
|
||||||
#tests
|
#tests
|
||||||
#cJSON
|
#cJSON
|
||||||
$(CJSON_TEST): cJSON.c cJSON.h test.c
|
$(CJSON_TEST): cJSON.c cJSON.h test.c
|
||||||
$(CC) $^ -o $@ $(LDLIBS) -I.
|
$(CC) $(R_CFLAGS) $^ -o $@ $(LDLIBS) -I.
|
||||||
#cJSON_Utils
|
#cJSON_Utils
|
||||||
$(UTILS_TEST): cJSON.c cJSON.h test.c
|
$(UTILS_TEST): cJSON.c cJSON.h test.c
|
||||||
$(CC) $^ -o $@ $(LDLIBS) -I.
|
$(CC) $(R_CFLAGS) $^ -o $@ $(LDLIBS) -I.
|
||||||
|
|
||||||
#static libraries
|
#static libraries
|
||||||
#cJSON
|
#cJSON
|
||||||
|
Loading…
Reference in New Issue
Block a user