Skip to content

Instantly share code, notes, and snippets.

@pebbie
Last active March 4, 2019 14:46
Show Gist options
  • Save pebbie/bad2ed2f5d868de596b6b3f81ca35662 to your computer and use it in GitHub Desktop.
Save pebbie/bad2ed2f5d868de596b6b3f81ca35662 to your computer and use it in GitHub Desktop.

Revisions

  1. pebbie revised this gist Mar 4, 2019. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions CMakeLists.txt
    Original file line number Diff line number Diff line change
    @@ -10,6 +10,10 @@ SET(CMAKE_INCLUDE_CURRENT_DIR 1)
    INCLUDE(CheckSymbolExists)
    add_compile_definitions(_CRT_SECURE_NO_WARNINGS)

    if (UNIX)
    set(LIBS m)
    endif (UNIX)

    FILE(WRITE ${CMAKE_BINARY_DIR}/config.h.in
    "#ifndef _SERD_CONFIG\n"
    "#define _SERD_CONFIG\n"
    @@ -37,6 +41,7 @@ set(serd_LIB_SRCS
    )

    ADD_LIBRARY(serd ${serd_LIB_SRCS})
    target_link_libraries(serd ${LIBS})
    set_target_properties(serd PROPERTIES VERSION ${MAJOR}.${MINOR}.${PATCH} SOVERSION ${MAJOR}.${MINOR})

    add_executable(serdi src/serdi.c)
  2. pebbie created this gist Mar 4, 2019.
    47 changes: 47 additions & 0 deletions CMakeLists.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,47 @@
    CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7)

    PROJECT(serd)
    SET(MAJOR 0)
    SET(MINOR 30)
    SET(PATCH 0)

    SET(CMAKE_INCLUDE_CURRENT_DIR 1)

    INCLUDE(CheckSymbolExists)
    add_compile_definitions(_CRT_SECURE_NO_WARNINGS)

    FILE(WRITE ${CMAKE_BINARY_DIR}/config.h.in
    "#ifndef _SERD_CONFIG\n"
    "#define _SERD_CONFIG\n"
    "#cmakedefine HAVE_FILENO 1\n"
    "#define SERD_VERSION \"${MAJOR}.${MINOR}.${PATCH}\"\n"
    "#endif\n"
    )

    check_symbol_exists (fileno stdio.h HAVE_FILENO)
    CONFIGURE_FILE(${CMAKE_BINARY_DIR}/config.h.in ${CMAKE_BINARY_DIR}/serd_config.h)

    include_directories(src ${CMAKE_BINARY_DIR})

    set(serd_LIB_SRCS
    src/byte_source.c
    src/env.c
    src/n3.c
    src/node.c
    src/reader.c
    src/reader.h
    src/serd_internal.h
    src/string.c
    src/uri.c
    src/writer.c
    )

    ADD_LIBRARY(serd ${serd_LIB_SRCS})
    set_target_properties(serd PROPERTIES VERSION ${MAJOR}.${MINOR}.${PATCH} SOVERSION ${MAJOR}.${MINOR})

    add_executable(serdi src/serdi.c)
    target_link_libraries(serdi serd)
    install(TARGETS serdi DESTINATION bin)

    install(TARGETS serd DESTINATION lib)
    install(FILES serd/serd.h DESTINATION include/serd)