about summary refs log tree commit diff
path: root/absl
diff options
context:
space:
mode:
authorLoo Rong Jie <loorongjie@gmail.com>2018-06-29T00·45+0800
committerLoo Rong Jie <loorongjie@gmail.com>2018-10-09T15·33+0800
commitac533e18db2c8952255f89449ee278d876d20785 (patch)
tree904cc2676e841e1bdd45248215d5ed5c7c74a43a /absl
parent48cd2c3f351ff188bc85684b84a91b6e6d17d896 (diff)
[CMake] Implement absl_cc_library as Bazel's cc_library
cc_library
Diffstat (limited to 'absl')
-rw-r--r--absl/base/CMakeLists.txt31
-rw-r--r--absl/strings/CMakeLists.txt136
2 files changed, 72 insertions, 95 deletions
diff --git a/absl/base/CMakeLists.txt b/absl/base/CMakeLists.txt
index 04a6eb31955b..a73ea359d7b2 100644
--- a/absl/base/CMakeLists.txt
+++ b/absl/base/CMakeLists.txt
@@ -99,33 +99,26 @@ absl_library(
     throw_delegate
 )
 
-if(BUILD_TESTING)
-  # exception-safety testing library
-  set(EXCEPTION_SAFETY_TESTING_SRC
+
+# exception-safety testing library
+absl_cc_library(
+  NAME
+    exception_safety_testing
+  HDRS
     "internal/exception_safety_testing.h"
+  SRCS
     "internal/exception_safety_testing.cc"
-  )
-  set(EXCEPTION_SAFETY_TESTING_PUBLIC_LIBRARIES
-    ${ABSL_TEST_COMMON_LIBRARIES}
+  COPTS
+    ${ABSL_EXCEPTIONS_FLAG}
+  DEPS
     absl::base
     absl::memory
     absl::meta
     absl::strings
     absl::optional
     gtest
-  )
-
-absl_library(
-  TARGET
-    absl_base_internal_exception_safety_testing
-  SOURCES
-    ${EXCEPTION_SAFETY_TESTING_SRC}
-  PUBLIC_LIBRARIES
-    ${EXCEPTION_SAFETY_TESTING_PUBLIC_LIBRARIES}
-  PRIVATE_COMPILE_FLAGS
-    ${ABSL_EXCEPTIONS_FLAG}
+  TESTONLY
 )
-endif()
 
 
 # dynamic_annotations library
@@ -368,7 +361,7 @@ absl_test(
 set(EXCEPTION_SAFETY_TESTING_TEST_SRC "exception_safety_testing_test.cc")
 set(EXCEPTION_SAFETY_TESTING_TEST_PUBLIC_LIBRARIES
   absl::base
-  absl_base_internal_exception_safety_testing
+  absl_exception_safety_testing
   absl::memory
   absl::meta
   absl::strings
diff --git a/absl/strings/CMakeLists.txt b/absl/strings/CMakeLists.txt
index f3e4162387f1..9fb96c7be5b5 100644
--- a/absl/strings/CMakeLists.txt
+++ b/absl/strings/CMakeLists.txt
@@ -14,87 +14,71 @@
 # limitations under the License.
 #
 
-
-list(APPEND STRINGS_PUBLIC_HEADERS
-  "ascii.h"
-  "charconv.h"
-  "escaping.h"
-  "match.h"
-  "numbers.h"
-  "str_cat.h"
-  "string_view.h"
-  "strip.h"
-  "str_join.h"
-  "str_replace.h"
-  "str_split.h"
-  "substitute.h"
-)
-
-
-list(APPEND STRINGS_INTERNAL_HEADERS
-  "internal/char_map.h"
-  "internal/charconv_bigint.h"
-  "internal/charconv_parse.h"
-  "internal/memutil.h"
-  "internal/ostringstream.h"
-  "internal/resize_uninitialized.h"
-  "internal/stl_type_traits.h"
-  "internal/str_join_internal.h"
-  "internal/str_split_internal.h"
-  "internal/utf8.h"
-)
-
-
-
-# add string library
-list(APPEND STRINGS_SRC
-  "ascii.cc"
-  "charconv.cc"
-  "escaping.cc"
-  "internal/charconv_bigint.cc"
-  "internal/charconv_parse.cc"
-  "internal/memutil.cc"
-  "internal/memutil.h"
-  "internal/utf8.cc"
-  "internal/ostringstream.cc"
-  "match.cc"
-  "numbers.cc"
-  "str_cat.cc"
-  "str_replace.cc"
-  "str_split.cc"
-  "string_view.cc"
-  "substitute.cc"
-  ${STRINGS_PUBLIC_HEADERS}
-  ${STRINGS_INTERNAL_HEADERS}
-)
-set(STRINGS_PUBLIC_LIBRARIES absl::base absl_throw_delegate)
-
-absl_library(
-  TARGET
-    absl_strings
-  SOURCES
-    ${STRINGS_SRC}
-  PUBLIC_LIBRARIES
-    ${STRINGS_PUBLIC_LIBRARIES}
-  EXPORT_NAME
+absl_cc_library(
+  NAME
     strings
+  HDRS
+    "ascii.h"
+    "charconv.h"
+    "escaping.h"
+    "match.h"
+    "numbers.h"
+    "str_cat.h"
+    "string_view.h"
+    "strip.h"
+    "str_join.h"
+    "str_replace.h"
+    "str_split.h"
+    "substitute.h"
+  SRCS
+    "ascii.cc"
+    "charconv.cc"
+    "escaping.cc"
+    "internal/bits.h"
+    "internal/char_map.h"
+    "internal/charconv_bigint.cc"
+    "internal/charconv_bigint.h"
+    "internal/charconv_parse.cc"
+    "internal/charconv_parse.h"
+    "internal/memutil.cc"
+    "internal/memutil.h"
+    "internal/ostringstream.cc"
+    "internal/ostringstream.h"
+    "internal/resize_uninitialized.h"
+    "internal/stl_type_traits.h"
+    "internal/str_join_internal.h"
+    "internal/str_split_internal.h"
+    "internal/utf8.cc"
+    "internal/utf8.h"
+    "match.cc"
+    "numbers.cc"
+    "str_cat.cc"
+    "str_replace.cc"
+    "str_split.cc"
+    "string_view.cc"
+    "substitute.cc"
+  DEPS
+    absl::base
+    absl_throw_delegate
+  VISIBILITY_PUBLIC
 )
 
 # add str_format library
-absl_header_library(
-  TARGET
-    absl_str_format
-  PUBLIC_LIBRARIES
-    str_format_internal
-  EXPORT_NAME
+absl_cc_library(
+  NAME
     str_format
+  HDRS
+    "str_format.h"
+  DEPS
+    absl_str_format_internal
+  VISIBILITY_PUBLIC
 )
 
 # str_format_internal
-absl_library(
-  TARGET
+absl_cc_library(
+  NAME
     str_format_internal
-  SOURCES
+  SRCS
     "internal/str_format/arg.cc"
     "internal/str_format/bind.cc"
     "internal/str_format/extension.cc"
@@ -108,7 +92,7 @@ absl_library(
     "internal/str_format/float_conversion.h"
     "internal/str_format/output.h"
     "internal/str_format/parser.h"
-  PUBLIC_LIBRARIES
+  DEPS
     str_format_extension_internal
     absl::strings
     absl::base
@@ -415,7 +399,7 @@ absl_test(
   SOURCES
     "internal/str_format/bind_test.cc"
   PUBLIC_LIBRARIES
-    str_format_internal
+    absl_str_format_internal
 )
 
 # test str_format_checker_test
@@ -435,7 +419,7 @@ absl_test(
   SOURCES
     "internal/str_format/convert_test.cc"
   PUBLIC_LIBRARIES
-    str_format_internal
+    absl_str_format_internal
     absl::numeric
 )
 
@@ -456,7 +440,7 @@ absl_test(
   SOURCES
     "internal/str_format/parser_test.cc"
   PUBLIC_LIBRARIES
-    str_format_internal
+    absl_str_format_internal
     absl::base
 )