QCustomPlot Discussion and Comments

qcustomplot.h not found in ui_plotwindow.hReturn to overview

Hi,
I have a project that uses qcustomplot.
I earlier QT versions I didn't had a problem. No I upgraded to Qt 6.10.1.

Now I get the following error:
/home/johannes/Projects/SunCorrection/build/Desktop-Debug/SunCorrection_autogen/include/ui_plotwindow.h:22: error: qcustomplot.h: No such file or directory
In file included from /home/johannes/Projects/SunCorrection/plotwindow.h:4,
from /home/johannes/Projects/SunCorrection/plotwindow.cpp:3:
/home/johannes/Projects/SunCorrection/build/Desktop-Debug/SunCorrection_autogen/include/ui_plotwindow.h:22:10: fatal error: qcustomplot.h: No such file or directory
22 | #include "qcustomplot.h"
| ^~~~~~~~~~~~~~~

The cmake file looks like is listet below. As you can see qcustomplot.h in included.
It also can be found in other source files.

----- cmake file-----
cmake_minimum_required(VERSION 3.16)

project(SunCorrection VERSION 0.1 LANGUAGES CXX C)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(QT NAMES Qt6 REQUIRED COMPONENTS Widgets LinguistTools PrintSupport)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets LinguistTools PrintSupport)

set(TS_FILES SunCorrection_en_150.ts)

set(PROJECT_SOURCES
main.cpp
mainwindow.cpp
mainwindow.h
mainwindow.ui
${TS_FILES}
)

if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(SunCorrection
MANUAL_FINALIZATION
${PROJECT_SOURCES}
version.h version.cpp
timeazel.h timeazel.cpp
smootheddatapoint.h smootheddatapoint.cpp
qcustomplot.cpp qcustomplot.h
plotwindow.h plotwindow.cpp plotwindow.ui
sunposition.h sunposition.cpp
spa.c spa.h
dlgreadgt.h dlgreadgt.cpp dlgreadgt.ui
correctedangles.h correctedangles.cpp
polarcarthesian.h polarcarthesian.cpp
rotation.h rotation.cpp
datamodel.h datamodel.cpp
dlgmethod.h dlgmethod.cpp dlgmethod.ui
rotatesuntest.h rotatesuntest.cpp rotatesuntest.ui

)
# Define target properties for Android with Qt 6 as:
# set_property(TARGET SunCorrection APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation

qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
endif()

target_link_libraries(SunCorrection PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::PrintSupport)

# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
# If you are developing for iOS or macOS you should consider setting an
# explicit, fixed bundle identifier manually though.
if(${QT_VERSION} VERSION_LESS 6.1.0)
set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.SunCorrection)
endif()
set_target_properties(SunCorrection PROPERTIES
${BUNDLE_ID_OPTION}
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)

include(GNUInstallDirs)
install(TARGETS SunCorrection
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(SunCorrection)
endif()

Gemini told me:
Add this line to your CMakeLists.txt inside your if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) block:

target_include_directories(SunCorrection PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})

Although i couldn't place it inside the block, but after....