Merge branch 'DerDakon-cmake-cleanup' (pull request #114)
This commit is contained in:
commit
58ec47bbc8
@ -10,14 +10,39 @@ set(PACKAGE_VERSION "2.2.3")
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
set(PACKAGE_TARNAME "${PACKAGE_NAME}")
|
||||
|
||||
option(BUILD_tools "build the xmlwf tool for expat library" ON)
|
||||
if(WINCE)
|
||||
set(BUILD_tools_default OFF)
|
||||
else()
|
||||
set(BUILD_tools_default ON)
|
||||
endif()
|
||||
if(MSVC OR NOT BUILD_tools_default)
|
||||
set(BUILD_doc_default OFF)
|
||||
else()
|
||||
find_program(DOCBOOK_TO_MAN NAMES docbook2x-man)
|
||||
if(DOCBOOK_TO_MAN)
|
||||
set(BUILD_doc_default ON)
|
||||
else()
|
||||
set(BUILD_doc_default OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(BUILD_tools "build the xmlwf tool for expat library" ${BUILD_tools_default})
|
||||
option(BUILD_examples "build the examples for expat library" ON)
|
||||
option(BUILD_tests "build the tests for expat library" ON)
|
||||
option(BUILD_shared "build a shared expat library" ON)
|
||||
option(BUILD_doc "build man page for xmlwf" ON)
|
||||
option(BUILD_doc "build man page for xmlwf" ${BUILD_doc_default})
|
||||
option(USE_libbsd "utilize libbsd (for arc4random_buf)" OFF)
|
||||
option(INSTALL "install expat files in cmake install target" ON)
|
||||
|
||||
if(USE_libbsd)
|
||||
find_library(LIB_BSD NAMES bsd)
|
||||
if(NOT LIB_BSD)
|
||||
message(FATAL_ERROR "USE_libbsd option is enabled, but libbsd was not found")
|
||||
else()
|
||||
set(HAVE_LIBBSD TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# configuration options
|
||||
set(XML_CONTEXT_BYTES 1024 CACHE STRING "Define to specify how much context to retain around the current parse point")
|
||||
option(XML_DTD "Define to make parameter entity parsing functionality available" ON)
|
||||
@ -46,14 +71,12 @@ endif(BUILD_tests)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/ConfigureChecks.cmake)
|
||||
|
||||
set(EXTRA_LINK_AND_COMPILE_FLAGS)
|
||||
set(EXTRA_COMPILE_FLAGS)
|
||||
if(FLAG_NO_STRICT_ALIASING)
|
||||
set(EXTRA_LINK_AND_COMPILE_FLAGS "${EXTRA_LINK_AND_COMPILE_FLAGS} -fno-strict-aliasing")
|
||||
set(EXTRA_COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -fno-strict-aliasing")
|
||||
endif()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_LINK_AND_COMPILE_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_LINK_AND_COMPILE_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EXTRA_LINK_AND_COMPILE_FLAGS}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${EXTRA_LINK_AND_COMPILE_FLAGS}")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_COMPILE_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_COMPILE_FLAGS}")
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/lib)
|
||||
if(MSVC)
|
||||
@ -86,7 +109,7 @@ endif(BUILD_shared)
|
||||
|
||||
add_library(expat ${_SHARED} ${expat_SRCS})
|
||||
if(USE_libbsd)
|
||||
target_link_libraries(expat bsd)
|
||||
target_link_libraries(expat ${LIB_BSD})
|
||||
endif()
|
||||
|
||||
set(LIBCURRENT 7) # sync
|
||||
@ -119,7 +142,7 @@ configure_file(expat.pc.in ${CMAKE_CURRENT_BINARY_DIR}/expat.pc)
|
||||
expat_install(FILES lib/expat.h lib/expat_external.h DESTINATION include)
|
||||
expat_install(FILES ${CMAKE_CURRENT_BINARY_DIR}/expat.pc DESTINATION lib/pkgconfig)
|
||||
|
||||
if(BUILD_tools AND NOT WINCE)
|
||||
if(BUILD_tools)
|
||||
set(xmlwf_SRCS
|
||||
xmlwf/xmlwf.c
|
||||
xmlwf/xmlfile.c
|
||||
@ -131,17 +154,17 @@ if(BUILD_tools AND NOT WINCE)
|
||||
set_property(TARGET xmlwf PROPERTY RUNTIME_OUTPUT_DIRECTORY xmlwf)
|
||||
target_link_libraries(xmlwf expat)
|
||||
expat_install(TARGETS xmlwf DESTINATION bin)
|
||||
if(BUILD_doc AND NOT MSVC)
|
||||
if(BUILD_doc)
|
||||
if(CMAKE_GENERATOR STREQUAL "Unix Makefiles")
|
||||
set(make_command "$(MAKE)")
|
||||
else()
|
||||
set(make_command "make")
|
||||
endif()
|
||||
|
||||
add_custom_command(TARGET expat PRE_BUILD COMMAND "${make_command}" -C "${PROJECT_SOURCE_DIR}/doc" xmlwf.1)
|
||||
add_custom_command(TARGET expat PRE_BUILD COMMAND "${make_command}" -C "${PROJECT_SOURCE_DIR}/doc" xmlwf.1 "DOCBOOK_TO_MAN=${DOCBOOK_TO_MAN}")
|
||||
expat_install(FILES "${PROJECT_SOURCE_DIR}/doc/xmlwf.1" DESTINATION share/man/man1)
|
||||
endif()
|
||||
endif(BUILD_tools AND NOT WINCE)
|
||||
endif()
|
||||
|
||||
if(BUILD_examples)
|
||||
add_executable(elements examples/elements.c)
|
||||
|
@ -10,6 +10,8 @@ Release 2.?.? ?????????????????
|
||||
#43 CMake: Auto-detect high quality entropy extractors, add new
|
||||
option USE_libbsd=ON to use arc4random_buf of libbsd
|
||||
#74 CMake: Add -fno-strict-aliasing only where supported
|
||||
#114 CMake: Always honor manually set BUILD_* options
|
||||
#114 CMake: Compile man page if docbook2x-man is available, only
|
||||
Improve test suite error output
|
||||
#111 Fix some typos in documentation
|
||||
|
||||
|
@ -25,7 +25,7 @@ check_function_exists("mmap" HAVE_MMAP)
|
||||
check_function_exists("getrandom" HAVE_GETRANDOM)
|
||||
|
||||
if(USE_libbsd)
|
||||
set(CMAKE_REQUIRED_LIBRARIES "bsd")
|
||||
set(CMAKE_REQUIRED_LIBRARIES "${LIB_BSD}")
|
||||
endif()
|
||||
check_function_exists("arc4random_buf" HAVE_ARC4RANDOM_BUF)
|
||||
if(NOT HAVE_ARC4RANDOM_BUF)
|
||||
|
@ -27,6 +27,9 @@
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#cmakedefine HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the `bsd' library (-lbsd). */
|
||||
#cmakedefine HAVE_LIBBSD
|
||||
|
||||
/* Define to 1 if you have the `memmove' function. */
|
||||
#cmakedefine HAVE_MEMMOVE
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user