From: Sebastian Pipping Date: Sun, 11 Aug 2019 21:39:22 +0000 (+0200) Subject: CMake: Gather configuration options near the top X-Git-Tag: R_2_2_8~43^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=823672d853455f18c0e977568f26970bbadbe73b;p=libexpat CMake: Gather configuration options near the top --- diff --git a/expat/CMakeLists.txt b/expat/CMakeLists.txt index c01fdef5..9b6c5e14 100644 --- a/expat/CMakeLists.txt +++ b/expat/CMakeLists.txt @@ -28,6 +28,9 @@ else() endif() endif() +# +# Configuration +# 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) @@ -35,6 +38,23 @@ option(BUILD_shared "build a shared expat library" 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) +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) +option(XML_NS "Define to make XML Namespaces functionality available" ON) +option(WARNINGS_AS_ERRORS "Treat all compiler warnings as errors" OFF) +if(NOT WIN32) + option(XML_DEV_URANDOM "Define to include code reading entropy from `/dev/urandom'." ON) + set(USE_GETRANDOM "AUTO" CACHE STRING + "Make use of getrandom function (ON|OFF|AUTO) [default=AUTO]") + set(USE_SYS_GETRANDOM "AUTO" CACHE STRING + "Make use of syscall SYS_getrandom (ON|OFF|AUTO) [default=AUTO]") +endif() +option(XML_UNICODE "Use UTF-16 encoded chars (two bytes) instead of UTF-8" OFF) +option(XML_UNICODE_WCHAR_T "Use wchar_t to represent UTF-16 instead of unsigned short" OFF) +option(XML_ATTR_INFO "Define to allow retrieving the byte offsets for attribute names and values" OFF) +if(MSVC) + set(MSVC_USE_STATIC_CRT OFF CACHE BOOL "Use /MT flag (static CRT) when compiling in MSVC") +endif() if(USE_libbsd) find_library(LIB_BSD NAMES bsd) @@ -45,28 +65,13 @@ if(USE_libbsd) 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) -option(XML_NS "Define to make XML Namespaces functionality available" ON) -option(WARNINGS_AS_ERRORS "Treat all compiler warnings as errors" OFF) if(NOT WIN32) - option(XML_DEV_URANDOM "Define to include code reading entropy from `/dev/urandom'." ON) if(XML_DEV_URANDOM) set(XML_DEV_URANDOM 1) else(XML_DEV_URANDOM) set(XML_DEV_URANDOM 0) endif(XML_DEV_URANDOM) endif() -if (NOT WIN32) - set(USE_GETRANDOM "AUTO" CACHE STRING - "Make use of getrandom function (ON|OFF|AUTO) [default=AUTO]") - set(USE_SYS_GETRANDOM "AUTO" CACHE STRING - "Make use of syscall SYS_getrandom (ON|OFF|AUTO) [default=AUTO]") -endif() -option(XML_UNICODE "Use UTF-16 encoded chars (two bytes) instead of UTF-8" OFF) -option(XML_UNICODE_WCHAR_T "Use wchar_t to represent UTF-16 instead of unsigned short" OFF) -option(XML_ATTR_INFO "Define to allow retrieving the byte offsets for attribute names and values" OFF) if(XML_DTD) set(XML_DTD 1) @@ -147,7 +152,6 @@ endif(WARNINGS_AS_ERRORS) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_COMPILE_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_COMPILE_FLAGS}") -set(MSVC_USE_STATIC_CRT OFF CACHE BOOL "Use /MT flag (static CRT) when compiling in MSVC") if (MSVC) if (MSVC_USE_STATIC_CRT) message("-- Using static CRT ${MSVC_USE_STATIC_CRT}")