CMake: Don't use external project for wxexpat

This simplifies things a lot. And it is also not used for png, tiff and zlib.
This commit is contained in:
Maarten Bent
2018-01-10 22:58:53 +01:00
parent 21615b1634
commit f166d3b9c0

View File

@@ -9,45 +9,14 @@
include(../../source_groups.cmake)
if(WIN32)
set(EXPAT_POSTFIX $<$<CONFIG:Debug>:d>)
endif(WIN32)
if(wxUSE_EXPAT STREQUAL "builtin")
ExternalProject_Add(wxexpat
DOWNLOAD_COMMAND ""
SOURCE_DIR ${wxSOURCE_DIR}/src/expat/expat
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DBUILD_tools=OFF
-DBUILD_examples=OFF
-DBUILD_tests=OFF
-DBUILD_shared=OFF
INSTALL_COMMAND
${CMAKE_COMMAND} --build <BINARY_DIR> --config $<CONFIGURATION> --target install
COMMAND
${CMAKE_COMMAND} -E make_directory <INSTALL_DIR>/wxlib
COMMAND
${CMAKE_COMMAND} -E rename
<INSTALL_DIR>/lib/${CMAKE_STATIC_LIBRARY_PREFIX}expat${EXPAT_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}
<INSTALL_DIR>/wxlib/${CMAKE_STATIC_LIBRARY_PREFIX}wxexpat$<$<CONFIG:Debug>:d>${CMAKE_STATIC_LIBRARY_SUFFIX}
)
ExternalProject_Get_Property(wxexpat INSTALL_DIR)
add_library(expat STATIC IMPORTED)
set_target_properties(expat PROPERTIES
IMPORTED_LOCATION "${INSTALL_DIR}/wxlib/${CMAKE_STATIC_LIBRARY_PREFIX}wxexpat${CMAKE_STATIC_LIBRARY_SUFFIX}"
IMPORTED_LOCATION_DEBUG "${INSTALL_DIR}/wxlib/${CMAKE_STATIC_LIBRARY_PREFIX}wxexpatd${CMAKE_STATIC_LIBRARY_SUFFIX}"
FOLDER "Third Party Libraries"
)
add_dependencies(expat wxexpat)
set(EXPAT_INCLUDE_DIRS "${INSTALL_DIR}/include")
set(EXPAT_LIBRARIES expat)
if(NOT wxBUILD_SHARED)
wx_install(
FILES ${INSTALL_DIR}/wxlib/${CMAKE_STATIC_LIBRARY_PREFIX}wxexpat$<$<CONFIG:Debug>:d>${CMAKE_STATIC_LIBRARY_SUFFIX}
DESTINATION "lib${wxPLATFORM_LIB_DIR}")
endif()
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()