Browse Source

Merge pull request #634 from micahsnyder/json-c-fPIC

Issue #508: `-fPIC` to link libjson-c.a with libs
tags/json-c-0.15-20200726
Eric Hawicz GitHub 5 years ago
parent
commit
401b29c021
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions
  1. +8
    -0
      CMakeLists.txt
  2. +1
    -0
      README.md

+ 8
- 0
CMakeLists.txt View File

@@ -110,6 +110,14 @@ if (MSVC)
list(APPEND CMAKE_REQUIRED_FLAGS /wd4996)
endif()

if (NOT DISABLE_STATIC_FPIC)
# Use '-fPIC'/'-fPIE' option.
# This will allow other libraries to statically link in libjson-c.a
# which in turn prevents crashes in downstream apps that may use
# a different JSON library with identical symbol names.
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()

check_include_file("fcntl.h" HAVE_FCNTL_H)
check_include_file("inttypes.h" HAVE_INTTYPES_H)
check_include_file(stdarg.h HAVE_STDARG_H)


+ 1
- 0
README.md View File

@@ -99,6 +99,7 @@ CMAKE_INSTALL_PREFIX | String | The install location.
CMAKE_BUILD_TYPE | String | Defaults to "debug".
BUILD_SHARED_LIBS | Bool | The default build generates a dynamic (dll/so) library. Set this to OFF to create a static library only.
BUILD_STATIC_LIBS | Bool | The default build generates a static (lib/a) library. Set this to OFF to create a shared library only.
DISABLE_STATIC_FPIC | Bool | The default builds position independent code. Set this to OFF to create a shared library only.
DISABLE_BSYMBOLIC | Bool | Disable use of -Bsymbolic-functions.
DISABLE_THREAD_LOCAL_STORAGE | Bool | Disable use of Thread-Local Storage (HAVE___THREAD).
DISABLE_WERROR | Bool | Disable use of -Werror.


Loading…
Cancel
Save