*.ui Files are not listed in the Projects Tab of QTCreator (Cmake Proj)
Solved
General and Desktop
-
hi there..
I created a CMake project and managed to get all my source files and headers inside subfolders. I want the same for the *.ui Files, too.
Means, my Proj Structure should look like this:<>root <>root/src *.cpp files <>root/include *.h files <>root/ui *.ui files <>root/cmake *.cmake modules
I created a MainWindow with the QT Designer. But the ui file is not listed in the Project Table, just the CmakeLists.txt, the Source- and Header files..
This is my CmakeLists.txt:
cmake_minimum_required(VERSION 3.5) project(HelloWorld LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(PROJ_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src ) set(PROJ_INC ${CMAKE_CURRENT_SOURCE_DIR}/include ) set(PROJ_UI ${CMAKE_CURRENT_SOURCE_DIR}/ui ) set(PROJ_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/libs ) list(APPEND CMAKE_AUTOUIC_SEARCH_PATHS ${PROJ_UI}) find_package(QT NAMES Qt5 COMPONENTS Widgets REQUIRED) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Gui REQUIRED) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS OpenGL REQUIRED) set(ANGLE_INCLUDE_PATH "D:/Angle/angle/include") set(ANGLE_LIBRARY_PATH "${PROJECT_SOURCE_DIR}/libs") INCLUDE(FindPkgConfig) find_package(Freetype REQUIRED) find_package(LuaJIT REQUIRED) find_package(PNG REQUIRED) if(NOT FREETYPE_FOUND) message(STATUS "freetype2: NO") else() message(STATUS "freetype2: YES.. Version:${FREETYPE_VERSION_STRING}") message(STATUS "ft2build.h Directory = ${FREETYPE_INCLUDE_DIR_ft2build}") endif() if(NOT LUAJIT_FOUND) message(STATUS "LuaJit: NO") else() message(STATUS "LuaJit: YES") message(STATUS "lua.h Directory = ${LUA_INCLUDE_DIR}") endif() if(NOT PNG_FOUND) message(STATUS "libPNG: NO") else() message(STATUS "libPNG: YES") message(STATUS "libPNG Includes Directory = ${PNG_INCLUDE_DIR}") endif() include_directories( ${PROJ_LIBS} ${PROJ_INC} ${PROJ_SRC} ${PROJ_UI} ${OPENGL_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIR_ft2build} ${LUA_INCLUDE_DIR} ${ANGLE_INCLUDE_PATH} ${ANGLE_LIBRARY_PATH} ${PNG_INCLUDE_DIR} ) link_directories ( ${PROJ_LIBS} ${PROJ_INC} ${PROJ_SRC} ${PROJ_UI} ${OPENGL_LIBRARY_DIRS} ${FREETYPE_INCLUDE_DIR_ft2build} ${LUA_INCLUDE_DIR} ${ANGLE_INCLUDE_PATH} ${ANGLE_LIBRARY_PATH} ${PNG_INCLUDE_DIR} ) find_library(GLES2_Lib NAMES d3dcompiler_47 REQUIRED) find_library(D3D_Lib NAMES libGLESv2 REQUIRED) #find_library(EGL_Lib NAMES libEGL EGL libegl REQUIRED) file(GLOB PROJECT_SOURCES CONFIGURE_DEPENDS ${PROJ_SRC}/*.cpp ) file(GLOB PROJECT_HEADERS CONFIGURE_DEPENDS ${PROJ_INC}/*.h ) if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) qt_add_executable(${PROJECT_NAME} ${PROJECT_SOURCES} ${PROJECT_HEADERS} ) else() if(ANDROID) add_library(${PROJECT_NAME} SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS} ) else() add_executable(${PROJECT_NAME} ${PROJECT_SOURCES} ${PROJECT_HEADERS} ) endif() endif() target_link_libraries(${PROJECT_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Core PRIVATE Qt${QT_VERSION_MAJOR}::Widgets PRIVATE Qt${QT_VERSION_MAJOR}::Gui PRIVATE Qt${QT_VERSION_MAJOR}::OpenGL ${OPENGL_gl_LIBRARY} ${FREETYPE_LIBRARIES} ${LUA_LIBRARY} ${GLES2_Lib} ${D3D_Lib} #${EGL_Lib} ${PNG_LIBRARY} )
Any idea how i can bring back UI Files to my Project List View?
(Platform: Windows10 64Bit)