GithubHelp home page GithubHelp logo

Comments (2)

akheron avatar akheron commented on July 16, 2024

Hi, and thanks for the suggestion. However, I'm not willing to support two different build systems. Autotools works fine for me (and for others), and if it cannot be used for some reason, it's quite straightforward just to take all .c files and compile them as a library by hand.

from jansson.

quarnster avatar quarnster commented on July 16, 2024

For anyone else wanting CMake support, here's the CMakeLists.txt I wrote which properly configures jansson_config.h and sets up a install target:

cmake_minimum_required(VERSION 2.8)

include(CheckSymbolExists)
include(CheckCSourceCompiles)
check_symbol_exists(localeconv locale.h json_have_localeconv)
if(NOT json_have_localeconv)
    set(json_have_localeconv 0)
endif()
check_c_source_compiles("int main() { long long test = 0; return test; }" json_have_long_long)
if(NOT json_have_long_long)
    set(json_have_long_long 0)
endif()
check_c_source_compiles("inline int test() { return 0; }\nint main() { return test(); }" json_inline)
if(json_inline)
    set(json_inline inline)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/jansson_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/jansson_config.h)
set(json_have_long_long 0)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src)
add_library(jansson STATIC
    src/dump.c
    src/error.c
    src/hashtable.c
    src/load.c
    src/memory.c
    src/pack_unpack.c
    src/strbuffer.c
    src/strconv.c
    src/utf.c
    src/value.c)


install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/jansson.h ${CMAKE_CURRENT_BINARY_DIR}/jansson_config.h DESTINATION include)
install(TARGETS jansson ARCHIVE DESTINATION lib)

from jansson.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.