|
Packit Service |
def718 |
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
cmake_minimum_required(VERSION 2.8.7)
|
|
Packit Service |
def718 |
cmake_policy(SET CMP0048 NEW)
|
|
Packit Service |
def718 |
project(json-c VERSION 0.13.1)
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
include(CheckSymbolExists)
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
check_symbol_exists(strtoll "stdlib.h" HAVE_STRTOLL)
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
set(cmake_strtoll "strtoll")
|
|
Packit Service |
def718 |
if (NOT HAVE_STRTOLL)
|
|
Packit Service |
def718 |
# Use _strtoi64 if strtoll is not available.
|
|
Packit Service |
def718 |
check_symbol_exists(_strtoi64 stdlib.h have_strtoi64)
|
|
Packit Service |
def718 |
if (have_strtoi64)
|
|
Packit Service |
def718 |
set(HAVE_STRTOLL 1)
|
|
Packit Service |
def718 |
set(cmake_strtoll "_strtoi64")
|
|
Packit Service |
def718 |
# could do the same for strtoull, if needed
|
|
Packit Service |
def718 |
endif ()
|
|
Packit Service |
def718 |
endif ()
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
if(MSVC)
|
|
Packit Service |
def718 |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4100 /wd4996 /wd4244 /wd4706 /wd4702 /wd4127 /wd4701")
|
|
Packit Service |
def718 |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4100 /wd4996 /wd4244 /wd4706 /wd4702 /wd4127 /wd4701")
|
|
Packit Service |
def718 |
set(cmake_create_config 1)
|
|
Packit Service |
def718 |
elseif(MINGW)
|
|
Packit Service |
def718 |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -D_GNU_SOURCE=1")
|
|
Packit Service |
def718 |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -D_GNU_SOURCE=1")
|
|
Packit Service |
def718 |
if (MSYS OR CMAKE_GENERATOR STREQUAL "Unix Makefiles")
|
|
Packit Service |
def718 |
execute_process(COMMAND echo ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
|
Packit Service |
def718 |
execute_process(COMMAND sh autogen.sh WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
|
Packit Service |
def718 |
execute_process(COMMAND sh ./configure WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
|
Packit Service |
def718 |
file(COPY ./config.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/include/)
|
|
Packit Service |
def718 |
file(COPY ./json_config.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/include/)
|
|
Packit Service |
def718 |
else()
|
|
Packit Service |
def718 |
set(cmake_create_config 1)
|
|
Packit Service |
def718 |
endif()
|
|
Packit Service |
def718 |
elseif(UNIX)
|
|
Packit Service |
def718 |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
|
|
Packit Service |
def718 |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -D_GNU_SOURCE")
|
|
Packit Service |
def718 |
execute_process(COMMAND echo ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
|
Packit Service |
def718 |
execute_process(COMMAND sh autogen.sh WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
|
Packit Service |
def718 |
execute_process(COMMAND ./configure WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
|
Packit Service |
def718 |
file(COPY ./config.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/include/)
|
|
Packit Service |
def718 |
file(COPY ./json_config.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/include/)
|
|
Packit Service |
def718 |
endif()
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
if (cmake_create_config)
|
|
Packit Service |
def718 |
file(REMOVE ./config.h) # make sure any stale one is gone
|
|
Packit Service |
def718 |
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.win32 ${CMAKE_CURRENT_BINARY_DIR}/include/config.h)
|
|
Packit Service |
def718 |
file(COPY ./json_config.h.win32 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/include/)
|
|
Packit Service |
def718 |
file(RENAME ${CMAKE_CURRENT_BINARY_DIR}/include/json_config.h.win32 ${CMAKE_CURRENT_BINARY_DIR}/include/json_config.h)
|
|
Packit Service |
def718 |
endif ()
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
set(JSON_C_PUBLIC_HEADERS
|
|
Packit Service |
def718 |
./json.h
|
|
Packit Service |
def718 |
${CMAKE_CURRENT_BINARY_DIR}/include/config.h
|
|
Packit Service |
def718 |
${CMAKE_CURRENT_BINARY_DIR}/include/json_config.h
|
|
Packit Service |
def718 |
./arraylist.h
|
|
Packit Service |
def718 |
./debug.h
|
|
Packit Service |
def718 |
./json_c_version.h
|
|
Packit Service |
def718 |
./json_inttypes.h
|
|
Packit Service |
def718 |
./json_object.h
|
|
Packit Service |
def718 |
./json_pointer.h
|
|
Packit Service |
def718 |
./json_tokener.h
|
|
Packit Service |
def718 |
./json_util.h
|
|
Packit Service |
def718 |
./linkhash.h
|
|
Packit Service |
def718 |
./printbuf.h
|
|
Packit Service |
def718 |
)
|
|
Packit Service |
def718 |
set(JSON_C_HEADERS
|
|
Packit Service |
def718 |
${JSON_C_PUBLIC_HEADERS}
|
|
Packit Service |
def718 |
./json_object_private.h
|
|
Packit Service |
def718 |
./random_seed.h
|
|
Packit Service |
def718 |
./strerror_override.h
|
|
Packit Service |
def718 |
./strerror_override_private.h
|
|
Packit Service |
def718 |
./math_compat.h
|
|
Packit Service |
def718 |
./snprintf_compat.h
|
|
Packit Service |
def718 |
./strdup_compat.h
|
|
Packit Service |
def718 |
./vasprintf_compat.h
|
|
Packit Service |
def718 |
)
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
set(JSON_C_SOURCES
|
|
Packit Service |
def718 |
./arraylist.c
|
|
Packit Service |
def718 |
./debug.c
|
|
Packit Service |
def718 |
./json_c_version.c
|
|
Packit Service |
def718 |
./json_object.c
|
|
Packit Service |
def718 |
./json_object_iterator.c
|
|
Packit Service |
def718 |
./json_pointer.c
|
|
Packit Service |
def718 |
./json_tokener.c
|
|
Packit Service |
def718 |
./json_util.c
|
|
Packit Service |
def718 |
./json_visit.c
|
|
Packit Service |
def718 |
./linkhash.c
|
|
Packit Service |
def718 |
./printbuf.c
|
|
Packit Service |
def718 |
./random_seed.c
|
|
Packit Service |
def718 |
./strerror_override.c
|
|
Packit Service |
def718 |
)
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
add_library(json-c
|
|
Packit Service |
def718 |
SHARED
|
|
Packit Service |
def718 |
${JSON_C_SOURCES}
|
|
Packit Service |
def718 |
${JSON_C_HEADERS}
|
|
Packit Service |
def718 |
)
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
add_library(json-c-static
|
|
Packit Service |
def718 |
STATIC
|
|
Packit Service |
def718 |
${JSON_C_SOURCES}
|
|
Packit Service |
def718 |
${JSON_C_HEADERS}
|
|
Packit Service |
def718 |
)
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
set_property(TARGET json-c PROPERTY C_STANDARD 99)
|
|
Packit Service |
def718 |
set_property(TARGET json-c-static PROPERTY C_STANDARD 99)
|
|
Packit Service |
def718 |
set_target_properties(json-c-static PROPERTIES OUTPUT_NAME json-c)
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
install(TARGETS json-c json-c-static
|
|
Packit Service |
def718 |
RUNTIME DESTINATION bin
|
|
Packit Service |
def718 |
LIBRARY DESTINATION lib
|
|
Packit Service |
def718 |
ARCHIVE DESTINATION lib
|
|
Packit Service |
def718 |
)
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
install(FILES ${JSON_C_PUBLIC_HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/json-c )
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
if (UNIX)
|
|
Packit Service |
def718 |
set(prefix ${CMAKE_INSTALL_PREFIX})
|
|
Packit Service |
def718 |
set(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin)
|
|
Packit Service |
def718 |
set(libdir ${CMAKE_INSTALL_PREFIX}/lib)
|
|
Packit Service |
def718 |
set(includedir ${CMAKE_INSTALL_PREFIX}/include)
|
|
Packit Service |
def718 |
set(VERSION ${PROJECT_VERSION})
|
|
Packit Service |
def718 |
configure_file(json-c.pc.in json-c.pc @ONLY)
|
|
Packit Service |
def718 |
set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files")
|
|
Packit Service |
def718 |
install(FILES ${CMAKE_BINARY_DIR}/json-c.pc DESTINATION "${INSTALL_PKGCONFIG_DIR}")
|
|
Packit Service |
def718 |
endif ()
|