From 2104810f45d89b65ba91b79664855b365959909a Mon Sep 17 00:00:00 2001
From: Tim O'Shea <tim.oshea753@gmail.com>
Date: Wed, 9 Oct 2013 20:11:49 -0400
Subject: gr_modtool: install a howtoConfig.cmake when creating new out of tree
 modules, this will allow other cmake modules to be able to easily find and
 link against it in a clean way

---
 gr-utils/python/modtool/gr-newmod/CMakeLists.txt   |  7 +++++
 .../gr-newmod/cmake/Modules/howtoConfig.cmake      | 30 ++++++++++++++++++++++
 gr-utils/python/modtool/modtool_add.py             |  1 +
 gr-utils/python/modtool/modtool_base.py            |  1 +
 4 files changed, 39 insertions(+)
 create mode 100644 gr-utils/python/modtool/gr-newmod/cmake/Modules/howtoConfig.cmake

(limited to 'gr-utils/python')

diff --git a/gr-utils/python/modtool/gr-newmod/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/CMakeLists.txt
index 7ff80ff7ac..2dac3461a8 100644
--- a/gr-utils/python/modtool/gr-newmod/CMakeLists.txt
+++ b/gr-utils/python/modtool/gr-newmod/CMakeLists.txt
@@ -146,3 +146,10 @@ add_subdirectory(python)
 add_subdirectory(grc)
 add_subdirectory(apps)
 add_subdirectory(docs)
+
+########################################################################
+# Install cmake search helper for this library
+########################################################################
+install(FILES cmake/Modules/howtoConfig.cmake        
+    DESTINATION lib/cmake/howto
+)
diff --git a/gr-utils/python/modtool/gr-newmod/cmake/Modules/howtoConfig.cmake b/gr-utils/python/modtool/gr-newmod/cmake/Modules/howtoConfig.cmake
new file mode 100644
index 0000000000..329a007608
--- /dev/null
+++ b/gr-utils/python/modtool/gr-newmod/cmake/Modules/howtoConfig.cmake
@@ -0,0 +1,30 @@
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PC_HOWTO howto)
+
+FIND_PATH(
+    HOWTO_INCLUDE_DIRS
+    NAMES howto/api.h
+    HINTS $ENV{HOWTO_DIR}/include
+        ${PC_HOWTO_INCLUDEDIR}
+    PATHS ${CMAKE_INSTALL_PREEFIX}/include
+          /usr/local/include
+          /usr/include
+)
+
+FIND_LIBRARY(
+    HOWTO_LIBRARIES
+    NAMES gnuradio-howto
+    HINTS $ENV{HOWTO_DIR}/lib
+        ${PC_HOWTO_LIBDIR}
+    PATHS ${CMAKE_INSTALL_PREFIX}/lib
+          ${CMAKE_INSTALL_PREFIX}/lib64
+          /usr/local/lib
+          /usr/local/lib64
+          /usr/lib
+          /usr/lib64
+)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(HOWTO DEFAULT_MSG HOWTO_LIBRARIES HOWTO_INCLUDE_DIRS)
+MARK_AS_ADVANCED(HOWTO_LIBRARIES HOWTO_INCLUDE_DIRS)
+
diff --git a/gr-utils/python/modtool/modtool_add.py b/gr-utils/python/modtool/modtool_add.py
index 81103e460d..6aae43b153 100644
--- a/gr-utils/python/modtool/modtool_add.py
+++ b/gr-utils/python/modtool/modtool_add.py
@@ -193,6 +193,7 @@ class ModToolAdd(ModTool):
                             Cheetah.Template.Template(
                                 Templates['qa_cmakeentry36'],
                                 searchList={'basename': os.path.splitext(fname_qa_cc)[0],
+                                            'upperbasename': os.path.splitext(fname_qa_cc)[0].upper(),
                                             'filename': fname_qa_cc,
                                             'modname': self._info['modname']
                                            }
diff --git a/gr-utils/python/modtool/modtool_base.py b/gr-utils/python/modtool/modtool_base.py
index 081c10aaf9..92649a8589 100644
--- a/gr-utils/python/modtool/modtool_base.py
+++ b/gr-utils/python/modtool/modtool_base.py
@@ -117,6 +117,7 @@ class ModTool(object):
             self._info['includedir'] = 'include'
         self._file['cminclude'] = os.path.join(self._info['includedir'], 'CMakeLists.txt')
         self._file['cmswig'] = os.path.join('swig', 'CMakeLists.txt')
+        self._file['cmfind'] = os.path.join('cmake', 'Modules', 'howtoConfig.cmake')
 
     def _check_directory(self, directory):
         """ Guesses if dir is a valid GNU Radio module directory by looking for
-- 
cgit v1.2.3