about summary refs log tree commit diff
path: root/CMake
diff options
context:
space:
mode:
authorjohnforestolson <jolson@google.com>2018-05-09T20·58-0400
committerGitHub <noreply@github.com>2018-05-09T20·58-0400
commita193b3d3b7c3fe2785bff32125a5e1633d3bc0e2 (patch)
treeaae64665689fff6ff088e8deb3c22c2e5d000f1c /CMake
parentf88b4e9cd876905ee694cee1720095330e0bd20f (diff)
parente0bb9b567924371be33fb162e56ece922530fbe6 (diff)
Merge pull request #117 from PetterS/add_ide_folder
Set the FOLDER property for Abseil targets.
Diffstat (limited to 'CMake')
-rw-r--r--CMake/AbseilHelpers.cmake11
1 files changed, 11 insertions, 0 deletions
diff --git a/CMake/AbseilHelpers.cmake b/CMake/AbseilHelpers.cmake
index 7b6f0879d647..c2a653c85f02 100644
--- a/CMake/AbseilHelpers.cmake
+++ b/CMake/AbseilHelpers.cmake
@@ -16,6 +16,11 @@
 
 include(CMakeParseArguments)
 
+# The IDE folder for Abseil that will be used if Abseil is included in a CMake
+# project that sets
+#    set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+# For example, Visual Studio supports folders.
+set(ABSL_IDE_FOLDER Abseil)
 
 #
 # create a library in the absl namespace
@@ -49,6 +54,8 @@ function(absl_library)
     PUBLIC ${ABSL_COMMON_INCLUDE_DIRS} ${ABSL_LIB_PUBLIC_INCLUDE_DIRS}
     PRIVATE ${ABSL_LIB_PRIVATE_INCLUDE_DIRS}
   )
+  # Add all Abseil targets to a a folder in the IDE for organization.
+  set_property(TARGET ${_NAME} PROPERTY FOLDER ${ABSL_IDE_FOLDER})
 
   if(ABSL_LIB_EXPORT_NAME)
     add_library(absl::${ABSL_LIB_EXPORT_NAME} ALIAS ${_NAME})
@@ -92,6 +99,8 @@ function(absl_header_library)
     PUBLIC ${ABSL_COMMON_INCLUDE_DIRS} ${ABSL_HO_LIB_PUBLIC_INCLUDE_DIRS}
     PRIVATE ${ABSL_HO_LIB_PRIVATE_INCLUDE_DIRS}
   )
+  # Add all Abseil targets to a a folder in the IDE for organization.
+  set_property(TARGET ${_NAME} PROPERTY FOLDER ${ABSL_IDE_FOLDER})
 
   if(ABSL_HO_LIB_EXPORT_NAME)
     add_library(absl::${ABSL_HO_LIB_EXPORT_NAME} ALIAS ${_NAME})
@@ -138,6 +147,8 @@ function(absl_test)
       PUBLIC ${ABSL_COMMON_INCLUDE_DIRS} ${ABSL_TEST_PUBLIC_INCLUDE_DIRS}
       PRIVATE ${GMOCK_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
     )
+    # Add all Abseil targets to a a folder in the IDE for organization.
+    set_property(TARGET ${_NAME}_bin PROPERTY FOLDER ${ABSL_IDE_FOLDER})
 
     add_test(${_NAME} ${_NAME}_bin)
   endif(BUILD_TESTING)