[cmake] drop FORCE_STATIC_PROVIDERS in favor of FORCE_STATIC_LIBS (#43814)

one cannot be used without the other since there is a cycle dependency between qgis_core and proiver_postgres/wms (cycle dep is only possible if the 2 libs are static
This commit is contained in:
Denis Rouzaud 2021-06-21 17:09:09 +02:00 committed by GitHub
parent 4461d8995b
commit 5e62599c30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 28 deletions

View File

@ -94,25 +94,19 @@ endif(NOT MSVC)
if (IOS)
set (DEFAULT_FORCE_STATIC_LIBS TRUE)
set (DEFAULT_FORCE_STATIC_PROVIDERS TRUE)
else()
set (DEFAULT_FORCE_STATIC_LIBS FALSE)
set (DEFAULT_FORCE_STATIC_PROVIDERS FALSE)
endif()
set (FORCE_STATIC_LIBS ${DEFAULT_FORCE_STATIC_LIBS} CACHE BOOL "Determines whether libraries should be static only")
mark_as_advanced(FORCE_STATIC_LIBS)
if (FORCE_STATIC_LIBS)
set (LIBRARY_TYPE STATIC)
else()
set (LIBRARY_TYPE SHARED)
endif()
set (FORCE_STATIC_PROVIDERS ${DEFAULT_FORCE_STATIC_PROVIDERS} CACHE BOOL "Determines whether data providers should be static only")
mark_as_advanced(FORCE_STATIC_PROVIDERS)
if (FORCE_STATIC_PROVIDERS)
# following variable is used in qgsconfig.h
set (HAVE_STATIC_PROVIDERS TRUE)
else()
set (LIBRARY_TYPE SHARED)
unset(HAVE_STATIC_PROVIDERS)
endif()
# in generated makefiles use relative paths so the project dir is moveable

View File

@ -2014,7 +2014,7 @@ if (HAVE_PDAL)
)
endif()
if (FORCE_STATIC_PROVIDERS)
if (FORCE_STATIC_LIBS)
include_directories(
${CMAKE_SOURCE_DIR}/src/providers/wms
${CMAKE_SOURCE_DIR}/src/providers/postgres

View File

@ -1495,7 +1495,7 @@ target_link_libraries(qgis_gui
${Qt5QuickWidgets_LIBRARIES}
)
if (FORCE_STATIC_PROVIDERS)
if (FORCE_STATIC_LIBS)
target_link_libraries(qgis_gui
provider_wms_gui_a
provider_postgres_gui_a

View File

@ -120,7 +120,7 @@ class GUI_EXPORT QgsProviderGuiRegistry
/**
* Loads the dynamic plugins on the given path
* When QGIS is compiled with FORCE_STATIC_PROVIDERS,
* When QGIS is compiled with FORCE_STATIC_LIBS,
* the function is no-op
*/
void loadDynamicProviders( const QString &pluginPath );

View File

@ -8,7 +8,7 @@ if (POSTGRES_FOUND)
add_subdirectory(postgres)
endif()
if (NOT FORCE_STATIC_PROVIDERS)
if (NOT FORCE_STATIC_LIBS)
add_subdirectory(arcgisrest)
add_subdirectory(delimitedtext)
add_subdirectory(geonode)

View File

@ -70,12 +70,6 @@ target_compile_features(provider_postgres_a PRIVATE cxx_std_17)
target_link_libraries (provider_postgres_a
qgis_core
${POSTGRES_LIBRARY}
${Qt5Xml_LIBRARIES}
${Qt5Core_LIBRARIES}
${Qt5Svg_LIBRARIES}
${Qt5Network_LIBRARIES}
${Qt5Sql_LIBRARIES}
${Qt5Concurrent_LIBRARIES}
)
if (WITH_GUI)
@ -90,14 +84,6 @@ if (WITH_GUI)
qgis_gui
provider_postgres_a
${POSTGRES_LIBRARY}
${Qt5Xml_LIBRARIES}
${Qt5Core_LIBRARIES}
${Qt5Svg_LIBRARIES}
${Qt5Network_LIBRARIES}
${Qt5Sql_LIBRARIES}
${Qt5Concurrent_LIBRARIES}
${Qt5Gui_LIBRARIES}
${Qt5Widgets_LIBRARIES}
)
add_dependencies(provider_postgres_gui_a ui)
endif()
@ -141,7 +127,7 @@ endif()
#################################################################
if (FORCE_STATIC_PROVIDERS)
if (FORCE_STATIC_LIBS)
# for (external) mobile apps to be able to pick up provider for linking
install (TARGETS provider_postgres_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR})
install (TARGETS provider_postgresraster_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR})