Commit 10aab9db authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Use Qt5::* notation with target_link_libraries, & PUBLIC/PRIVATE interfaces

Summary:
Qt5::* notation is the usual way to refer to the imported cmake targets
representing the Qt5 modules/libs.

PUBLIC & PRIVATE link interfaces help to speed up compilation & linking,
because libs listed in PRIVATE will stay implementation detail of the lib
and not result in consumers of the lib also having those libs in the link
list. And it also reduces the amount of includes used, so less dirs to
search headers in.
To allow SailfishOS 2.0 builds, which has older cmake, still use
LINK_PUBLIC/LINK_PRIVATE for now

Reviewers: rahn, nienhueser

Reviewed By: nienhueser

Differential Revision: https://phabricator.kde.org/D1438
parent d1a46d87
......@@ -95,14 +95,6 @@ endif()
cmake_minimum_required(VERSION 2.8.12)
set(MARBLEWIDGET marblewidget-qt5)
include_directories( ${Qt5Svg_INCLUDE_DIRS} )
include_directories( ${Qt5PrintSupport_INCLUDE_DIRS} )
include_directories( ${Qt5Network_INCLUDE_DIRS} )
include_directories( ${Qt5Script_INCLUDE_DIRS} )
include_directories( ${Qt5Test_INCLUDE_DIRS} )
include_directories( ${Qt5Xml_INCLUDE_DIRS} )
include_directories( ${Qt5Sql_INCLUDE_DIRS} )
SET(CMAKE_AUTOMOC TRUE)
# Use M_PI under Windows
......
......@@ -85,8 +85,7 @@ macro( marble_add_test TEST_NAME )
add_executable( ${TEST_NAME} ${${TEST_NAME}_SRCS} )
target_link_libraries( ${TEST_NAME} ${MARBLEWIDGET} )
target_link_libraries( ${TEST_NAME} ${Qt5Test_LIBRARIES}
${Qt5DBus_LIBRARIES} )
target_link_libraries( ${TEST_NAME} Qt5::Test )
set_target_properties( ${TEST_NAME} PROPERTIES
COMPILE_FLAGS "-DDATA_PATH=\"\\\"${DATA_PATH}\\\"\" -DPLUGIN_PATH=\"\\\"${PLUGIN_PATH}\\\"\"" )
......
......@@ -9,7 +9,7 @@ include_directories(
set( ${TARGET}_SRC merge_ts_po.cpp )
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} ${Qt5Core_LIBRARIES} )
target_link_libraries( ${TARGET} Qt5::Core )
# MARBLE_WRAP_PO(qmfiles pofile1 pofile2 ... )
MACRO(MARBLE_WRAP_PO qmfiles)
......
......@@ -10,6 +10,5 @@ set( ${TARGET}_SRC main.cpp)
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} ${OpenCV_LIBS} ${MARBLEWIDGET} )
target_link_libraries( ${TARGET} ${Qt5Core_LIBRARIES} )
install( TARGETS ${TARGET} RUNTIME DESTINATION bin )
......@@ -10,7 +10,6 @@ set( ${TARGET}_SRC main.cpp)
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} ${MARBLEWIDGET} )
target_link_libraries( ${TARGET} ${Qt5Core_LIBRARIES} )
install( TARGETS ${TARGET} RUNTIME DESTINATION ${MARBLE_EXAMPLES_INSTALL_DIR}/${TARGET} )
install( FILES ${${TARGET}_SRC} Readme.txt DESTINATION ${MARBLE_EXAMPLES_INSTALL_DIR}/${TARGET} )
......
......@@ -10,7 +10,6 @@ set( ${TARGET}_SRC main.cpp)
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} ${MARBLEWIDGET} )
target_link_libraries( ${TARGET} ${Qt5Core_LIBRARIES} )
install( TARGETS ${TARGET} RUNTIME DESTINATION ${MARBLE_EXAMPLES_INSTALL_DIR}/${TARGET} )
install( FILES ${${TARGET}_SRC} Readme.txt DESTINATION ${MARBLE_EXAMPLES_INSTALL_DIR}/${TARGET} )
......
......@@ -10,7 +10,6 @@ set( ${TARGET}_SRC main.cpp)
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} ${MARBLEWIDGET} )
target_link_libraries( ${TARGET} ${Qt5Core_LIBRARIES} )
install( TARGETS ${TARGET} RUNTIME DESTINATION ${MARBLE_EXAMPLES_INSTALL_DIR}/${TARGET} )
install( FILES ${${TARGET}_SRC} Readme.txt DESTINATION ${MARBLE_EXAMPLES_INSTALL_DIR}/${TARGET} )
......
......@@ -10,7 +10,6 @@ set( ${TARGET}_SRC main.cpp)
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} ${MARBLEWIDGET} )
target_link_libraries( ${TARGET} ${Qt5Core_LIBRARIES} )
install( TARGETS ${TARGET} RUNTIME DESTINATION ${MARBLE_EXAMPLES_INSTALL_DIR}/${TARGET} )
install( FILES ${${TARGET}_SRC} Readme.txt DESTINATION ${MARBLE_EXAMPLES_INSTALL_DIR}/${TARGET} )
......
......@@ -10,7 +10,6 @@ set( ${TARGET}_SRC main.cpp)
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} ${MARBLEWIDGET} )
target_link_libraries( ${TARGET} ${Qt5Core_LIBRARIES} )
install( TARGETS ${TARGET} RUNTIME DESTINATION ${MARBLE_EXAMPLES_INSTALL_DIR}/${TARGET} )
install( FILES ${${TARGET}_SRC} Readme.txt DESTINATION ${MARBLE_EXAMPLES_INSTALL_DIR}/${TARGET} )
......
......@@ -10,6 +10,5 @@ set( ${TARGET}_SRC main.cpp)
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} ${MARBLEWIDGET} )
target_link_libraries( ${TARGET} ${Qt5Core_LIBRARIES} )
install( TARGETS ${TARGET} RUNTIME DESTINATION bin )
......@@ -10,7 +10,6 @@ set( ${TARGET}_SRC main.cpp)
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} ${MARBLEWIDGET} )
target_link_libraries( ${TARGET} ${Qt5Core_LIBRARIES} )
install( TARGETS ${TARGET} RUNTIME DESTINATION ${MARBLE_EXAMPLES_INSTALL_DIR}/${TARGET} )
install( FILES ${${TARGET}_SRC} Readme.txt DESTINATION ${MARBLE_EXAMPLES_INSTALL_DIR}/${TARGET} )
......
......@@ -10,7 +10,6 @@ set( ${TARGET}_SRC main.cpp)
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} ${MARBLEWIDGET} )
target_link_libraries( ${TARGET} ${Qt5Core_LIBRARIES} )
install( TARGETS ${TARGET} RUNTIME DESTINATION ${MARBLE_EXAMPLES_INSTALL_DIR}/${TARGET} )
install( FILES ${${TARGET}_SRC} Readme.txt DESTINATION ${MARBLE_EXAMPLES_INSTALL_DIR}/${TARGET} )
......
......@@ -27,8 +27,6 @@ target_link_libraries(
${MARBLEWIDGET}
marbleui)
target_link_libraries( ${TARGET} ${Qt5Core_LIBRARIES} )
install( TARGETS ${TARGET} RUNTIME DESTINATION ${MARBLE_EXAMPLES_INSTALL_DIR}/${TARGET} )
install( FILES ${${TARGET}_SRCS} DESTINATION ${MARBLE_EXAMPLES_INSTALL_DIR}/${TARGET} )
install( FILES CMakeLists.txt.external DESTINATION ${MARBLE_EXAMPLES_INSTALL_DIR}/${TARGET} RENAME CMakeLists.txt )
......
......@@ -12,7 +12,6 @@ qt5_add_resources(marble_QRCS marbleQuick2.qrc)
add_executable( ${TARGET} ${${TARGET}_SRC} ${marble_QRCS} )
target_link_libraries( ${TARGET} ${OpenCV_LIBRARIES} )
target_link_libraries( ${TARGET} ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES} ${Qt5Widget_LIBRARIES} )
target_link_libraries( ${TARGET} ${MARBLEWIDGET} marbledeclarative )
add_custom_command(TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different
......
......@@ -10,7 +10,6 @@ set( ${TARGET}_SRC main.cpp)
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} ${MARBLEWIDGET} )
target_link_libraries( ${TARGET} ${Qt5Core_LIBRARIES} )
install( TARGETS ${TARGET} RUNTIME DESTINATION ${MARBLE_EXAMPLES_INSTALL_DIR}/${TARGET} )
install( FILES ${${TARGET}_SRC} Readme.txt DESTINATION ${MARBLE_EXAMPLES_INSTALL_DIR}/${TARGET} )
......
......@@ -10,6 +10,5 @@ set( ${TARGET}_SRC main.cpp)
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} ${MARBLEWIDGET} )
target_link_libraries( ${TARGET} ${Qt5Core_LIBRARIES} )
install( TARGETS ${TARGET} RUNTIME DESTINATION bin )
......@@ -10,7 +10,6 @@ set( ${TARGET}_SRC main.cpp)
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} ${MARBLEWIDGET} )
target_link_libraries( ${TARGET} ${Qt5Core_LIBRARIES} )
install( TARGETS ${TARGET} RUNTIME DESTINATION ${MARBLE_EXAMPLES_INSTALL_DIR}/${TARGET} )
install( FILES ${${TARGET}_SRC} Readme.txt DESTINATION ${MARBLE_EXAMPLES_INSTALL_DIR}/${TARGET} )
......
......@@ -10,6 +10,5 @@ set( ${TARGET}_SRC main.cpp)
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} ${MARBLEWIDGET} )
target_link_libraries( ${TARGET} ${Qt5Core_LIBRARIES} )
install( TARGETS ${TARGET} RUNTIME DESTINATION bin )
......@@ -10,7 +10,6 @@ set( ${TARGET}_SRC main.cpp)
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} ${MARBLEWIDGET} )
target_link_libraries( ${TARGET} ${Qt5Core_LIBRARIES} )
install( TARGETS ${TARGET} RUNTIME DESTINATION ${MARBLE_EXAMPLES_INSTALL_DIR}/${TARGET} )
install( FILES ${${TARGET}_SRC} Readme.txt DESTINATION ${MARBLE_EXAMPLES_INSTALL_DIR}/${TARGET} )
......
......@@ -10,7 +10,6 @@ set( ${TARGET}_SRC squad-interpolation.cpp)
add_executable( ${TARGET} ${${TARGET}_SRC} )
target_link_libraries( ${TARGET} ${MARBLEWIDGET} )
target_link_libraries( ${TARGET} ${Qt5Core_LIBRARIES} )
install( TARGETS ${TARGET} RUNTIME DESTINATION ${MARBLE_EXAMPLES_INSTALL_DIR}/${TARGET} )
install( FILES ${${TARGET}_SRC} DESTINATION ${MARBLE_EXAMPLES_INSTALL_DIR}/${TARGET} )
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