Support CONFIG_ANALYZER in the cmake build.

- Use the FindwxWidgets (the cmake module) to detect library
  flags and handle include paths.
- Update target to link in the libs located by FindwxWidgets.
- Enable CONFIG_INSPECTION and warn at generation time when it's
  not present and CONFIG_ANALYZER is enabled.

BUG=https://bugs.chromium.org/p/aomedia/issues/detail?id=76

Change-Id: Ica949107d199af9d8241ca639cc27753d4a30dfc
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c8d3584..2addd9a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -205,13 +205,12 @@
                $<TARGET_OBJECTS:aom_encoder_stats>)
 
 if (CONFIG_ANALYZER)
-add_executable(analyzer
-               "${AOM_ROOT}/examples/analyzer.cc"
-               $<TARGET_OBJECTS:aom_common_app_util>
-               $<TARGET_OBJECTS:aom_decoder_app_util>)
-set(AOM_APP_TARGETS ${AOM_APP_TARGETS} analyzer)
-append_cxx_flag("$ENV{WX_CXXFLAGS}")
-append_exe_linker_flag("$ENV{WX_LDFLAGS}")
+  add_executable(analyzer
+                 "${AOM_ROOT}/examples/analyzer.cc"
+                 $<TARGET_OBJECTS:aom_common_app_util>
+                 $<TARGET_OBJECTS:aom_decoder_app_util>)
+  target_link_libraries(analyzer PUBLIC ${wxWidgets_LIBRARIES})
+  set(AOM_APP_TARGETS ${AOM_APP_TARGETS} analyzer)
 endif ()
 
 add_executable(decode_to_md5
diff --git a/build/cmake/aom_configure.cmake b/build/cmake/aom_configure.cmake
index 6feb37d..34e0142 100644
--- a/build/cmake/aom_configure.cmake
+++ b/build/cmake/aom_configure.cmake
@@ -11,6 +11,7 @@
 include(FindGit)
 include(FindPerl)
 include(FindThreads)
+include(FindwxWidgets)
 
 # Generate the user config settings. This must occur before include of
 # aom_config_defaults.cmake (because it turns every config variable into a cache
@@ -141,6 +142,17 @@
 aom_check_source_compiles("pthread_check" "#include <pthread.h>" HAVE_PTHREAD_H)
 aom_check_source_compiles("unistd_check" "#include <unistd.h>" HAVE_UNISTD_H)
 
+if (CONFIG_ANALYZER)
+  find_package(wxWidgets REQUIRED adv base core)
+  include(${wxWidgets_USE_FILE})
+
+  if (NOT CONFIG_INSPECTION)
+    set(CONFIG_INSPECTION 1)
+    message(WARNING
+            "--- Enabled CONFIG_INSPECTION, required for CONFIG_ANALYZER.")
+  endif ()
+endif ()
+
 if (CONFIG_ANS AND CONFIG_DAALA_EC)
   message(FATAL_ERROR
           "CONFIG_ANS and CONFIG_DAALA_EC cannot be enabled together.")