From 5017c6c8c236544b0ffa4aded6768a8b7d2e0959 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sat, 27 Jan 2018 13:33:31 +0100 Subject: [PATCH] CMake: expat code in separate file Consistent with other external libraries. --- build/cmake/lib/CMakeLists.txt | 2 +- build/cmake/lib/expat.cmake | 22 ++++++++++++++++++++++ build/cmake/lib/xml/CMakeLists.txt | 12 ------------ build/cmake/options.cmake | 2 -- 4 files changed, 23 insertions(+), 15 deletions(-) create mode 100644 build/cmake/lib/expat.cmake diff --git a/build/cmake/lib/CMakeLists.txt b/build/cmake/lib/CMakeLists.txt index a676510ad7..45a7696d01 100644 --- a/build/cmake/lib/CMakeLists.txt +++ b/build/cmake/lib/CMakeLists.txt @@ -20,7 +20,7 @@ if(wxBUILD_MONOLITHIC) endif() # Define third party libraries -set(LIBS_THIRDPARTY regex zlib) +set(LIBS_THIRDPARTY regex zlib expat) if(wxUSE_GUI) list(APPEND LIBS_THIRDPARTY jpeg png tiff) endif() diff --git a/build/cmake/lib/expat.cmake b/build/cmake/lib/expat.cmake new file mode 100644 index 0000000000..630ce175d3 --- /dev/null +++ b/build/cmake/lib/expat.cmake @@ -0,0 +1,22 @@ +############################################################################# +# Name: build/cmake/lib/expat.cmake +# Purpose: Use external or internal expat lib +# Author: Tobias Taschner +# Created: 2016-09-21 +# Copyright: (c) 2016 wxWidgets development team +# Licence: wxWindows licence +############################################################################# + +wx_add_thirdparty_library(wxUSE_EXPAT EXPAT "use expat for XML parsing" DEFAULT_APPLE sys) + +if(wxUSE_EXPAT STREQUAL "builtin") + wx_add_builtin_library(wxexpat + src/expat/expat/lib/xmlparse.c + src/expat/expat/lib/xmlrole.c + src/expat/expat/lib/xmltok.c + ) + set(EXPAT_LIBRARIES wxexpat) + set(EXPAT_INCLUDE_DIRS ${wxSOURCE_DIR}/src/expat/expat/lib) +elseif(wxUSE_EXPAT) + find_package(EXPAT REQUIRED) +endif() diff --git a/build/cmake/lib/xml/CMakeLists.txt b/build/cmake/lib/xml/CMakeLists.txt index 4dfc9e4cc2..21173c5ad1 100644 --- a/build/cmake/lib/xml/CMakeLists.txt +++ b/build/cmake/lib/xml/CMakeLists.txt @@ -9,18 +9,6 @@ include(../../source_groups.cmake) -if(wxUSE_EXPAT STREQUAL "builtin") - wx_add_builtin_library(wxexpat - src/expat/expat/lib/xmlparse.c - src/expat/expat/lib/xmlrole.c - src/expat/expat/lib/xmltok.c - ) - set(EXPAT_LIBRARIES wxexpat) - set(EXPAT_INCLUDE_DIRS ${wxSOURCE_DIR}/src/expat/expat/lib) -elseif(wxUSE_EXPAT) - find_package(EXPAT) -endif() - wx_append_sources(XML_FILES XML) wx_add_library(xml IS_BASE ${XML_FILES}) wx_lib_link_libraries(xml diff --git a/build/cmake/options.cmake b/build/cmake/options.cmake index fd0dab3cbe..10797d80cc 100644 --- a/build/cmake/options.cmake +++ b/build/cmake/options.cmake @@ -56,8 +56,6 @@ wx_option(wxUSE_VISIBILITY "use of ELF symbols visibility") # --------------------------------------------------------------------------- # external libraries # --------------------------------------------------------------------------- -wx_add_thirdparty_library(wxUSE_EXPAT EXPAT "use expat for XML parsing" - DEFAULT_APPLE sys) wx_option(wxUSE_OPENGL "use OpenGL (or Mesa)")