This commit is contained in:
xiaoji 2024-04-03 07:28:24 +13:00 committed by GitHub
commit 91e43c2872
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 1 deletions

View File

@ -323,11 +323,19 @@ if(JANSSON_BUILD_SHARED_LIBS)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--default-symver")
else()
# some linkers may only support --version-script
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/jansson.sym" "JANSSON_${JANSSON_SOVERSION} {
if (UNIX)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/jansson.sym" "libjansson.so.${JANSSON_SOVERSION} {
global:
*;
};
")
else ()
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/jansson.sym" "JANSSON_${JANSSON_SOVERSION} {
global:
*;
};
")
endif ()
list(APPEND CMAKE_REQUIRED_LIBRARIES "-Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/jansson.sym")
check_c_source_compiles(
"

View File

@ -25,6 +25,10 @@ source distribution for details.
Compilation and Installation
----------------------------
Unix-like building system
It supports Unix-like Operating System and MingW.
If you obtained a ``jansson-X.Y.tar.*`` tarball from GitHub Releases, just use
the standard autotools commands::
@ -41,6 +45,20 @@ script has to be generated first. The easiest way is to use autoreconf::
$ autoreconf -i
Cmake building system
It supports Windows, MacOS, Linux, Android and many other OS.
$ mkdir build && cd build
$ cmake ..
$ make
To run the test suite, invoke::
$ ctest
If you want to building the shared libraries, please add
-DJANSSON_BUILD_SHARED_LIBS=ON
Documentation
-------------