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

This commit is contained in:
Eric Haszlakiewicz
2020-05-30 19:36:54 +00:00
parent 4a546e7b2f
commit fe308b8862

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")