Skip to content

Add variable CMAKE_FOLDER

Marc requested to merge Nagger/cmake:variable-CMAKE_FOLDER into master

Added CMAKE_FOLDER variable to initialize the FOLDER target property.

User could set the variable to organize all following targets into one VisualStudio folder:

 set(CMAKE_FOLDER Libraries)
 add_subdirectory(libA)
 add_subdirectory(libB)
 set(CMAKE_FOLDER Executables)
 add_subdirectory(progA)

Another possibility is using the current directory name for all following targets in subdirectories:

 get_filename_component(dirname "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
 string(APPEND CMAKE_FOLDER "/${dirname}")
 add_subdirectory(...)
Edited by Marc

Merge request reports