]> granicus.if.org Git - libexpat/commitdiff
CMake: Gather configuration options near the top
authorSebastian Pipping <sebastian@pipping.org>
Sun, 11 Aug 2019 21:39:22 +0000 (23:39 +0200)
committerSebastian Pipping <sebastian@pipping.org>
Mon, 12 Aug 2019 19:26:08 +0000 (21:26 +0200)
expat/CMakeLists.txt

index c01fdef56205b687105d5f8e30e7ea9d4c479c3d..9b6c5e14639e54f184795b3c501caeb1d7098d90 100644 (file)
@@ -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}")