Show a nice folder structure in Visual Studio (#2890)

This commit is contained in:
Duncan Ogilvie 2022-10-23 13:40:26 +02:00 committed by GitHub
parent 8ad700a6dc
commit 0624cd1d19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -43,6 +43,12 @@ set(CUTTER_VERSION_FULL "${CUTTER_VERSION_MAJOR}.${CUTTER_VERSION_MINOR}.${CUTTE
project(Cutter VERSION "${CUTTER_VERSION_FULL}")
# Enable solution folder support
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Put Qt files in a separate folder
set_property(GLOBAL PROPERTY AUTOGEN_SOURCE_GROUP "Generated Files")
set(CMAKE_CXX_STANDARD 11)
include(CutterInstallDirs)

View File

@ -442,8 +442,11 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
set_source_files_properties(${BINDINGS_SOURCE} PROPERTIES COMPILE_FLAGS -w)
endif()
# Make a source group for Visual Studio
set(CUTTER_SOURCES ${OPTIONS} ${UI_FILES} ${QRC_FILES} ${PLATFORM_RESOURCES} ${SOURCES} ${HEADER_FILES})
source_group(TREE "${CMAKE_CURRENT_LIST_DIR}" FILES ${CUTTER_SOURCES})
add_executable(Cutter ${OPTIONS} ${UI_FILES} ${QRC_FILES} ${PLATFORM_RESOURCES} ${SOURCES} ${HEADER_FILES} ${BINDINGS_SOURCE})
add_executable(Cutter ${CUTTER_SOURCES} ${BINDINGS_SOURCE})
set_target_properties(Cutter PROPERTIES
OUTPUT_NAME cutter
RUNTIME_OUTPUT_DIRECTORY ..
@ -452,6 +455,9 @@ set_target_properties(Cutter PROPERTIES
CXX_VISIBILITY_PRESET hidden)
target_compile_definitions(Cutter PRIVATE CUTTER_SOURCE_BUILD)
# Set Cutter as the startup project in Visual Studio
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT Cutter)
set(CUTTER_INCLUDE_DIRECTORIES core widgets common plugins menus .)
foreach(_dir ${CUTTER_INCLUDE_DIRECTORIES})
target_include_directories(Cutter PUBLIC