Browse Source

Issue #626: Restore compatibility with cmake 2.8 by adjusting quoting and explicitly defining the PROJECT_VERSION* variables.

tags/json-c-0.15-20200726
Eric Haszlakiewicz 5 years ago
parent
commit
fe308b8862
1 changed files with 16 additions and 8 deletions
  1. +16
    -8
      CMakeLists.txt

+ 16
- 8
CMakeLists.txt View File

@@ -7,7 +7,15 @@ if(POLICY CMP0048)
endif() endif()


# JSON-C library is C only project. # 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 we've got 3.0 then it's good, let's provide support. Otherwise, leave it be.
if(POLICY CMP0038) if(POLICY CMP0038)
@@ -207,11 +215,11 @@ check_type_size("long long" SIZEOF_LONG_LONG)
check_type_size("size_t" SIZEOF_SIZE_T) check_type_size("size_t" SIZEOF_SIZE_T)


check_c_source_compiles( check_c_source_compiles(
[=[
"
extern void json_object_get(); 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;} int main(int c, char *v) { return 0;}
]=]
"
HAS_GNU_WARNING_LONG) HAS_GNU_WARNING_LONG)


check_c_source_compiles( check_c_source_compiles(
@@ -270,7 +278,7 @@ endif()


if (NOT ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")) if (NOT ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC"))
check_c_source_compiles( check_c_source_compiles(
[=[
"
/* uClibc toolchains without threading barf when _REENTRANT is defined */ /* uClibc toolchains without threading barf when _REENTRANT is defined */
#define _REENTRANT 1 #define _REENTRANT 1
#include <sys/types.h> #include <sys/types.h>
@@ -278,7 +286,7 @@ if (NOT ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC"))
{ {
return 0; return 0;
} }
]=]
"
REENTRANT_WORKS REENTRANT_WORKS
) )
if (REENTRANT_WORKS) if (REENTRANT_WORKS)
@@ -289,12 +297,12 @@ if (NOT ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC"))
# Others may not support it, too. # Others may not support it, too.
list(APPEND CMAKE_REQUIRED_LIBRARIES "-Wl,-Bsymbolic-functions") list(APPEND CMAKE_REQUIRED_LIBRARIES "-Wl,-Bsymbolic-functions")
check_c_source_compiles( check_c_source_compiles(
[=[
"
int main (void) int main (void)
{ {
return 0; return 0;
} }
]=]
"
BSYMBOLIC_WORKS BSYMBOLIC_WORKS
) )
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "-Wl,-Bsymbolic-functions") list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "-Wl,-Bsymbolic-functions")


Loading…
Cancel
Save