load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test") cc_binary( name = "ensure_utf8", srcs = ["applications/ensure_utf8.cpp"], deps = ["//:cli11"], ) cc_binary( name = "ensure_utf8_twice", srcs = ["applications/ensure_utf8_twice.cpp"], deps = ["//:cli11"], ) cc_library( name = "catch_main", srcs = ["main.cpp"], hdrs = ["catch.hpp"], defines = ["CLI11_CATCH3"], deps = ["@catch2//:catch2_main"], ) cc_test( name = "AppTest", srcs = [ "AppTest.cpp", "app_helper.hpp", ], data = [ "ensure_utf8", "ensure_utf8_twice", ], local_defines = [ 'CLI11_ENSURE_UTF8_EXE=\\"$(rootpath ensure_utf8)\\"', 'CLI11_ENSURE_UTF8_TWICE_EXE=\\"$(rootpath ensure_utf8_twice)\\"', ], deps = [ "catch_main", "//:cli11", "@catch2", ], linkopts = select({ "@rules_cc//cc/compiler:msvc-cl": [], "@rules_cc//cc/compiler:clang-cl": [], "//conditions:default": ["-pthread"], }), ) cc_test( name = "TimerTest", srcs = ["TimerTest.cpp"], deps = [ "catch_main", "//:cli11", "@catch2", ], linkopts = select({ "@rules_cc//cc/compiler:msvc-cl": [], "@rules_cc//cc/compiler:clang-cl": [], "//conditions:default": ["-pthread"], }), ) # Verifies there are no unguarded inlines (duplicate symbols across TUs) [ ( cc_library( name = "link_test_1" + suffix, srcs = ["link_test_1.cpp"], deps = [lib], ), cc_test( name = "link_test_2" + suffix, srcs = ["link_test_2.cpp"], deps = [ "catch_main", "link_test_1" + suffix, lib, "@catch2", ], ), ) for suffix, lib in [ ("", "//:cli11"), ("_header_only", "//:cli11_header_only"), ] ] cc_test( name = "SimpleTestHeaderOnly", srcs = [ "SimpleTest.cpp", "app_helper.hpp", ], deps = [ "catch_main", "//:cli11_header_only", "@catch2", ], ) [ cc_test( name = test, srcs = [ test + ".cpp", "app_helper.hpp", ], deps = [ "catch_main", "//:cli11", "@catch2", ], ) for test in [ "HelpersTest", "ConfigFileTest", "OptionTypeTest", "SimpleTest", "SetTest", "NumericTypeTest", "TransformTest", "CreationTest", "SubcommandTest", "HelpTest", "FormatterTest", "NewParseTest", "OptionalTest", "DeprecatedTest", "StringParseTest", "ComplexTypeTest", "TrueFalseTest", "OptionGroupTest", "ExtraValidatorsTest", "localeTest", "EncodingTest", ] ]