@@ -2,7 +2,24 @@ include_directories(../../CoreLib)
22include_directories (../../NucleusLib/inc )
33include_directories (../../PubUtilLib )
44
5- include_directories (${EXPAT_INCLUDE_DIR} )
5+ # Skip CMake's built in FindExpat module and use libexpat's CMake config, if possible,
6+ # due to library rename in libexpat 2.2.8 and higher.
7+ find_package (EXPAT CONFIG QUIET )
8+ if (NOT TARGET expat::libexpat)
9+ message (DEBUG "libexpat CMake Config not found, using FindExpat module." )
10+ find_package (EXPAT REQUIRED )
11+ add_library (expat::libexpat STATIC IMPORTED )
12+ set_target_properties (expat::libexpat PROPERTIES
13+ INTERFACE_INCLUDE_DIRECTORIES ${EXPAT_INCLUDE_DIR}
14+ IMPORTED_LOCATION ${EXPAT_LIBRARY}
15+ )
16+ endif ()
17+
18+ set_package_properties (EXPAT PROPERTIES
19+ URL "https://github.com/libexpat/libexpat"
20+ DESCRIPTION "Expat XML Parser for C"
21+ TYPE REQUIRED
22+ )
623
724if (WIN32 )
825 add_definitions (-DWIN32 )
@@ -25,6 +42,7 @@ set(pfLocalizationMgr_HEADERS
2542)
2643
2744add_library (pfLocalizationMgr STATIC ${pfLocalizationMgr_SOURCES} ${pfLocalizationMgr_HEADERS} )
45+ target_link_libraries (pfLocalizationMgr expat::libexpat )
2846
2947source_group ("Source Files" FILES ${pfLocalizationMgr_SOURCES} )
3048source_group ("Header Files" FILES ${pfLocalizationMgr_HEADERS} )
0 commit comments