From: Eric Haszlakiewicz Date: Sat, 30 May 2020 19:36:54 +0000 (+0000) Subject: Issue #626: Restore compatibility with cmake 2.8 by adjusting quoting and explicitly... X-Git-Tag: json-c-0.15-20200726~38 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fe308b886248b1a5fa610b04c9871907f80de3d2;p=json-c Issue #626: Restore compatibility with cmake 2.8 by adjusting quoting and explicitly defining the PROJECT_VERSION* variables. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 333513c..b52255f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 @@ -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")