"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "CMakeLists.txt" between
jansson-2.13.1.tar.bz2 and jansson-2.14.tar.bz2

About: Jansson is a C library for encoding, decoding and manipulating JSON data.

CMakeLists.txt  (jansson-2.13.1.tar.bz2):CMakeLists.txt  (jansson-2.14.tar.bz2)
# Notes:
#
# Author: Paul Harris, June 2012
# Additions: Joakim Soderberg, February 2013
#
# Supports: building static/shared, release/debug/etc, can also build html docs
# and some of the tests.
# Note that its designed for out-of-tree builds, so it will not pollute your
# source tree.
#
# TODO 1: Finish implementing tests. api tests are working, but the valgrind
# variants are not flagging problems.
#
# TODO 2: There is a check_exports script that would try and incorporate.
#
# TODO 3: Consolidate version numbers, currently the version number is written
# into: * cmake (here) * autotools (the configure) * source code header files.
# Should not be written directly into header files, autotools/cmake can do
# that job.
#
# Brief intro on how to use cmake:
# > mkdir build (somewhere - we do out-of-tree builds)
# > use cmake, ccmake, or cmake-gui to configure the project. for linux, you
# can only choose one variant: release,debug,etc... and static or shared.
# >> example:
# >> cd build
# >> ccmake -i ../path_to_jansson_dir
# >> inside, configure your options. press C until there are no lines
# with * next to them.
# >> note, I like to configure the 'install' path to ../install, so I get
# self-contained clean installs I can point other projects to.
# >> press G to 'generate' the project files.
# >> make (to build the project)
# >> make install
# >> make test (to run the tests, if you enabled them)
#
# Brief description on how it works:
# There is a small hierarchy of CMakeLists.txt files which define how the
# project is built.
# Header file detection etc is done, and the results are written into config.h
# and jansson_config.h, which are generated from the corresponding
# config.h.cmake and jansson_config.h.cmake template files.
# The generated header files end up in the build directory - not in
# the source directory.
# The rest is down to the usual make process.
cmake_minimum_required (VERSION 3.1) cmake_minimum_required (VERSION 3.1)
project(jansson C) project(jansson C)
# Options # Options
option(JANSSON_BUILD_SHARED_LIBS "Build shared libraries." OFF) option(JANSSON_BUILD_SHARED_LIBS "Build shared libraries." OFF)
option(USE_URANDOM "Use /dev/urandom to seed the hash function." ON) option(USE_URANDOM "Use /dev/urandom to seed the hash function." ON)
option(USE_WINDOWS_CRYPTOAPI "Use CryptGenRandom to seed the hash function." ON) option(USE_WINDOWS_CRYPTOAPI "Use CryptGenRandom to seed the hash function." ON)
if (MSVC) if (MSVC)
# This option must match the settings used in your program, in particular if you # This option must match the settings used in your program, in particular if you
# are linking statically # are linking statically
option(JANSSON_STATIC_CRT "Link the static CRT libraries" OFF ) option(JANSSON_STATIC_CRT "Link the static CRT libraries" OFF )
endif () endif ()
option(JANSSON_EXAMPLES "Compile example applications" ON) option(JANSSON_EXAMPLES "Compile example applications" ON)
if (UNIX) if (UNIX)
option(JANSSON_COVERAGE "(GCC Only! Requires gcov/lcov to be installed). Incl ude target for doing coverage analysis for the test suite. Note that -DCMAKE_BUI LD_TYPE=Debug must be set" OFF) option(JANSSON_COVERAGE "(GCC Only! Requires gcov/lcov to be installed). Incl ude target for doing coverage analysis for the test suite. Note that -DCMAKE_BUI LD_TYPE=Debug must be set" OFF)
option(JANSSON_COVERALLS "Generate coverage info for Coveralls" OFF)
option(JANSSON_COVERALLS_UPLOAD "Upload coverage info to Coveralls (Only work
s via Travis)" ON)
endif () endif ()
# Set some nicer output dirs. # Set some nicer output dirs.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(JANSSON_TEMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/tmp) set(JANSSON_TEMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/tmp)
# Give the debug version a different postfix for windows, # Give the debug version a different postfix for windows,
# so both the debug and release version can be built in the # so both the debug and release version can be built in the
# same build-tree on Windows (MSVC). # same build-tree on Windows (MSVC).
if (WIN32 AND NOT CMAKE_DEBUG_POSTFIX) if (WIN32 AND NOT CMAKE_DEBUG_POSTFIX)
set(CMAKE_DEBUG_POSTFIX "_d") set(CMAKE_DEBUG_POSTFIX "_d")
endif() endif()
# This is how I thought it should go # This is how I thought it should go
# set (JANSSON_VERSION "2.3.1") # set (JANSSON_VERSION "2.3.1")
# set (JANSSON_SOVERSION 2) # set (JANSSON_SOVERSION 2)
set(JANSSON_DISPLAY_VERSION "2.13.1") set(JANSSON_DISPLAY_VERSION "2.14")
# This is what is required to match the same numbers as automake's # This is what is required to match the same numbers as automake's
set(JANSSON_VERSION "4.13.0") set(JANSSON_VERSION "4.14.0")
set(JANSSON_SOVERSION 4) set(JANSSON_SOVERSION 4)
# for CheckFunctionKeywords # for CheckFunctionKeywords
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include (CheckCSourceCompiles) include (CheckCSourceCompiles)
include (CheckFunctionExists) include (CheckFunctionExists)
include (CheckFunctionKeywords) include (CheckFunctionKeywords)
include (CheckIncludeFiles) include (CheckIncludeFiles)
include (CheckTypeSize) include (CheckTypeSize)
skipping to change at line 120 skipping to change at line 72
add_definitions( "/W3 /D_CRT_SECURE_NO_WARNINGS /wd4005 /wd4996 /nologo" ) add_definitions( "/W3 /D_CRT_SECURE_NO_WARNINGS /wd4005 /wd4996 /nologo" )
if (JANSSON_STATIC_CRT) if (JANSSON_STATIC_CRT)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
endif() endif()
endif() endif()
message("C compiler: ${CMAKE_C_COMPILER_ID}") message("C compiler: ${CMAKE_C_COMPILER_ID}")
# Coverage only works with GCC for a debug build.
if (JANSSON_COVERALLS)
set(JANSSON_COVERAGE ON)
endif()
if (JANSSON_COVERAGE) if (JANSSON_COVERAGE)
include(CodeCoverage) include(CodeCoverage)
include(Coveralls) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
# This adds coverage arguments to gcc/clang.
coveralls_turn_on_coverage()
endif() endif()
check_include_files (endian.h HAVE_ENDIAN_H) check_include_files (endian.h HAVE_ENDIAN_H)
check_include_files (fcntl.h HAVE_FCNTL_H) check_include_files (fcntl.h HAVE_FCNTL_H)
check_include_files (sched.h HAVE_SCHED_H) check_include_files (sched.h HAVE_SCHED_H)
check_include_files (unistd.h HAVE_UNISTD_H) check_include_files (unistd.h HAVE_UNISTD_H)
check_include_files (sys/param.h HAVE_SYS_PARAM_H) check_include_files (sys/param.h HAVE_SYS_PARAM_H)
check_include_files (sys/stat.h HAVE_SYS_STAT_H) check_include_files (sys/stat.h HAVE_SYS_STAT_H)
check_include_files (sys/time.h HAVE_SYS_TIME_H) check_include_files (sys/time.h HAVE_SYS_TIME_H)
check_include_files (sys/types.h HAVE_SYS_TYPES_H) check_include_files (sys/types.h HAVE_SYS_TYPES_H)
skipping to change at line 366 skipping to change at line 310
source_group("Library Private Headers" FILES ${JANSSON_HDR_PRIVATE}) source_group("Library Private Headers" FILES ${JANSSON_HDR_PRIVATE})
source_group("Library Public Headers" FILES ${JANSSON_HDR_PUBLIC}) source_group("Library Public Headers" FILES ${JANSSON_HDR_PUBLIC})
if(JANSSON_BUILD_SHARED_LIBS) if(JANSSON_BUILD_SHARED_LIBS)
add_library(jansson SHARED add_library(jansson SHARED
${JANSSON_SRC} ${JANSSON_SRC}
${JANSSON_HDR_PRIVATE} ${JANSSON_HDR_PRIVATE}
${JANSSON_HDR_PUBLIC} ${JANSSON_HDR_PUBLIC}
src/jansson.def) src/jansson.def)
# check if linker support --default-symver
list(APPEND CMAKE_REQUIRED_LIBRARIES "-Wl,--default-symver")
check_c_source_compiles(
"
int main (void)
{
return 0;
}
"
DSYMVER_WORKS
)
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "-Wl,--default-symver")
if (SYMVER_WORKS)
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_SO
VERSION} {
global:
*;
};
")
list(APPEND CMAKE_REQUIRED_LIBRARIES "-Wl,--version-script,${CMAKE_CURRENT
_BINARY_DIR}/jansson.sym")
check_c_source_compiles(
"
int main (void)
{
return 0;
}
"
VSCRIPT_WORKS
)
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "-Wl,--version-script,${CMAKE_CU
RRENT_BINARY_DIR}/jansson.sym")
if (VSCRIPT_WORKS)
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--version-script,${CMAKE_CURRENT_BIN
ARY_DIR}/jansson.sym")
endif()
endif()
set_target_properties(jansson PROPERTIES set_target_properties(jansson PROPERTIES
VERSION ${JANSSON_VERSION} VERSION ${JANSSON_VERSION}
SOVERSION ${JANSSON_SOVERSION}) SOVERSION ${JANSSON_SOVERSION})
else() else()
add_library(jansson STATIC add_library(jansson STATIC
${JANSSON_SRC} ${JANSSON_SRC}
${JANSSON_HDR_PRIVATE} ${JANSSON_HDR_PRIVATE}
${JANSSON_HDR_PUBLIC}) ${JANSSON_HDR_PUBLIC})
set_target_properties(jansson PROPERTIES set_target_properties(jansson PROPERTIES
POSITION_INDEPENDENT_CODE true) POSITION_INDEPENDENT_CODE true)
skipping to change at line 500 skipping to change at line 482
# #
# Test suites. # Test suites.
# #
if (CMAKE_COMPILER_IS_GNUCC) if (CMAKE_COMPILER_IS_GNUCC)
add_definitions(-Wall -Wextra -Wdeclaration-after-statement) add_definitions(-Wall -Wextra -Wdeclaration-after-statement)
endif () endif ()
set(api_tests set(api_tests
test_array test_array
test_copy
test_chaos test_chaos
test_copy
test_dump test_dump
test_dump_callback test_dump_callback
test_equal test_equal
test_fixed_size
test_load test_load
test_loadb
test_load_callback test_load_callback
test_loadb
test_number test_number
test_object test_object
test_pack test_pack
test_simple test_simple
test_sprintf test_sprintf
test_unpack) test_unpack)
# Doing arithmetic on void pointers is not allowed by Microsofts compiler # Doing arithmetic on void pointers is not allowed by Microsofts compiler
# such as secure_malloc and secure_free is doing, so exclude it for now. # such as secure_malloc and secure_free is doing, so exclude it for now.
if (NOT MSVC) if (NOT MSVC)
skipping to change at line 577 skipping to change at line 560
else() else()
add_test(${SUITE}__${TNAME}__strip add_test(${SUITE}__${TNAME}__strip
${SUITE_TEST_CMD} --strip ${TESTDIR}) ${SUITE_TEST_CMD} --strip ${TESTDIR})
endif() endif()
endif () endif ()
endif () endif ()
endforeach () endforeach ()
endforeach () endforeach ()
if (JANSSON_COVERAGE) if (JANSSON_COVERAGE)
setup_target_for_coverage( SETUP_TARGET_FOR_COVERAGE(coverage coverage ctest)
coverage # Coverage make target "make coverage".
coverage # Name of output directory.
make # Name of test runner executable.
test) # Arguments to the test runner above (make test
).
if (JANSSON_COVERALLS)
set(COVERAGE_SRCS ${JANSSON_SRC})
coveralls_setup("${COVERAGE_SRCS}" ${JANSSON_COVERALLS_UPLOAD})
endif ()
endif () endif ()
# Enable using "make check" just like the autotools project. # Enable using "make check" just like the autotools project.
# By default cmake creates a target "make test" # By default cmake creates a target "make test"
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}
DEPENDS json_process ${api_tests}) DEPENDS json_process ${api_tests})
endif () endif ()
# #
# Installation preparation. # Installation preparation.
 End of changes. 13 change blocks. 
73 lines changed or deleted 50 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)