Move CMake stuff to separate directory

This commit is contained in:
Dmitry Ilyin 2021-02-27 13:10:39 +03:00
parent bc02a80705
commit dd246ab5f0
3 changed files with 78 additions and 4 deletions

View File

@ -19,11 +19,11 @@ set(SOURCES
mxml-set.c
mxml-string.c)
configure_file(config.h.in config.h)
set(HEADERS mxml-private.h ${CMAKE_CURRENT_BINARY_DIR}/config.h)
#configure_file(config.h.in config.h)
set(HEADERS mxml-private.h cmake/config.h)
add_library(${PROJECT_NAME} ${SOURCES} ${HEADERS})
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
add_library(MSweet::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
# install library
@ -47,6 +47,6 @@ install(FILES mxml.h DESTINATION include)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(${PROJECT_NAME}ConfigVersion.cmake
COMPATIBILITY SameMajorVersion)
install(FILES ${PROJECT_NAME}Config.cmake
install(FILES cmake/${PROJECT_NAME}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
DESTINATION lib/cmake/${PROJECT_NAME})

74
cmake/config.h Normal file
View 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...
*/
#define MXML_VERSION "Mini-XML v3.2"
/*
* Inline function support...
*/
#define inline
/*
* Long long support...
*/
#define HAVE_LONG_LONG 1
/*
* Do we have the *printf() functions?
*/
#define HAVE_SNPRINTF 1
#define HAVE_VASPRINTF 1
#define HAVE_VSNPRINTF 1
/*
* Do we have the strXXX() functions?
*/
#define HAVE_STRDUP 1
#define HAVE_STRLCAT 1
#define 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);