--- /dev/null
+# This file is copyrighted under the BSD-license for buildsystem files of KDE\r
+# copyright 2010, Patrick Spendrin <ps_ml@gmx.de>\r
+\r
+project(expat)\r
+\r
+cmake_minimum_required(VERSION 2.6)\r
+set(PACKAGE_BUGREPORT "expat-bugs@libexpat.org")\r
+set(PACKAGE_NAME "expat")\r
+set(PACKAGE_VERSION "2.1.0")\r
+set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")\r
+set(PACKAGE_TARNAME "${PACKAGE_NAME}")\r
+\r
+option(BUILD_tools "build the xmlwf tool for expat library" ON)\r
+option(BUILD_examples "build the examples for expat library" ON)\r
+option(BUILD_tests "build the tests for expat library" ON)\r
+option(BUILD_shared "build a shared expat library" ON)\r
+\r
+# configuration options\r
+set(XML_CONTEXT_BYTES 1024 CACHE STRING "Define to specify how much context to retain around the current parse point")\r
+option(XML_DTD "Define to make parameter entity parsing functionality available" ON)\r
+option(XML_NS "Define to make XML Namespaces functionality available" ON)\r
+\r
+if(XML_DTD)\r
+ set(XML_DTD 1)\r
+else(XML_DTD)\r
+ set(XML_DTD 0)\r
+endif(XML_DTD)\r
+if(XML_NS)\r
+ set(XML_NS 1)\r
+else(XML_NS)\r
+ set(XML_NS 0)\r
+endif(XML_NS)\r
+\r
+if(BUILD_tests)\r
+ enable_testing()\r
+endif(BUILD_tests)\r
+\r
+include(ConfigureChecks.cmake)\r
+\r
+include_directories(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/lib)\r
+if(MSVC)\r
+ add_definitions(-D_CRT_SECURE_NO_WARNINGS -wd4996)\r
+endif(MSVC)\r
+\r
+set(expat_SRCS\r
+ lib/xmlparse.c\r
+ lib/xmlrole.c\r
+ lib/xmltok.c \r
+ lib/xmltok_impl.c \r
+ lib/xmltok_ns.c\r
+)\r
+\r
+if(WIN32 AND BUILD_shared)\r
+ set(expat_SRCS ${expat_SRCS} lib/libexpat.def)\r
+endif(WIN32 AND BUILD_shared)\r
+\r
+if(BUILD_shared)\r
+ set(_SHARED SHARED)\r
+else(BUILD_shared)\r
+ set(_SHARED STATIC)\r
+endif(BUILD_shared)\r
+\r
+add_library(expat ${_SHARED} ${expat_SRCS})\r
+\r
+install(TARGETS expat RUNTIME DESTINATION bin\r
+ LIBRARY DESTINATION lib\r
+ ARCHIVE DESTINATION lib)\r
+\r
+set(prefix ${CMAKE_INSTALL_PREFIX})\r
+set(exec_prefix "\${prefix}/bin")\r
+set(libdir "\${prefix}/lib")\r
+set(includedir "\${prefix}/include")\r
+configure_file(expat.pc.in ${CMAKE_CURRENT_BINARY_DIR}/expat.pc)\r
+\r
+install(FILES lib/expat.h lib/expat_external.h DESTINATION include)\r
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/expat.pc DESTINATION lib/pkgconfig)\r
+\r
+\r
+\r
+if(BUILD_tools AND NOT WINCE)\r
+ set(xmlwf_SRCS\r
+ xmlwf/xmlwf.c\r
+ xmlwf/xmlfile.c\r
+ xmlwf/codepage.c\r
+ xmlwf/readfilemap.c\r
+ )\r
+\r
+ add_executable(xmlwf ${xmlwf_SRCS})\r
+ target_link_libraries(xmlwf expat)\r
+ install(TARGETS xmlwf DESTINATION bin)\r
+ install(FILES doc/xmlwf.1 DESTINATION share/man/man1)\r
+endif(BUILD_tools AND NOT WINCE)\r
+\r
+if(BUILD_examples)\r
+ add_executable(elements examples/elements.c)\r
+ target_link_libraries(elements expat)\r
+\r
+ add_executable(outline examples/outline.c)\r
+ target_link_libraries(outline expat)\r
+endif(BUILD_examples)\r
+\r
+if(BUILD_tests)\r
+ ## these are unittests that can be run on any platform\r
+ add_executable(runtests tests/runtests.c tests/chardata.c tests/minicheck.c)\r
+ target_link_libraries(runtests expat)\r
+ add_test(runtests runtests)\r
+\r
+ add_executable(runtestspp tests/runtestspp.cpp tests/chardata.c tests/minicheck.c)\r
+ target_link_libraries(runtestspp expat)\r
+ add_test(runtestspp runtestspp)\r
+endif(BUILD_tests)\r