mirror of
https://github.com/michaelrsweet/mxml.git
synced 2024-11-24 11:25:30 +00:00
Merge 7d3223e14b
into 95445118c2
This commit is contained in:
commit
1cf32d3abc
67
CMakeLists.txt
Normal file
67
CMakeLists.txt
Normal file
@ -0,0 +1,67 @@
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
|
||||
set(VERSION 3.2)
|
||||
|
||||
project(
|
||||
mxml
|
||||
VERSION ${VERSION}
|
||||
LANGUAGES C)
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
|
||||
include(CheckTypeSize)
|
||||
check_type_size("long long" HAVE_LONG_LONG)
|
||||
include(CheckFunctionExists)
|
||||
check_function_exists(snprintf HAVE_SNPRINTF)
|
||||
check_function_exists(vasprintf HAVE_VASPRINTF)
|
||||
check_function_exists(vsnprintf HAVE_VSNPRINTF)
|
||||
check_function_exists(strdup HAVE_STRDUP)
|
||||
check_function_exists(strlcat HAVE_STRLCAT)
|
||||
check_function_exists(strlcpy HAVE_STRLCPY)
|
||||
set(MXML_VERSION "Mini-XML v${VERSION}")
|
||||
|
||||
configure_file(cmake/config.h.in config.h)
|
||||
set(HEADERS mxml-private.h ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||
|
||||
set(SOURCES
|
||||
mxml-attr.c
|
||||
mxml-entity.c
|
||||
mxml-file.c
|
||||
mxml-get.c
|
||||
mxml-index.c
|
||||
mxml-node.c
|
||||
mxml-private.c
|
||||
mxml-search.c
|
||||
mxml-set.c
|
||||
mxml-string.c)
|
||||
|
||||
add_library(${PROJECT_NAME} ${SOURCES} ${HEADERS})
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
add_library(MSweet::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
|
||||
|
||||
# install library
|
||||
install(
|
||||
TARGETS ${PROJECT_NAME}
|
||||
EXPORT ${PROJECT_NAME}Targets
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES
|
||||
DESTINATION include)
|
||||
|
||||
install(
|
||||
EXPORT ${PROJECT_NAME}Targets
|
||||
DESTINATION lib/cmake/${PROJECT_NAME}
|
||||
FILE ${PROJECT_NAME}Targets.cmake
|
||||
NAMESPACE MSweet::)
|
||||
|
||||
install(FILES mxml.h DESTINATION include)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file(${PROJECT_NAME}ConfigVersion.cmake
|
||||
COMPATIBILITY SameMajorVersion)
|
||||
install(FILES cmake/${PROJECT_NAME}Config.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
|
||||
DESTINATION lib/cmake/${PROJECT_NAME})
|
74
cmake/config.h.in
Normal file
74
cmake/config.h.in
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Xcode configuration file for Mini-XML, a small XML file parsing library.
|
||||
*
|
||||
* https://www.msweet.org/mxml
|
||||
*
|
||||
* Copyright © 2003-2020 by Michael R Sweet.
|
||||
*
|
||||
* Licensed under Apache License v2.0. See the file "LICENSE" for more
|
||||
* information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
/*
|
||||
* Version number...
|
||||
*/
|
||||
|
||||
#cmakedefine MXML_VERSION "@MXML_VERSION@"
|
||||
|
||||
|
||||
/*
|
||||
* Inline function support...
|
||||
*/
|
||||
|
||||
#define inline
|
||||
|
||||
|
||||
/*
|
||||
* Long long support...
|
||||
*/
|
||||
|
||||
#cmakedefine HAVE_LONG_LONG 1
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the *printf() functions?
|
||||
*/
|
||||
|
||||
#cmakedefine HAVE_SNPRINTF 1
|
||||
#cmakedefine HAVE_VASPRINTF 1
|
||||
#cmakedefine HAVE_VSNPRINTF 1
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the strXXX() functions?
|
||||
*/
|
||||
|
||||
#cmakedefine HAVE_STRDUP 1
|
||||
#cmakedefine HAVE_STRLCAT 1
|
||||
#cmakedefine HAVE_STRLCPY 1
|
||||
|
||||
|
||||
/*
|
||||
* Do we have threading support?
|
||||
*/
|
||||
|
||||
#define HAVE_PTHREAD_H 1
|
||||
|
||||
|
||||
/*
|
||||
* Define prototypes for string functions as needed...
|
||||
*/
|
||||
|
||||
extern char *_mxml_strdupf(const char *, ...);
|
||||
extern char *_mxml_vstrdupf(const char *, va_list);
|
2
cmake/mxmlConfig.cmake
Normal file
2
cmake/mxmlConfig.cmake
Normal file
@ -0,0 +1,2 @@
|
||||
include(CMakeFindDependencyMacro)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/mxmlTargets.cmake")
|
Loading…
Reference in New Issue
Block a user