Move guard for pw_cpu_exception_armv7m tests

Moves the check for whether or not to build/run the
pw_cpu_exception_armv7m tests so they're inside that module's build
file.

Change-Id: I6814ab7c2a64add5250f325cafcc0de3c27b64b4
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/23082
Reviewed-by: Alexei Frolov <frolv@google.com>
Commit-Queue: Armando Montanez <amontanez@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index c72a386..e229a28 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -266,6 +266,7 @@
       "$dir_pw_bytes:tests",
       "$dir_pw_checksum:tests",
       "$dir_pw_containers:tests",
+      "$dir_pw_cpu_exception_armv7m:tests",
       "$dir_pw_fuzzer:tests",
       "$dir_pw_hdlc_lite:tests",
       "$dir_pw_hex_dump:tests",
@@ -294,13 +295,6 @@
       "$dir_pw_varint:tests",
     ]
 
-    import("$dir_pw_cpu_exception/backend.gni")
-
-    # TODO(pwbug/17): Re-think when Pigweed config system is added.
-    if (pw_cpu_exception_ENTRY_BACKEND == dir_pw_cpu_exception_armv7m) {
-      group_deps += [ "$dir_pw_cpu_exception_armv7m:tests" ]
-    }
-
     if (defined(pw_toolchain_SCOPE.is_host_toolchain) &&
         pw_toolchain_SCOPE.is_host_toolchain) {
       # TODO(pwbug/196): KVS tests are not compatible with device builds as they
diff --git a/pw_cpu_exception_armv7m/BUILD.gn b/pw_cpu_exception_armv7m/BUILD.gn
index 7cd545f..61395e2 100644
--- a/pw_cpu_exception_armv7m/BUILD.gn
+++ b/pw_cpu_exception_armv7m/BUILD.gn
@@ -15,6 +15,7 @@
 import("//build_overrides/pigweed.gni")
 
 import("$dir_pw_build/target_types.gni")
+import("$dir_pw_cpu_exception/backend.gni")
 import("$dir_pw_docgen/docs.gni")
 import("$dir_pw_protobuf_compiler/proto.gni")
 import("$dir_pw_unit_test/test.gni")
@@ -64,6 +65,7 @@
 }
 
 pw_test_group("tests") {
+  enable_if = pw_cpu_exception_ENTRY_BACKEND == dir_pw_cpu_exception_armv7m
   tests = [ ":cpu_exception_entry_test" ]
 }