Skip to content

Commit

Permalink
[cmake] RP_FindQt[56]andKF[56].cmake: Use EXECUTE_PROCESS() instead o…
Browse files Browse the repository at this point in the history
…f EXEC_PROGRAM(); comment out KDEInstallDirs.cmake.

EXEC_PROGRAM() is deprecated as of CMake 3.0.

KDEInstallDirs.cmake isn't actually needed and prints warnings due to
some KDE-specific variables not being consistent.

Also remove the "-fpic -fPIC" CFLAGS/CXXFLAGS addition, since we're
handling this using the POSITION_INDEPENDENT_CODE property now.

Warnings from the KF5 version:

CMake Warning (dev) at cmake/libs/RP_FindQt5andKF5.cmake:65 (EXEC_PROGRAM):
  Policy CMP0153 is not set: The exec_program command should not be called.
  Run "cmake --help-policy CMP0153" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  Use execute_process() instead.
Call Stack (most recent call first):
  src/kde/kf5/CMakeLists.txt:6 (FIND_QT5_AND_KF5)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning at /usr/share/ECM/kde-modules/KDEInstallDirsCommon.cmake:385 (message):
  KDE_INSTALL_BINDIR, KDE_INSTALL_LIBDIR and KDE_INSTALL_INCLUDEDIR should
  either all be absolute paths or all be relative paths.
Call Stack (most recent call first):
  /usr/share/ECM/kde-modules/KDEInstallDirs5.cmake:230 (include)
  /usr/share/ECM/kde-modules/KDEInstallDirs.cmake:15 (include)
  cmake/libs/RP_FindQt5andKF5.cmake:26 (INCLUDE)
  src/kde/kf5/CMakeLists.txt:6 (FIND_QT5_AND_KF5)
  • Loading branch information
GerbilSoft committed Jan 7, 2025
1 parent 99d0b26 commit 29ce1c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
9 changes: 3 additions & 6 deletions cmake/libs/RP_FindQt5andKF5.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,9 @@ MACRO(FIND_QT5_AND_KF5)

# Include KF5 CMake modules.
LIST(APPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
INCLUDE(KDEInstallDirs)
#INCLUDE(KDEInstallDirs)
INCLUDE(KDECMakeSettings)

# Qt5 requires "-fpic -fPIC" due to reduced relocations.
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fpic -fPIC")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpic -fPIC")

# Find Qt5.
SET(Qt5_NO_LINK_QTMAIN 1)
FIND_PACKAGE(Qt5 ${REQUIRE_KF5} COMPONENTS Core Gui Widgets DBus)
Expand Down Expand Up @@ -62,7 +58,8 @@ MACRO(FIND_QT5_AND_KF5)

# Get the plugin directory and Qt prefix.
# Prefix will be removed from the plugin directory if necessary.
EXEC_PROGRAM(${QTPATHS5} ARGS --plugin-dir OUTPUT_VARIABLE KF5_PLUGIN_INSTALL_DIR)
EXECUTE_PROCESS(COMMAND ${QTPATHS5} --plugin-dir OUTPUT_VARIABLE KF5_PLUGIN_INSTALL_DIR)
STRING(STRIP "${KF5_PLUGIN_INSTALL_DIR}" KF5_PLUGIN_INSTALL_DIR)
IF(NOT KF5_PLUGIN_INSTALL_DIR)
MESSAGE(FATAL_ERROR "`qtpaths5` isn't working correctly.")
ENDIF(NOT KF5_PLUGIN_INSTALL_DIR)
Expand Down
9 changes: 3 additions & 6 deletions cmake/libs/RP_FindQt6andKF6.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,9 @@ MACRO(FIND_QT6_AND_KF6)

# Include KF6 CMake modules.
LIST(APPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
INCLUDE(KDEInstallDirs)
#INCLUDE(KDEInstallDirs6)
INCLUDE(KDECMakeSettings)

# Qt6 requires "-fpic -fPIC" due to reduced relocations.
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fpic -fPIC")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpic -fPIC")

# Find Qt6.
SET(Qt6_NO_LINK_QTMAIN 1)
FIND_PACKAGE(Qt6 ${REQUIRE_KF6} COMPONENTS Core Gui Widgets DBus)
Expand Down Expand Up @@ -63,7 +59,8 @@ MACRO(FIND_QT6_AND_KF6)

# Get the plugin directory and Qt prefix.
# Prefix will be removed from the plugin directory if necessary.
EXEC_PROGRAM(${QTPATHS6} ARGS --plugin-dir OUTPUT_VARIABLE KF6_PLUGIN_INSTALL_DIR)
EXECUTE_PROCESS(COMMAND ${QTPATHS6} --plugin-dir OUTPUT_VARIABLE KF6_PLUGIN_INSTALL_DIR)
STRING(STRIP "${KF6_PLUGIN_INSTALL_DIR}" KF6_PLUGIN_INSTALL_DIR)
IF(NOT KF6_PLUGIN_INSTALL_DIR)
MESSAGE(FATAL_ERROR "`qtpaths6` isn't working correctly.")
ENDIF(NOT KF6_PLUGIN_INSTALL_DIR)
Expand Down

0 comments on commit 29ce1c8

Please sign in to comment.