Add CMAKE_FOLDER variable to initialize FOLDER target property

This can be used for example to organize all following targets into one
Visual Studio 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}")
This commit is contained in:
Marc B
2018-03-28 00:53:18 +02:00
committed by Brad King
parent 6792c7787a
commit df535ad846
5 changed files with 17 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
CMAKE_FOLDER
------------
Set the folder name. Use to organize targets in an IDE.
This variable is used to initialize the :prop_tgt:`FOLDER` property on all the
targets. See that target property for additional information.