Group the target sources for the VS solution explorer

This commit is contained in:
Corentin Wallez 2017-07-10 22:39:04 -04:00 committed by Corentin Wallez
parent 0f833f30ed
commit 3df6441a8c
1 changed files with 16 additions and 0 deletions

View File

@ -77,8 +77,24 @@ function(NXTInternalTarget folder target)
NXTExternalTarget("${folder}" ${target}) NXTExternalTarget("${folder}" ${target})
set_property(TARGET ${target} APPEND PROPERTY COMPILE_OPTIONS ${NXT_INTERNAL_FLAGS}) set_property(TARGET ${target} APPEND PROPERTY COMPILE_OPTIONS ${NXT_INTERNAL_FLAGS})
set_property(TARGET ${target} APPEND PROPERTY COMPILE_DEFINITIONS ${NXT_INTERNAL_DEFS}) set_property(TARGET ${target} APPEND PROPERTY COMPILE_DEFINITIONS ${NXT_INTERNAL_DEFS})
# Group the target sources by folder to have folders show in Visual Studio
if (MSVC)
get_target_property(targetSources ${target} SOURCES)
foreach(sourceFile IN ITEMS ${targetSources})
if (IS_ABSOLUTE "${sourceFile}")
file(RELATIVE_PATH sourceFile "${CMAKE_CURRENT_SOURCE_DIR}" "${sourceFile}")
endif()
get_filename_component(sourceDir "${sourceFile}" PATH)
string(REPLACE "/" "\\" sourceDir "${sourceDir}")
source_group("${sourceDir}" FILES "${sourceFile}")
endforeach()
endif()
endfunction() endfunction()
# Enable the creation of folders for Visual Studio projects
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
################################################################################ ################################################################################
# Generate the C and C++ NXT APIs # Generate the C and C++ NXT APIs
################################################################################ ################################################################################