Unknown CMake command "kde4_add_ui_files"

If you get this error

Unknown CMake command "kde4_add_ui_files"

while trying to use cmake, it usually means that

find_package(KDE4 REQUIRED)

is missing from the CMakeLists.txt file. Try adding it to the CMakeLists.txt file somewhere before kde4_add_ui_files is first called.

An example
project(plasma-network)

set(network_SRCS
network.cpp)

kde4_add_ui_files(network_SRCS config.ui )


becomes:
project(plasma-network)

set(network_SRCS
network.cpp)

find_package(KDE4 REQUIRED)

kde4_add_ui_files(network_SRCS config.ui )


See here for more information: http://www.vtk.org/Wiki/CMake:How_To_Build_KDE4_Software#Where_to_find_more_information .g

By the way, the same line helps for problems with "macro_optional_find_package" and most other KDE compilation problems.

2 comments:

  1. Great! It solved my error:

    CMake Error at CMakeLists.txt:11 (macro_optional_find_package):
    Unknown CMake command "macro_optional_find_package".

    Thanks.

    ReplyDelete

I appreciate comments. Feel free to write anything you wish. Selected comments and questions will be published.