diff CMakeLists.txt @ 367:8d45d892be88 default tip

*: instead of pugixml, use Qt XML features this means we have one extra Qt dependency though...
author Paper <paper@tflc.us>
date Sun, 17 Nov 2024 22:55:47 -0500
parents 99c961c91809
children
line wrap: on
line diff
--- a/CMakeLists.txt	Sun Nov 17 19:56:01 2024 -0500
+++ b/CMakeLists.txt	Sun Nov 17 22:55:47 2024 -0500
@@ -12,9 +12,6 @@
 
 add_subdirectory(dep/animone)
 add_subdirectory(dep/anitomy)
-add_subdirectory(dep/pugixml)
-add_subdirectory(dep/utf8proc)
-add_subdirectory(dep/fmt)
 
 # Fix for mingw64
 list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a")
@@ -29,22 +26,44 @@
 	find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
 endif()
 
-find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets LinguistTools)
+find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets LinguistTools Xml)
 
-# find_package(CURL) fails sometimes
+# find_package(CURL) is dysfunctional
 find_package(PkgConfig REQUIRED)
 pkg_check_modules(CURL REQUIRED libcurl)
+pkg_check_modules(UTF8PROC libutf8proc)
+pkg_check_modules(FMT fmt)
+
+message("${FMT_LINK_LIBRARIES}")
+
+if(NOT UTF8PROC_FOUND)
+	add_subdirectory(dep/utf8proc)
+endif()
+
+if(NOT FMT_FOUND)
+	add_subdirectory(dep/fmt)
+endif()
 
 set(LIBRARIES
-	${CURL_LIBRARIES}
 	${Qt${QT_VERSION_MAJOR}Widgets_LIBRARIES}
+	${Qt${QT_VERSION_MAJOR}Xml_LIBRARIES}
+	${CURL_LINK_LIBRARIES}
 	anitomy
 	animia
-	pugixml
-	utf8proc
-	fmt
 )
 
+if(UTF8PROC_FOUND)
+	list(APPEND LIBRARIES ${UTF8PROC_LINK_LIBRARIES})
+else()
+	list(APPEND LIBRARIES utf8proc)
+endif()
+
+if(FMT_FOUND)
+	list(APPEND LIBRARIES ${FMT_LINK_LIBRARIES})
+else()
+	list(APPEND LIBRARIES fmt)
+endif()
+
 set(QT_MOC_FILES
 	include/core/http.h
 	include/core/session.h
@@ -155,15 +174,27 @@
 )
 
 set(INCLUDE
+	${Qt${QT_VERSION_MAJOR}Widgets_INCLUDE_DIRS}
+	${Qt${QT_VERSION_MAJOR}Xml_INCLUDE_DIRS}
+	${CURL_INCLUDE_DIRS}
 	include
-	dep/pugixml/src
 	dep/animia/include
-	dep/fmt/include
-	dep/utf8proc
 	dep/anitomy
 	dep
 )
 
+if(UTF8PROC_FOUND)
+	list(APPEND INCLUDE ${UTF8PROC_INCLUDE_DIRS})
+else()
+	list(APPEND INCLUDE dep/utf8proc)
+endif()
+
+if(FMT_FOUND)
+	list(APPEND INCLUDE ${FMT_INCLUDE_DIRS})
+else()
+	list(APPEND INCLUDE dep/fmt/include)
+endif()
+
 set(TS_FILES
 	rc/locale/en_GB.ts
 )
@@ -267,7 +298,7 @@
 set_property(TARGET minori PROPERTY CXX_STANDARD 17)
 set_property(TARGET minori PROPERTY AUTORCC ON)
 
-target_include_directories(minori PRIVATE ${Qt${QT_VERSION_MAJOR}Widgets_INCLUDE_DIRS} ${CURL_INCLUDE_DIRS} PUBLIC ${INCLUDE})
+target_include_directories(minori PRIVATE ${INCLUDE})
 target_link_libraries(minori PRIVATE ${LIBRARIES})
 target_compile_options(minori PRIVATE -Wall -Wpedantic -Wextra -Wsuggest-override -Wold-style-cast)
 target_compile_definitions(minori PRIVATE ${DEFINES})