From: Steve Gerbino Date: Mon, 26 Sep 2016 02:03:56 +0000 (-0400) Subject: Modified CMakeLists.txt to use autotools to generate configuration for Unix systems X-Git-Tag: json-c-0.13-20171207~120^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=702b42eaf3060d0a056083f565ee943530f4ee86;p=json-c Modified CMakeLists.txt to use autotools to generate configuration for Unix systems --- diff --git a/CMakeLists.txt b/CMakeLists.txt index f278d5f..fcc100d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,23 +4,19 @@ cmake_minimum_required(VERSION 2.8.7) project(json-c) if(MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4100 /wd4996 /wd4244 /wd4706 /wd4702 /wd4127 /wd4701") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4100 /wd4996 /wd4244 /wd4706 /wd4702 /wd4127 /wd4701") file(COPY ./config.h.win32 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/include/) file(RENAME ${CMAKE_CURRENT_BINARY_DIR}/include/config.h.win32 ${CMAKE_CURRENT_BINARY_DIR}/include/config.h) file(COPY ./json_config.h.win32 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/include/) file(RENAME ${CMAKE_CURRENT_BINARY_DIR}/include/json_config.h.win32 ${CMAKE_CURRENT_BINARY_DIR}/include/json_config.h) -elseif(APPLE) - file(COPY ./config.h.mac DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/include/) - file(RENAME ${CMAKE_CURRENT_BINARY_DIR}/include/config.h.mac ${CMAKE_CURRENT_BINARY_DIR}/include/config.h) - file(COPY ./json_config.h.mac DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/include/) - file(RENAME ${CMAKE_CURRENT_BINARY_DIR}/include/json_config.h.mac ${CMAKE_CURRENT_BINARY_DIR}/include/json_config.h) -endif() - -if(UNIX) +elseif(UNIX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") -elseif(MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4100 /wd4996 /wd4244 /wd4706 /wd4702 /wd4127 /wd4701") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4100 /wd4996 /wd4244 /wd4706 /wd4702 /wd4127 /wd4701") + execute_process(COMMAND ${SHELL_EXECUTABLE} -c sh autogen.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) + execute_process(COMMAND ${SHELL_EXECUTABLE} -c configure WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) + file(COPY ./config.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/include/) + file(COPY ./json_config.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/include/) endif() include_directories(${CMAKE_CURRENT_BINARY_DIR}/include) @@ -56,12 +52,13 @@ set(JSON_C_SOURCES add_library(json-c ${JSON_C_SOURCES} ${JSON_C_HEADERS} - ) +) install(TARGETS json-c RUNTIME DESTINATION bin LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) + ARCHIVE DESTINATION lib +) install(DIRECTORY . DESTINATION ${CMAKE_INSTALL_PREFIX}/include/json-c FILES_MATCHING PATTERN "*.h") install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/ DESTINATION ${CMAKE_INSTALL_PREFIX}/include/json-c FILES_MATCHING PATTERN "*.h") diff --git a/config.h.mac b/config.h.mac deleted file mode 100644 index 8817a75..0000000 --- a/config.h.mac +++ /dev/null @@ -1,178 +0,0 @@ -/* config.h. Generated from config.h.in by configure. */ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Enable RDRANR Hardware RNG Hash Seed */ -/* #undef ENABLE_RDRAND */ - -/* Define if .gnu.warning accepts long strings. */ -/* #undef HAS_GNU_WARNING_LONG */ - -/* Define to 1 if you have the declaration of `INFINITY', and to 0 if you - don't. */ -#define HAVE_DECL_INFINITY 1 - -/* Define to 1 if you have the declaration of `isinf', and to 0 if you don't. - */ -#define HAVE_DECL_ISINF 1 - -/* Define to 1 if you have the declaration of `isnan', and to 0 if you don't. - */ -#define HAVE_DECL_ISNAN 1 - -/* Define to 1 if you have the declaration of `nan', and to 0 if you don't. */ -#define HAVE_DECL_NAN 1 - -/* Define to 1 if you have the declaration of `_finite', and to 0 if you - don't. */ -#define HAVE_DECL__FINITE 0 - -/* Define to 1 if you have the declaration of `_isnan', and to 0 if you don't. - */ -#define HAVE_DECL__ISNAN 0 - -/* Define to 1 if you have the header file. */ -#define HAVE_DLFCN_H 1 - -/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ -/* #undef HAVE_DOPRNT */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_ENDIAN_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LIMITS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LOCALE_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `open' function. */ -#define HAVE_OPEN 1 - -/* Define to 1 if you have the `realloc' function. */ -#define HAVE_REALLOC 1 - -/* Define to 1 if you have the `setlocale' function. */ -#define HAVE_SETLOCALE 1 - -/* Define to 1 if you have the `snprintf' function. */ -#define HAVE_SNPRINTF 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDARG_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strcasecmp' function. */ -#define HAVE_STRCASECMP 1 - -/* Define to 1 if you have the `strdup' function. */ -#define HAVE_STRDUP 1 - -/* Define to 1 if you have the `strerror' function. */ -#define HAVE_STRERROR 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the `strncasecmp' function. */ -#define HAVE_STRNCASECMP 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYSLOG_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_CDEFS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_PARAM_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if you have the `uselocale' function. */ -#define HAVE_USELOCALE 1 - -/* Define to 1 if you have the `vasprintf' function. */ -#define HAVE_VASPRINTF 1 - -/* Define to 1 if you have the `vprintf' function. */ -#define HAVE_VPRINTF 1 - -/* Define to 1 if you have the `vsnprintf' function. */ -#define HAVE_VSNPRINTF 1 - -/* Define to 1 if you have the `vsyslog' function. */ -#define HAVE_VSYSLOG 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_XLOCALE_H 1 - -/* Public define for json_inttypes.h */ -#define JSON_C_HAVE_INTTYPES_H 1 - -/* Define to the sub-directory where libtool stores uninstalled libraries. */ -#define LT_OBJDIR ".libs/" - -/* Name of package */ -#define PACKAGE "json-c" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "json-c@googlegroups.com" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "json-c" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "json-c 0.12.99" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "json-c" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "0.12.99" - -/* The number of bytes in type int */ -#define SIZEOF_INT 4 - -/* The number of bytes in type long */ -#define SIZEOF_LONG 8 - -/* The number of bytes in type size_t */ -#define SIZEOF_SIZE_T 8 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "0.12.99" - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define to `unsigned int' if does not define. */ -/* #undef size_t */ diff --git a/json_config.h.mac b/json_config.h.mac deleted file mode 100644 index 965ff1c..0000000 --- a/json_config.h.mac +++ /dev/null @@ -1,4 +0,0 @@ -/* json_config.h. Generated from json_config.h.in by configure. */ - -/* Define to 1 if you have the header file. */ -#define JSON_C_HAVE_INTTYPES_H 1