diff --git a/Config.cmake/fmixml.cmake b/Config.cmake/fmixml.cmake index 03acb3ed..eb805e5b 100644 --- a/Config.cmake/fmixml.cmake +++ b/Config.cmake/fmixml.cmake @@ -139,70 +139,14 @@ set(FMIXMLSOURCE SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DXML_STATIC -DFMI_XML_QUERY") -include(ExternalProject) - -set(EXPAT_SETTINGS - -DBUILD_tools:BOOLEAN=OFF - -DBUILD_examples:BOOLEAN=OFF - -DBUILD_tests:BOOLEAN=OFF - -DBUILD_shared:BOOLEAN=OFF - -DXML_DTD:BOOLEAN=OFF - -DXML_NS:BOOLEAN=OFF - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS} - -DCMAKE_C_FLAGS_DEBUG:STRING=${CMAKE_C_FLAGS_DEBUG} - -DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE} - -DCMAKE_C_FLAGS_MINSIZEREL:STRING=${CMAKE_C_FLAGS_MINSIZEREL} - -DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_C_FLAGS_RELWITHDEBINFO} - -DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_EXE_LINKER_FLAGS} - -DCMAKE_LINK_LIBRARY_FLAG:STRING=${CMAKE_LINK_LIBRARY_FLAG} - -DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_MODULE_LINKER_FLAGS} - -DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_SHARED_LINKER_FLAGS} - -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_BINARY_DIR}/ExpatEx/install -) - -ExternalProject_Add( - expatex - PREFIX "${FMIXML_EXPAT_DIR}" - SOURCE_DIR "${FMIXML_EXPAT_DIR}" - CMAKE_CACHE_ARGS ${EXPAT_SETTINGS} - BINARY_DIR ${CMAKE_BINARY_DIR}/ExpatEx - INSTALL_DIR ${CMAKE_BINARY_DIR}/ExpatEx/install - TMP_DIR ${CMAKE_BINARY_DIR}/ExpatEx/tmp - STAMP_DIR ${CMAKE_BINARY_DIR}/ExpatEx/stamp -) - -ExternalProject_Add_Step( - expatex dependent_reconfigure - DEPENDEES configure - DEPENDERS build - COMMAND ${CMAKE_COMMAND} -E echo "Running: ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" ${EXPAT_SETTINGS} ${FMIXML_EXPAT_DIR}" - COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" ${EXPAT_SETTINGS} "${FMIXML_EXPAT_DIR}" - DEPENDS ${CMAKE_BINARY_DIR}/CMakeCache.txt - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/ExpatEx -) - -add_dependencies(expatex ${CMAKE_BINARY_DIR}/CMakeCache.txt ${FMILIBRARYHOME}/CMakeLists.txt) - -set(expatlib "${CMAKE_BINARY_DIR}/ExpatEx/${CMAKE_CFG_INTDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}expat${CMAKE_STATIC_LIBRARY_SUFFIX}") - -add_library(expat STATIC IMPORTED) - -set_target_properties( - expat PROPERTIES - IMPORTED_LOCATION "${expatlib}" -) - -add_dependencies(expat expatex) - -if(FMILIB_INSTALL_SUBLIBS) - install(FILES - "${CMAKE_BINARY_DIR}/ExpatEx/install/lib/${CMAKE_STATIC_LIBRARY_PREFIX}expat${CMAKE_STATIC_LIBRARY_SUFFIX}" - DESTINATION lib) -endif() - -set(EXPAT_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/ExpatEx/install/include) - +### Add the options of expat to the cache and add it as subdirectory. +set(BUILD_tools OFF CACHE BOOL "build the xmlwf tool for expat library") +set(BUILD_examples OFF CACHE BOOL "build the examples for expat library") +set(BUILD_tests OFF CACHE BOOL "build the tests for expat library") +set(BUILD_shared OFF CACHE BOOL "build a shared expat library") +add_subdirectory(ThirdParty/Expat/expat-2.1.0) + +set(EXPAT_INCLUDE_DIRS ThirdParty/Expat/expat-2.1.0/lib) include_directories("${EXPAT_INCLUDE_DIRS}" "${FMILIB_THIRDPARTYLIBS}/FMI/" "${FMIXMLGENDIR}/FMI1" "${FMIXMLGENDIR}/FMI2") PREFIXLIST(FMIXMLSOURCE ${FMIXMLDIR}/) diff --git a/ThirdParty/Expat/expat-2.1.0/CMakeLists.txt b/ThirdParty/Expat/expat-2.1.0/CMakeLists.txt index 0c923baa..bd521502 100644 --- a/ThirdParty/Expat/expat-2.1.0/CMakeLists.txt +++ b/ThirdParty/Expat/expat-2.1.0/CMakeLists.txt @@ -37,7 +37,7 @@ endif(BUILD_tests) include(ConfigureChecks.cmake) -include_directories(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/lib) +include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/lib) if(MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS -wd4996) endif(MSVC)