From 950be29020f2e52e51bc725e8acd56a80a28d4ba Mon Sep 17 00:00:00 2001 From: Petter Strandmark Date: Sat, 5 May 2018 21:14:40 +0200 Subject: [PATCH] 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. --- CMake/AbseilHelpers.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMake/AbseilHelpers.cmake b/CMake/AbseilHelpers.cmake index 7b6f0879d..706a235a3 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)