Annotation of src/external/mit/expat/dist/CMakeLists.txt, Revision 1.1.1.2
1.1 spz 1: # This file is copyrighted under the BSD-license for buildsystem files of KDE
2: # copyright 2010, Patrick Spendrin <ps_ml@gmx.de>
3:
4: project(expat)
5:
6: cmake_minimum_required(VERSION 2.6)
7: set(PACKAGE_BUGREPORT "expat-bugs@libexpat.org")
8: set(PACKAGE_NAME "expat")
1.1.1.2 ! spz 9: set(PACKAGE_VERSION "2.1.1")
1.1 spz 10: set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
11: set(PACKAGE_TARNAME "${PACKAGE_NAME}")
12:
13: option(BUILD_tools "build the xmlwf tool for expat library" ON)
14: option(BUILD_examples "build the examples for expat library" ON)
15: option(BUILD_tests "build the tests for expat library" ON)
16: option(BUILD_shared "build a shared expat library" ON)
17:
18: # configuration options
19: set(XML_CONTEXT_BYTES 1024 CACHE STRING "Define to specify how much context to retain around the current parse point")
20: option(XML_DTD "Define to make parameter entity parsing functionality available" ON)
21: option(XML_NS "Define to make XML Namespaces functionality available" ON)
22:
23: if(XML_DTD)
24: set(XML_DTD 1)
25: else(XML_DTD)
26: set(XML_DTD 0)
27: endif(XML_DTD)
28: if(XML_NS)
29: set(XML_NS 1)
30: else(XML_NS)
31: set(XML_NS 0)
32: endif(XML_NS)
33:
34: if(BUILD_tests)
35: enable_testing()
36: endif(BUILD_tests)
37:
38: include(ConfigureChecks.cmake)
39:
40: include_directories(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/lib)
41: if(MSVC)
42: add_definitions(-D_CRT_SECURE_NO_WARNINGS -wd4996)
43: endif(MSVC)
44:
45: set(expat_SRCS
46: lib/xmlparse.c
47: lib/xmlrole.c
48: lib/xmltok.c
49: lib/xmltok_impl.c
50: lib/xmltok_ns.c
51: )
52:
53: if(WIN32 AND BUILD_shared)
54: set(expat_SRCS ${expat_SRCS} lib/libexpat.def)
55: endif(WIN32 AND BUILD_shared)
56:
57: if(BUILD_shared)
58: set(_SHARED SHARED)
59: else(BUILD_shared)
60: set(_SHARED STATIC)
61: endif(BUILD_shared)
62:
63: add_library(expat ${_SHARED} ${expat_SRCS})
64:
65: install(TARGETS expat RUNTIME DESTINATION bin
66: LIBRARY DESTINATION lib
67: ARCHIVE DESTINATION lib)
68:
69: set(prefix ${CMAKE_INSTALL_PREFIX})
70: set(exec_prefix "\${prefix}/bin")
71: set(libdir "\${prefix}/lib")
72: set(includedir "\${prefix}/include")
73: configure_file(expat.pc.in ${CMAKE_CURRENT_BINARY_DIR}/expat.pc)
74:
75: install(FILES lib/expat.h lib/expat_external.h DESTINATION include)
76: install(FILES ${CMAKE_CURRENT_BINARY_DIR}/expat.pc DESTINATION lib/pkgconfig)
77:
78:
79:
80: if(BUILD_tools AND NOT WINCE)
81: set(xmlwf_SRCS
82: xmlwf/xmlwf.c
83: xmlwf/xmlfile.c
84: xmlwf/codepage.c
85: xmlwf/readfilemap.c
86: )
87:
88: add_executable(xmlwf ${xmlwf_SRCS})
1.1.1.2 ! spz 89: set_property(TARGET xmlwf PROPERTY RUNTIME_OUTPUT_DIRECTORY xmlwf)
1.1 spz 90: target_link_libraries(xmlwf expat)
91: install(TARGETS xmlwf DESTINATION bin)
92: install(FILES doc/xmlwf.1 DESTINATION share/man/man1)
93: endif(BUILD_tools AND NOT WINCE)
94:
95: if(BUILD_examples)
96: add_executable(elements examples/elements.c)
1.1.1.2 ! spz 97: set_property(TARGET elements PROPERTY RUNTIME_OUTPUT_DIRECTORY examples)
1.1 spz 98: target_link_libraries(elements expat)
99:
100: add_executable(outline examples/outline.c)
1.1.1.2 ! spz 101: set_property(TARGET outline PROPERTY RUNTIME_OUTPUT_DIRECTORY examples)
1.1 spz 102: target_link_libraries(outline expat)
103: endif(BUILD_examples)
104:
105: if(BUILD_tests)
106: ## these are unittests that can be run on any platform
107: add_executable(runtests tests/runtests.c tests/chardata.c tests/minicheck.c)
1.1.1.2 ! spz 108: set_property(TARGET runtests PROPERTY RUNTIME_OUTPUT_DIRECTORY tests)
1.1 spz 109: target_link_libraries(runtests expat)
1.1.1.2 ! spz 110: add_test(runtests tests/runtests)
1.1 spz 111:
112: add_executable(runtestspp tests/runtestspp.cpp tests/chardata.c tests/minicheck.c)
1.1.1.2 ! spz 113: set_property(TARGET runtestspp PROPERTY RUNTIME_OUTPUT_DIRECTORY tests)
1.1 spz 114: target_link_libraries(runtestspp expat)
1.1.1.2 ! spz 115: add_test(runtestspp tests/runtestspp)
1.1 spz 116: endif(BUILD_tests)
CVSweb <webmaster@jp.NetBSD.org>