about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPetter Strandmark <petter.strandmark@gmail.com>2018-05-05T19·14+0200
committerPetter Strandmark <petter.strandmark@gmail.com>2018-05-05T19·14+0200
commit950be29020f2e52e51bc725e8acd56a80a28d4ba (patch)
tree4e07f2f7f7390f705bf702942c455d79a721bfd3
parent26b789f9a53d086c8b8c9c2668efb251e37861cd (diff)
Set the FOLDER property for Abseil targets.
https://cmake.org/cmake/help/v3.0/prop_tgt/FOLDER.html
This only affects IDEs and will further only take effect if
  set_property(GLOBAL PROPERTY USE_FOLDERS ON)
is set in the main CMakeLists.txt of the project.

I found using this quite helpful when adding Abseil to larger CMake
projects.
-rw-r--r--CMake/AbseilHelpers.cmake6
1 files changed, 6 insertions, 0 deletions
diff --git a/CMake/AbseilHelpers.cmake b/CMake/AbseilHelpers.cmake
index 7b6f0879d647..706a235a3ea3 100644
--- a/CMake/AbseilHelpers.cmake
+++ b/CMake/AbseilHelpers.cmake
@@ -49,6 +49,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 Abseil)
 
   if(ABSL_LIB_EXPORT_NAME)
     add_library(absl::${ABSL_LIB_EXPORT_NAME} ALIAS ${_NAME})
@@ -92,6 +94,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 Abseil)
 
   if(ABSL_HO_LIB_EXPORT_NAME)
     add_library(absl::${ABSL_HO_LIB_EXPORT_NAME} ALIAS ${_NAME})
@@ -138,6 +142,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 Abseil)
 
     add_test(${_NAME} ${_NAME}_bin)
   endif(BUILD_TESTING)