Qt Creator plugin CMakeLists.txt is corrupted upon project creation
Moved
Unsolved
Qt Creator and other tools
-
I have created a library -> Qt creator plugin. After filling information in wizard my project was ready and this the log I found:
[cmake] Running /home/me/Qt/Tools/CMake/bin/cmake -S /data/Code/Qt/Notepad--/plugins/CppSyntaxHighlighterPlugin -B /data/Code/Qt/Notepad--/plugins/CppSyntaxHighlighterPlugin/build/Desktop-Debug -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang -DCMAKE_PREFIX_PATH:PATH=/usr -DCMAKE_GENERATOR:STRING=Ninja -DQT_QMAKE_EXECUTABLE:FILEPATH=/usr/bin/qmake6 -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/x86_64-pc-linux-gnu-g++ -DCMAKE_CXX_FLAGS_INIT:STRING=-DQT_QML_DEBUG -DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=/data/Code/Qt/Notepad--/plugins/CppSyntaxHighlighterPlugin/build/Desktop-Debug/.qtc/package-manager/auto-setup.cmake in /data/Code/Qt/Notepad--/plugins/CppSyntaxHighlighterPlugin/build/Desktop-Debug. [cmake] -- The C compiler identification is Clang 18.1.8 [cmake] -- The CXX compiler identification is GNU 14.2.1 [cmake] -- Detecting C compiler ABI info [cmake] -- Detecting C compiler ABI info - done [cmake] -- Check for working C compiler: /usr/bin/clang - skipped [cmake] -- Detecting C compile features [cmake] -- Detecting C compile features - done [cmake] -- Detecting CXX compiler ABI info [cmake] -- Detecting CXX compiler ABI info - done [cmake] -- Check for working CXX compiler: /usr/bin/x86_64-pc-linux-gnu-g++ - skipped [cmake] -- Detecting CXX compile features [cmake] -- Detecting CXX compile features - done [cmake] CMake Error at CMakeLists.txt:15 (find_package): [cmake] By not providing "FindQtCreator.cmake" in CMAKE_MODULE_PATH this project [cmake] has asked CMake to find a package configuration file provided by [cmake] "QtCreator", but CMake did not find one. [cmake] [cmake] Could not find a package configuration file provided by "QtCreator" with [cmake] any of the following names: [cmake] [cmake] QtCreatorConfig.cmake [cmake] qtcreator-config.cmake [cmake] [cmake] Add the installation prefix of "QtCreator" to CMAKE_PREFIX_PATH or set [cmake] "QtCreator_DIR" to a directory containing one of the above files. If [cmake] "QtCreator" provides a separate development package or SDK, be sure it has [cmake] been installed. [cmake] [cmake] [cmake] -- Configuring incomplete, errors occurred! [cmake] [cmake] The command "/home/me/Qt/Tools/CMake/bin/cmake -S /data/Code/Qt/Notepad--/plugins/CppSyntaxHighlighterPlugin -B /data/Code/Qt/Notepad--/plugins/CppSyntaxHighlighterPlugin/build/Desktop-Debug -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang -DCMAKE_PREFIX_PATH:PATH=/usr -DCMAKE_GENERATOR:STRING=Ninja -DQT_QMAKE_EXECUTABLE:FILEPATH=/usr/bin/qmake6 -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/x86_64-pc-linux-gnu-g++ -DCMAKE_CXX_FLAGS_INIT:STRING=-DQT_QML_DEBUG -DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=/data/Code/Qt/Notepad--/plugins/CppSyntaxHighlighterPlugin/build/Desktop-Debug/.qtc/package-manager/auto-setup.cmake" terminated with exit code 1. [cmake] [cmake] Elapsed time: 00:01.
This is CMakeLists.txt:
cmake_minimum_required(VERSION 3.16) # Remove when sharing with others. list(APPEND CMAKE_PREFIX_PATH "/data/Code/Qt/Notepad--/plugins/build") project(CppSyntaxHighlighterPlugin) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) find_package(QtCreator REQUIRED COMPONENTS Core) find_package(Qt6 COMPONENTS Widgets REQUIRED) # Add a CMake option that enables building your plugin with tests. # You don't want your released plugin binaries to contain tests, # so make that default to 'NO'. # Enable tests by passing -DWITH_TESTS=ON to CMake. option(WITH_TESTS "Builds with tests" NO) if(WITH_TESTS) # Look for QtTest find_package(Qt6 REQUIRED COMPONENTS Test) # Tell CMake functions like add_qtc_plugin about the QtTest component. set(IMPLICIT_DEPENDS Qt::Test) # Enable ctest for auto tests. enable_testing() endif() add_qtc_plugin(CppSyntaxHighlighterPlugin PLUGIN_DEPENDS QtCreator::Core DEPENDS Qt::Widgets QtCreator::ExtensionSystem QtCreator::Utils SOURCES .github/workflows/build_cmake.yml .github/workflows/README.md README.md cppsyntaxhighlighterplugin.cpp cppsyntaxhighlighterpluginconstants.h cppsyntaxhighlighterplugintr.h )
since I have Arch Linux I have installed qtcreator package. Any Idea?
-
-
You need to have the Qt Creator
-dev
package that has the fileQtCreatorConfig.cmake
.I am unsure if Arch Linux actually packages this.
If you install Qt Creator from https://download.qt.io/official_releases/qtcreator/ and select the "Development" package, you will be able to create Qt Creator plugins.
-
Arch does package
qtcreator-devel
. See https://archlinux.org/packages/extra/x86_64/qtcreator-devel/