endif()
# JSON-C library is C only project.
-project(json-c LANGUAGES C VERSION 0.14.99)
+if (CMAKE_VERSION VERSION_LESS 3.0)
+ project(json-c)
+ set(PROJECT_VERSION_MAJOR "0")
+ set(PROJECT_VERSION_MINOR "14")
+ set(PROJECT_VERSION_PATCH "99")
+ set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
+else()
+ project(json-c LANGUAGES C VERSION 0.14.99)
+endif()
# If we've got 3.0 then it's good, let's provide support. Otherwise, leave it be.
if(POLICY CMP0038)
check_type_size("size_t" SIZEOF_SIZE_T)
check_c_source_compiles(
-[=[
+"
extern void json_object_get();
-__asm__(".section .gnu.json_object_get\\n\\t.ascii \\"Please link against libjson-c instead of libjson\\"\\n\\t.text");
+__asm__(\".section .gnu.json_object_get\\n\\t.ascii \\\"Please link against libjson-c instead of libjson\\\"\\n\\t.text\");
int main(int c, char *v) { return 0;}
-]=]
+"
HAS_GNU_WARNING_LONG)
check_c_source_compiles(
if (NOT ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC"))
check_c_source_compiles(
- [=[
+ "
/* uClibc toolchains without threading barf when _REENTRANT is defined */
#define _REENTRANT 1
#include <sys/types.h>
{
return 0;
}
- ]=]
+ "
REENTRANT_WORKS
)
if (REENTRANT_WORKS)
# Others may not support it, too.
list(APPEND CMAKE_REQUIRED_LIBRARIES "-Wl,-Bsymbolic-functions")
check_c_source_compiles(
- [=[
+ "
int main (void)
{
return 0;
}
- ]=]
+ "
BSYMBOLIC_WORKS
)
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "-Wl,-Bsymbolic-functions")