Make config.h generatable for CMake

pull/281/head
Dmitry Ilyin 3 years ago
parent dd246ab5f0
commit 7d3223e14b
  1. 21
      CMakeLists.txt
  2. 16
      cmake/config.h.in

@ -7,6 +7,24 @@ project(
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
@ -19,9 +37,6 @@ set(SOURCES
mxml-set.c
mxml-string.c)
#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_BINARY_DIR})
add_library(MSweet::${PROJECT_NAME} ALIAS ${PROJECT_NAME})

@ -24,7 +24,7 @@
* Version number...
*/
#define MXML_VERSION "Mini-XML v3.2"
#cmakedefine MXML_VERSION "@MXML_VERSION@"
/*
@ -38,25 +38,25 @@
* Long long support...
*/
#define HAVE_LONG_LONG 1
#cmakedefine HAVE_LONG_LONG 1
/*
* Do we have the *printf() functions?
*/
#define HAVE_SNPRINTF 1
#define HAVE_VASPRINTF 1
#define HAVE_VSNPRINTF 1
#cmakedefine HAVE_SNPRINTF 1
#cmakedefine HAVE_VASPRINTF 1
#cmakedefine HAVE_VSNPRINTF 1
/*
* Do we have the strXXX() functions?
*/
#define HAVE_STRDUP 1
#define HAVE_STRLCAT 1
#define HAVE_STRLCPY 1
#cmakedefine HAVE_STRDUP 1
#cmakedefine HAVE_STRLCAT 1
#cmakedefine HAVE_STRLCPY 1
/*
Loading…
Cancel
Save