]> granicus.if.org Git - json-c/commitdiff
Issue #626: Restore compatibility with cmake 2.8 by adjusting quoting and explicitly...
authorEric Haszlakiewicz <erh+git@nimenees.com>
Sat, 30 May 2020 19:36:54 +0000 (19:36 +0000)
committerEric Haszlakiewicz <erh+git@nimenees.com>
Sat, 30 May 2020 19:37:46 +0000 (19:37 +0000)
CMakeLists.txt

index 333513c5e09598651d93165331da91ff89adb644..b52255f5c6d8744b2cd5ea393540844461068036 100644 (file)
@@ -7,7 +7,15 @@ if(POLICY CMP0048)
 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)
@@ -207,11 +215,11 @@ check_type_size("long long"         SIZEOF_LONG_LONG)
 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(
@@ -270,7 +278,7 @@ endif()
 
 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>
@@ -278,7 +286,7 @@ if (NOT ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC"))
        {
          return 0;
        }
-       ]=]
+       "
        REENTRANT_WORKS
        )
        if (REENTRANT_WORKS)
@@ -289,12 +297,12 @@ if (NOT ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC"))
        # 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")