cmake_minimum_required(VERSION 2.6)\r
set(PACKAGE_BUGREPORT "expat-bugs@libexpat.org")\r
set(PACKAGE_NAME "expat")\r
-set(PACKAGE_VERSION "2.2.0")\r
+set(PACKAGE_VERSION "2.2.2")\r
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")\r
set(PACKAGE_TARNAME "${PACKAGE_NAME}")\r
\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
+option(BUILD_doc "build man page for xmlwf" ON)\r
+option(INSTALL "install expat files in cmake install target" 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
enable_testing()\r
endif(BUILD_tests)\r
\r
-include(ConfigureChecks.cmake)\r
+include(${CMAKE_CURRENT_LIST_DIR}/ConfigureChecks.cmake)\r
\r
-include_directories(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/lib)\r
+set(EXTRA_LINK_AND_COMPILE_FLAGS "-fno-strict-aliasing")\r
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_LINK_AND_COMPILE_FLAGS}")\r
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_LINK_AND_COMPILE_FLAGS}")\r
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EXTRA_LINK_AND_COMPILE_FLAGS}")\r
+set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${EXTRA_LINK_AND_COMPILE_FLAGS}")\r
+\r
+include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/lib)\r
if(MSVC)\r
add_definitions(-D_CRT_SECURE_NO_WARNINGS -wd4996)\r
endif(MSVC)\r
if(WIN32)\r
- add_definitions(-DWIN32)\r
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Add a suffix, usually d on Windows")\r
endif(WIN32)\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.c\r
+ lib/xmltok_impl.c\r
lib/xmltok_ns.c\r
)\r
\r
add_library(expat ${_SHARED} ${expat_SRCS})\r
\r
set(LIBCURRENT 7) # sync\r
-set(LIBREVISION 2) # with\r
+set(LIBREVISION 4) # with\r
set(LIBAGE 6) # configure.ac!\r
math(EXPR LIBCURRENT_MINUS_AGE "${LIBCURRENT} - ${LIBAGE}")\r
\r
set_property(TARGET expat PROPERTY NO_SONAME ${NO_SONAME})\r
endif(NOT WIN32)\r
\r
-install(TARGETS expat RUNTIME DESTINATION bin\r
+macro(expat_install)\r
+ if(INSTALL)\r
+ install(${ARGN})\r
+ endif()\r
+endmacro()\r
+\r
+expat_install(TARGETS expat RUNTIME DESTINATION bin\r
LIBRARY DESTINATION lib\r
ARCHIVE DESTINATION lib)\r
\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
-add_custom_command(TARGET expat PRE_BUILD COMMAND $(MAKE) -C doc xmlwf.1)\r
+expat_install(FILES lib/expat.h lib/expat_external.h DESTINATION include)\r
+expat_install(FILES ${CMAKE_CURRENT_BINARY_DIR}/expat.pc DESTINATION lib/pkgconfig)\r
\r
if(BUILD_tools AND NOT WINCE)\r
set(xmlwf_SRCS\r
add_executable(xmlwf ${xmlwf_SRCS})\r
set_property(TARGET xmlwf PROPERTY RUNTIME_OUTPUT_DIRECTORY xmlwf)\r
target_link_libraries(xmlwf expat)\r
- install(TARGETS xmlwf DESTINATION bin)\r
- install(FILES doc/xmlwf.1 DESTINATION share/man/man1)\r
+ expat_install(TARGETS xmlwf DESTINATION bin)\r
+ if(BUILD_doc AND NOT MSVC)\r
+ if(CMAKE_GENERATOR STREQUAL "Unix Makefiles")\r
+ set(make_command "$(MAKE)")\r
+ else()\r
+ set(make_command "make")\r
+ endif()\r
+\r
+ add_custom_command(TARGET expat PRE_BUILD COMMAND "${make_command}" -C "${PROJECT_SOURCE_DIR}/doc" xmlwf.1)\r
+ expat_install(FILES "${PROJECT_SOURCE_DIR}/doc/xmlwf.1" DESTINATION share/man/man1)\r
+ endif()\r
endif(BUILD_tools AND NOT WINCE)\r
\r
if(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
+ add_executable(runtests tests/runtests.c tests/chardata.c tests/minicheck.c tests/memcheck.c)\r
set_property(TARGET runtests PROPERTY RUNTIME_OUTPUT_DIRECTORY tests)\r
target_link_libraries(runtests expat)\r
add_test(runtests tests/runtests)\r
\r
- add_executable(runtestspp tests/runtestspp.cpp tests/chardata.c tests/minicheck.c)\r
+ add_executable(runtestspp tests/runtestspp.cpp tests/chardata.c tests/minicheck.c tests/memcheck.c)\r
set_property(TARGET runtestspp PROPERTY RUNTIME_OUTPUT_DIRECTORY tests)\r
target_link_libraries(runtestspp expat)\r
add_test(runtestspp tests/runtestspp)\r