Initial CMake conversion.

pull/330/head
Lance Wallis 2 weeks ago
parent d650587449
commit 081b2c75de
No known key found for this signature in database
GPG Key ID: AE7847735CE374E4
  1. 3
      .gitignore
  2. 88
      CMakeLists.txt
  3. 29
      test.xmlfd

3
.gitignore vendored

@ -24,3 +24,6 @@
/vcnet/packages
/xcode/mxml.xcodeproj/project.xcworkspace
/xcode/mxml.xcodeproj/xcuserdata
# CMake
build/

@ -0,0 +1,88 @@
cmake_minimum_required(VERSION 3.19) # First to support Apple Silicon.
project(mxml C)
enable_testing()
# Don't allow source tree pollution.
if(" ${CMAKE_SOURCE_DIR}" STREQUAL " ${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "
FATAL: In-source builds are not allowed.
You should create a separate directory for build files.
")
endif()
if(WIN32)
# set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) # C++
add_compile_definitions(
_WIN32_WINNT=0x0601
)
endif(WIN32)
set(MXML_PRIVATE
mxml-attr.c
mxml-file.c
mxml-get.c
mxml-index.c
mxml-node.c
mxml-options.c
mxml-private.c
mxml-search.c
mxml-set.c
)
set(MXML_PUBLIC
mxml.h
config.h # TODO: Cmake configure.
)
set(MXML_COLLECTIVE
${MXML_PRIVATE}
${MXML_PUBLIC}
)
add_library(${PROJECT_NAME}
${MXML_COLLECTIVE}
)
# Dfine the header(s) for this library and add to build path.
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/>
)
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}LibraryConfig
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} # For Windows
)
# Importable from the install directory.
# Config file per-project dir or into "cmake".
install(EXPORT ${PROJECT_NAME}LibraryConfig DESTINATION share/${PROJECT_NAME}Library/cmake)
# Importable from the build directory.
export(TARGETS ${PROJECT_NAME} FILE ${PROJECT_NAME}/LibraryConfig.cmake)
# ==================== TESTS ====================
add_executable(${PROJECT_NAME}-test
testmxml.c
)
add_custom_command(
TARGET ${PROJECT_NAME}-test
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/test.xml
$<TARGET_FILE_DIR:${PROJECT_NAME}-test>
)
target_link_libraries(${PROJECT_NAME}-test
${PROJECT_NAME}
)
include(ExternalData)
ExternalData_Add_Test(
NAME test-mxml
${PROJECT_NAME}-test
DATA{test.xml}
)

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<group>
<option>
<keyword type="opaque">InputSlot</keyword>
<default type="opaque">Auto</default>
<text>Media Source</text>
<order type="real">10.42</order>
<choice>
<keyword type="opaque">Auto</keyword>
<text>Auto Tray Selection</text>
<code type="opaque"/>
</choice>
<choice>
<keyword type="opaque">Upper</keyword>
<text>Tray 1</text>
<code type="opaque">&lt;&lt;/MediaPosition 0&gt;&gt;setpagedevice</code>
</choice>
<choice>
<keyword type="opaque">Lower</keyword>
<text>Tray 2</text>
<code type="opaque">&lt;&lt;/MediaPosition 1&gt;&gt;setpagedevice</code>
</choice>
</option>
<integer>123</integer>
<string>Now is the time for all good men to come to the aid of their
country.</string>
<!-- this is a comment -->
<![CDATA[this is CDATA 0123456789ABCDEF]]>
</group>
Loading…
Cancel
Save