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.
This commit is contained in:
Petter Strandmark 2018-05-05 21:14:40 +02:00
parent 26b789f9a5
commit 950be29020

View file

@ -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)