Unverified Commit 677153cc authored by Luca Beltrame's avatar Luca Beltrame
Browse files

Fix link definitions with newer CMake versions

LINK_PUBLIC and LINK_PRIVATE have been deprecated for many years, and
SailfishOS has a newer enough CMake version now. Marble requires CMake
3.10 anyway.

Without this change, cmake 3.24.0 won't find the imported targets when
Marble is used as a library.
parent 7c89da6c
Pipeline #220454 passed with stage
in 19 minutes and 3 seconds
......@@ -11,21 +11,18 @@ qt_wrap_ui(marble_SRCS ${marble_UI})
add_library (marbleui STATIC ${marble_SRCS})
# TODO: use PUBLIC/PRIVATE everywhere instead of LINK_PUBLIC/LINK_PRIVATE
# once SailfishOS has cmake >= 2.8.12
target_link_libraries (
marbleui
LINK_PUBLIC
PUBLIC
marblewidget
Qt5::Widgets
Qt5::PrintSupport
LINK_PRIVATE
PRIVATE
Qt5::Network
)
if (NOT MARBLE_NO_DBUS)
target_link_libraries( marbleui
LINK_PRIVATE
PRIVATE
Qt5::DBus
)
endif ()
......@@ -34,7 +31,7 @@ if(WIN32)
# TODO: PUBLIC or can be PRIVATE?
target_link_libraries(
marbleui
LINK_PUBLIC
PUBLIC
ws2_32
imm32
winmm
......@@ -44,6 +41,6 @@ endif(WIN32)
## this works for win32 only because FindQt does not handle this correct
if(STATIC_BUILD AND WIN32)
# TODO: PUBLIC or can be PRIVATE?
target_link_libraries(marbleui LINK_PUBLIC ${QT_PLUGINS_DIR}/imageformats/qjpeg.lib)
target_link_libraries(marbleui LINK_PUBLIC ${QT_PLUGINS_DIR}/imageformats/qsvg.lib)
target_link_libraries(marbleui PUBLIC ${QT_PLUGINS_DIR}/imageformats/qjpeg.lib)
target_link_libraries(marbleui PUBLIC ${QT_PLUGINS_DIR}/imageformats/qsvg.lib)
endif()
......@@ -375,24 +375,20 @@ add_library(marblewidget ${marblewidget_SRCS} ${SOURCES_UI_HDRS})
generate_export_header(marblewidget BASE_NAME marble)
# TODO: use PUBLIC/PRIVATE everywhere instead of LINK_PUBLIC/LINK_PRIVATE
# once SailfishOS has cmake >= 2.8.12
# link with libastro
target_link_libraries(marblewidget LINK_PRIVATE astro)
target_link_libraries(marblewidget PRIVATE astro)
# link against zlib
target_link_libraries(marblewidget LINK_PRIVATE ${ZLIB_LIBRARIES})
target_link_libraries(marblewidget PRIVATE ${ZLIB_LIBRARIES})
# link with release version of Qt libs
target_link_libraries(marblewidget
LINK_PUBLIC
PUBLIC
Qt5::Xml
Qt5::Gui
Qt5::Widgets
Qt5::Network
LINK_PRIVATE
PRIVATE
Qt5::Core
Qt5::Svg
Qt5::PrintSupport
......@@ -400,7 +396,7 @@ target_link_libraries(marblewidget
)
if (NOT MARBLE_NO_WEBKITWIDGETS)
target_link_libraries(marblewidget
LINK_PUBLIC
PUBLIC
Qt5::WebChannel
Qt5::WebEngineWidgets
Qt5::WebEngine
......@@ -408,13 +404,13 @@ if (NOT MARBLE_NO_WEBKITWIDGETS)
endif ()
if (NOT MARBLE_NO_DBUS)
target_link_libraries(marblewidget
LINK_PRIVATE
PRIVATE
Qt5::DBus
)
endif ()
if (Phonon4Qt5_FOUND)
target_link_libraries(marblewidget
LINK_PRIVATE
PRIVATE
Phonon::phonon4qt5
)
endif()
......@@ -422,17 +418,17 @@ endif()
if (APPLE)
# TODO: PUBLIC or can be PRIVATE?
#defined in top level makefile
target_link_libraries(marblewidget LINK_PUBLIC ${MAC_EXTRA_LIBS} )
target_link_libraries(marblewidget PUBLIC ${MAC_EXTRA_LIBS} )
endif (APPLE)
# TODO: still supported?
if (CMAKE_SYSTEM_NAME MATCHES "SunOS")
target_link_libraries(marblewidget LINK_PUBLIC m)
target_link_libraries(marblewidget PUBLIC m)
endif (CMAKE_SYSTEM_NAME MATCHES "SunOS")
if(WIN32)
# TODO: PUBLIC or can be PRIVATE?
target_link_libraries(marblewidget LINK_PUBLIC ws2_32 imm32 winmm)
target_link_libraries(marblewidget PUBLIC ws2_32 imm32 winmm)
endif(WIN32)
set_target_properties(marblewidget PROPERTIES
......
......@@ -38,17 +38,14 @@ target_include_directories(marbledeclarative PUBLIC $<BUILD_INTERFACE:${CMAKE_CU
marble_add_project_resources(qmldir)
# TODO: use PUBLIC/PRIVATE everywhere instead of LINK_PUBLIC/LINK_PRIVATE
# once SailfishOS has cmake >= 2.8.12
target_link_libraries( marbledeclarative
LINK_PUBLIC
PUBLIC
marblewidget
Qt5::Quick
)
if(Qt5Positioning_FOUND)
target_link_libraries( marbledeclarative
LINK_PRIVATE
PRIVATE
Qt5::Positioning
)
endif()
......
  • This was meant to be pushed as a branch for a MR but I mixed up the git options. If need be, feel free to revert. Sorry for the trouble.

Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment