summaryrefslogtreecommitdiff
path: root/cmake/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/Modules')
-rw-r--r--cmake/Modules/CMakeParseArgumentsCopy.cmake138
-rw-r--r--cmake/Modules/FindALSA.cmake36
-rw-r--r--cmake/Modules/FindCppUnit.cmake34
-rw-r--r--cmake/Modules/FindFFTW3f.cmake32
-rw-r--r--cmake/Modules/FindGSL.cmake143
-rw-r--r--cmake/Modules/FindGit.cmake46
-rw-r--r--cmake/Modules/FindJack.cmake87
-rw-r--r--cmake/Modules/FindOSS.cmake46
-rw-r--r--cmake/Modules/FindPortaudio.cmake107
-rw-r--r--cmake/Modules/FindQwt.cmake13
-rw-r--r--cmake/Modules/FindUHD.cmake24
-rw-r--r--cmake/Modules/GrBoost.cmake62
-rw-r--r--cmake/Modules/GrComponent.cmake82
-rw-r--r--cmake/Modules/GrMiscUtils.cmake86
-rw-r--r--cmake/Modules/GrPackage.cmake134
-rw-r--r--cmake/Modules/GrPlatform.cmake46
-rw-r--r--cmake/Modules/GrPython.cmake177
-rw-r--r--cmake/Modules/GrSwig.cmake90
-rw-r--r--cmake/Modules/GrTest.cmake133
-rw-r--r--cmake/Modules/GrVersion.cmake73
-rw-r--r--cmake/Modules/LibFindMacros.cmake99
21 files changed, 1688 insertions, 0 deletions
diff --git a/cmake/Modules/CMakeParseArgumentsCopy.cmake b/cmake/Modules/CMakeParseArgumentsCopy.cmake
new file mode 100644
index 000000000..7ce4c49ae
--- /dev/null
+++ b/cmake/Modules/CMakeParseArgumentsCopy.cmake
@@ -0,0 +1,138 @@
+# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
+#
+# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for
+# parsing the arguments given to that macro or function.
+# It processes the arguments and defines a set of variables which hold the
+# values of the respective options.
+#
+# The <options> argument contains all options for the respective macro,
+# i.e. keywords which can be used when calling the macro without any value
+# following, like e.g. the OPTIONAL keyword of the install() command.
+#
+# The <one_value_keywords> argument contains all keywords for this macro
+# which are followed by one value, like e.g. DESTINATION keyword of the
+# install() command.
+#
+# The <multi_value_keywords> argument contains all keywords for this macro
+# which can be followed by more than one value, like e.g. the TARGETS or
+# FILES keywords of the install() command.
+#
+# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the
+# keywords listed in <options>, <one_value_keywords> and
+# <multi_value_keywords> a variable composed of the given <prefix>
+# followed by "_" and the name of the respective keyword.
+# These variables will then hold the respective value from the argument list.
+# For the <options> keywords this will be TRUE or FALSE.
+#
+# All remaining arguments are collected in a variable
+# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see whether
+# your macro was called with unrecognized parameters.
+#
+# As an example here a my_install() macro, which takes similar arguments as the
+# real install() command:
+#
+# function(MY_INSTALL)
+# set(options OPTIONAL FAST)
+# set(oneValueArgs DESTINATION RENAME)
+# set(multiValueArgs TARGETS CONFIGURATIONS)
+# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
+# ...
+#
+# Assume my_install() has been called like this:
+# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub)
+#
+# After the cmake_parse_arguments() call the macro will have set the following
+# variables:
+# MY_INSTALL_OPTIONAL = TRUE
+# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install()
+# MY_INSTALL_DESTINATION = "bin"
+# MY_INSTALL_RENAME = "" (was not used)
+# MY_INSTALL_TARGETS = "foo;bar"
+# MY_INSTALL_CONFIGURATIONS = "" (was not used)
+# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL"
+#
+# You can the continue and process these variables.
+#
+# Keywords terminate lists of values, e.g. if directly after a one_value_keyword
+# another recognized keyword follows, this is interpreted as the beginning of
+# the new option.
+# E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in
+# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would
+# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor.
+
+#=============================================================================
+# Copyright 2010 Alexander Neundorf <neundorf@kde.org>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+
+if(__CMAKE_PARSE_ARGUMENTS_INCLUDED)
+ return()
+endif()
+set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE)
+
+
+function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames)
+ # first set all result variables to empty/FALSE
+ foreach(arg_name ${_singleArgNames} ${_multiArgNames})
+ set(${prefix}_${arg_name})
+ endforeach(arg_name)
+
+ foreach(option ${_optionNames})
+ set(${prefix}_${option} FALSE)
+ endforeach(option)
+
+ set(${prefix}_UNPARSED_ARGUMENTS)
+
+ set(insideValues FALSE)
+ set(currentArgName)
+
+ # now iterate over all arguments and fill the result variables
+ foreach(currentArg ${ARGN})
+ list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword
+ list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword
+ list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword
+
+ if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1)
+ if(insideValues)
+ if("${insideValues}" STREQUAL "SINGLE")
+ set(${prefix}_${currentArgName} ${currentArg})
+ set(insideValues FALSE)
+ elseif("${insideValues}" STREQUAL "MULTI")
+ list(APPEND ${prefix}_${currentArgName} ${currentArg})
+ endif()
+ else(insideValues)
+ list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
+ endif(insideValues)
+ else()
+ if(NOT ${optionIndex} EQUAL -1)
+ set(${prefix}_${currentArg} TRUE)
+ set(insideValues FALSE)
+ elseif(NOT ${singleArgIndex} EQUAL -1)
+ set(currentArgName ${currentArg})
+ set(${prefix}_${currentArgName})
+ set(insideValues "SINGLE")
+ elseif(NOT ${multiArgIndex} EQUAL -1)
+ set(currentArgName ${currentArg})
+ set(${prefix}_${currentArgName})
+ set(insideValues "MULTI")
+ endif()
+ endif()
+
+ endforeach(currentArg)
+
+ # propagate the result variables to the caller:
+ foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
+ set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE)
+ endforeach(arg_name)
+ set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE)
+
+endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs)
diff --git a/cmake/Modules/FindALSA.cmake b/cmake/Modules/FindALSA.cmake
new file mode 100644
index 000000000..e3e6624ff
--- /dev/null
+++ b/cmake/Modules/FindALSA.cmake
@@ -0,0 +1,36 @@
+# - Try to find ALSA
+# Once done, this will define
+#
+# ALSA_FOUND - system has ALSA (GL and GLU)
+# ALSA_INCLUDE_DIRS - the ALSA include directories
+# ALSA_LIBRARIES - link these to use ALSA
+# ALSA_GL_LIBRARY - only GL
+# ALSA_GLU_LIBRARY - only GLU
+#
+# See documentation on how to write CMake scripts at
+# http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries
+
+include(LibFindMacros)
+
+libfind_pkg_check_modules(ALSA_PKGCONF alsa)
+
+find_path(ALSA_INCLUDE_DIR
+ NAMES alsa/version.h
+ PATHS ${ALSA_PKGCONF_INCLUDE_DIRS}
+)
+
+find_library(ALSA_LIBRARY
+ NAMES asound
+ PATHS ${ALSA_PKGCONF_LIBRARY_DIRS}
+)
+
+# Extract the version number
+IF(ALSA_INCLUDE_DIR)
+file(READ "${ALSA_INCLUDE_DIR}/alsa/version.h" _ALSA_VERSION_H_CONTENTS)
+string(REGEX REPLACE ".*#define SND_LIB_VERSION_STR[ \t]*\"([^\n]*)\".*" "\\1" ALSA_VERSION "${_ALSA_VERSION_H_CONTENTS}")
+ENDIF(ALSA_INCLUDE_DIR)
+
+set(ALSA_PROCESS_INCLUDES ALSA_INCLUDE_DIR)
+set(ALSA_PROCESS_LIBS ALSA_LIBRARY)
+libfind_process(ALSA)
+
diff --git a/cmake/Modules/FindCppUnit.cmake b/cmake/Modules/FindCppUnit.cmake
new file mode 100644
index 000000000..f986f35c6
--- /dev/null
+++ b/cmake/Modules/FindCppUnit.cmake
@@ -0,0 +1,34 @@
+# http://www.cmake.org/pipermail/cmake/2006-October/011446.html
+#
+# Find the CppUnit includes and library
+#
+# This module defines
+# CPPUNIT_INCLUDE_DIRS, where to find tiff.h, etc.
+# CPPUNIT_LIBRARIES, the libraries to link against to use CppUnit.
+# CPPUNIT_FOUND, If false, do not try to use CppUnit.
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(CPPUNIT "cppunit")
+LIST(APPEND CPPUNIT_LIBRARIES ${CMAKE_DL_LIBS})
+IF(NOT CPPUNIT_FOUND)
+
+FIND_PATH(CPPUNIT_INCLUDE_DIRS cppunit/TestCase.h
+ /usr/local/include
+ /usr/include
+)
+
+FIND_LIBRARY(CPPUNIT_LIBRARIES cppunit
+ ${CPPUNIT_INCLUDE_DIRS}/../lib
+ /usr/local/lib
+ /usr/lib)
+
+IF(CPPUNIT_INCLUDE_DIRS)
+ IF(CPPUNIT_LIBRARIES)
+ SET(CPPUNIT_FOUND "YES")
+ SET(CPPUNIT_LIBRARIES ${CPPUNIT_LIBRARIES} ${CMAKE_DL_LIBS})
+ ENDIF(CPPUNIT_LIBRARIES)
+ENDIF(CPPUNIT_INCLUDE_DIRS)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPPUNIT DEFAULT_MSG CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS)
+ENDIF(NOT CPPUNIT_FOUND)
diff --git a/cmake/Modules/FindFFTW3f.cmake b/cmake/Modules/FindFFTW3f.cmake
new file mode 100644
index 000000000..d84bb37a8
--- /dev/null
+++ b/cmake/Modules/FindFFTW3f.cmake
@@ -0,0 +1,32 @@
+# http://tim.klingt.org/code/projects/supernova/repository/revisions/d336dd6f400e381bcfd720e96139656de0c53b6a/entry/cmake_modules/FindFFTW3f.cmake
+# Find single-precision (float) version of FFTW3
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(FFTW3F "fftw3f >= 3.0")
+IF(NOT FFTW3F_FOUND)
+
+FIND_PATH(
+ FFTW3F_INCLUDE_DIRS
+ NAMES fftw3.h
+ HINTS $ENV{FFTW3_DIR}/include
+ PATHS /usr/local/include
+ /usr/include
+)
+
+FIND_LIBRARY(
+ FFTW3F_LIBRARIES
+ NAMES fftw3f libfftw3f
+ HINTS $ENV{FFTW3_DIR}/lib
+ PATHS /usr/local/lib
+ /usr/lib
+)
+
+SET(FFTW3F_FOUND "NO")
+
+IF( FFTW3F_INCLUDE_DIRS AND FFTW3F_LIBRARIES )
+ SET(FFTW3F_FOUND "YES")
+ENDIF()
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFTW3F DEFAULT_MSG FFTW3F_LIBRARIES FFTW3F_INCLUDE_DIRS)
+ENDIF(NOT FFTW3F_FOUND)
diff --git a/cmake/Modules/FindGSL.cmake b/cmake/Modules/FindGSL.cmake
new file mode 100644
index 000000000..48fd0077f
--- /dev/null
+++ b/cmake/Modules/FindGSL.cmake
@@ -0,0 +1,143 @@
+# Try to find gnu scientific library GSL
+# See
+# http://www.gnu.org/software/gsl/ and
+# http://gnuwin32.sourceforge.net/packages/gsl.htm
+#
+# Based on a script of Felix Woelk and Jan Woetzel
+# (www.mip.informatik.uni-kiel.de)
+#
+# It defines the following variables:
+# GSL_FOUND - system has GSL lib
+# GSL_INCLUDE_DIRS - where to find headers
+# GSL_LIBRARIES - full path to the libraries
+# GSL_LIBRARY_DIRS, the directory where the PLplot library is found.
+
+# CMAKE_GSL_CXX_FLAGS = Unix compiler flags for GSL, essentially "`gsl-config --cxxflags`"
+# GSL_LINK_DIRECTORIES = link directories, useful for rpath on Unix
+# GSL_EXE_LINKER_FLAGS = rpath on Unix
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(GSL "gsl >= 1.10")
+IF(NOT GSL_FOUND)
+
+set( GSL_FOUND OFF )
+set( GSL_CBLAS_FOUND OFF )
+
+# Windows, but not for Cygwin and MSys where gsl-config is available
+if( WIN32 AND NOT CYGWIN AND NOT MSYS )
+ # look for headers
+ find_path( GSL_INCLUDE_DIR
+ NAMES gsl/gsl_cdf.h gsl/gsl_randist.h
+ )
+ if( GSL_INCLUDE_DIR )
+ # look for gsl library
+ find_library( GSL_LIBRARY
+ NAMES gsl
+ )
+ if( GSL_LIBRARY )
+ set( GSL_INCLUDE_DIRS ${GSL_INCLUDE_DIR} )
+ get_filename_component( GSL_LIBRARY_DIRS ${GSL_LIBRARY} PATH )
+ set( GSL_FOUND ON )
+ endif( GSL_LIBRARY )
+
+ # look for gsl cblas library
+ find_library( GSL_CBLAS_LIBRARY
+ NAMES gslcblas
+ )
+ if( GSL_CBLAS_LIBRARY )
+ set( GSL_CBLAS_FOUND ON )
+ endif( GSL_CBLAS_LIBRARY )
+
+ set( GSL_LIBRARIES ${GSL_LIBRARY} ${GSL_CBLAS_LIBRARY} )
+ endif( GSL_INCLUDE_DIR )
+
+ #mark_as_advanced(
+ # GSL_INCLUDE_DIR
+ # GSL_LIBRARY
+ # GSL_CBLAS_LIBRARY
+ #)
+else( WIN32 AND NOT CYGWIN AND NOT MSYS )
+ if( UNIX OR MSYS )
+ find_program( GSL_CONFIG_EXECUTABLE gsl-config
+ /usr/bin/
+ /usr/local/bin
+ )
+
+ if( GSL_CONFIG_EXECUTABLE )
+ set( GSL_FOUND ON )
+
+ # run the gsl-config program to get cxxflags
+ execute_process(
+ COMMAND sh "${GSL_CONFIG_EXECUTABLE}" --cflags
+ OUTPUT_VARIABLE GSL_CFLAGS
+ RESULT_VARIABLE RET
+ ERROR_QUIET
+ )
+ if( RET EQUAL 0 )
+ string( STRIP "${GSL_CFLAGS}" GSL_CFLAGS )
+ separate_arguments( GSL_CFLAGS )
+
+ # parse definitions from cflags; drop -D* from CFLAGS
+ string( REGEX MATCHALL "-D[^;]+"
+ GSL_DEFINITIONS "${GSL_CFLAGS}" )
+ string( REGEX REPLACE "-D[^;]+;" ""
+ GSL_CFLAGS "${GSL_CFLAGS}" )
+
+ # parse include dirs from cflags; drop -I prefix
+ string( REGEX MATCHALL "-I[^;]+"
+ GSL_INCLUDE_DIRS "${GSL_CFLAGS}" )
+ string( REPLACE "-I" ""
+ GSL_INCLUDE_DIRS "${GSL_INCLUDE_DIRS}")
+ string( REGEX REPLACE "-I[^;]+;" ""
+ GSL_CFLAGS "${GSL_CFLAGS}")
+
+ message("GSL_DEFINITIONS=${GSL_DEFINITIONS}")
+ message("GSL_INCLUDE_DIRS=${GSL_INCLUDE_DIRS}")
+ message("GSL_CFLAGS=${GSL_CFLAGS}")
+ else( RET EQUAL 0 )
+ set( GSL_FOUND FALSE )
+ endif( RET EQUAL 0 )
+
+ # run the gsl-config program to get the libs
+ execute_process(
+ COMMAND sh "${GSL_CONFIG_EXECUTABLE}" --libs
+ OUTPUT_VARIABLE GSL_LIBRARIES
+ RESULT_VARIABLE RET
+ ERROR_QUIET
+ )
+ if( RET EQUAL 0 )
+ string(STRIP "${GSL_LIBRARIES}" GSL_LIBRARIES )
+ separate_arguments( GSL_LIBRARIES )
+
+ # extract linkdirs (-L) for rpath (i.e., LINK_DIRECTORIES)
+ string( REGEX MATCHALL "-L[^;]+"
+ GSL_LIBRARY_DIRS "${GSL_LIBRARIES}" )
+ string( REPLACE "-L" ""
+ GSL_LIBRARY_DIRS "${GSL_LIBRARY_DIRS}" )
+ else( RET EQUAL 0 )
+ set( GSL_FOUND FALSE )
+ endif( RET EQUAL 0 )
+
+ MARK_AS_ADVANCED(
+ GSL_CFLAGS
+ )
+ message( STATUS "Using GSL from ${GSL_PREFIX}" )
+ else( GSL_CONFIG_EXECUTABLE )
+ message( STATUS "FindGSL: gsl-config not found.")
+ endif( GSL_CONFIG_EXECUTABLE )
+ endif( UNIX OR MSYS )
+endif( WIN32 AND NOT CYGWIN AND NOT MSYS )
+
+if( GSL_FOUND )
+ if( NOT GSL_FIND_QUIETLY )
+ message( STATUS "FindGSL: Found both GSL headers and library" )
+ endif( NOT GSL_FIND_QUIETLY )
+else( GSL_FOUND )
+ if( GSL_FIND_REQUIRED )
+ message( FATAL_ERROR "FindGSL: Could not find GSL headers or library" )
+ endif( GSL_FIND_REQUIRED )
+endif( GSL_FOUND )
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GSL DEFAULT_MSG GSL_LIBRARIES GSL_INCLUDE_DIRS)
+ENDIF(NOT GSL_FOUND)
diff --git a/cmake/Modules/FindGit.cmake b/cmake/Modules/FindGit.cmake
new file mode 100644
index 000000000..2d8214287
--- /dev/null
+++ b/cmake/Modules/FindGit.cmake
@@ -0,0 +1,46 @@
+# The module defines the following variables:
+# GIT_EXECUTABLE - path to git command line client
+# GIT_FOUND - true if the command line client was found
+# Example usage:
+# find_package(Git)
+# if(GIT_FOUND)
+# message("git found: ${GIT_EXECUTABLE}")
+# endif()
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distributed this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# Look for 'git' or 'eg' (easy git)
+#
+set(git_names git eg)
+
+# Prefer .cmd variants on Windows unless running in a Makefile
+# in the MSYS shell.
+#
+if(WIN32)
+ if(NOT CMAKE_GENERATOR MATCHES "MSYS")
+ set(git_names git.cmd git eg.cmd eg)
+ endif()
+endif()
+
+find_program(GIT_EXECUTABLE
+ NAMES ${git_names}
+ DOC "git command line client"
+ )
+mark_as_advanced(GIT_EXECUTABLE)
+
+# Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if
+# all listed variables are TRUE
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Git DEFAULT_MSG GIT_EXECUTABLE)
diff --git a/cmake/Modules/FindJack.cmake b/cmake/Modules/FindJack.cmake
new file mode 100644
index 000000000..44417deb3
--- /dev/null
+++ b/cmake/Modules/FindJack.cmake
@@ -0,0 +1,87 @@
+# - Try to find jack-2.6
+# Once done this will define
+#
+# JACK_FOUND - system has jack
+# JACK_INCLUDE_DIRS - the jack include directory
+# JACK_LIBRARIES - Link these to use jack
+# JACK_DEFINITIONS - Compiler switches required for using jack
+#
+# Copyright (c) 2008 Andreas Schneider <mail@cynapses.org>
+# Modified for other libraries by Lasse Kärkkäinen <tronic>
+#
+# Redistribution and use is allowed according to the terms of the New
+# BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+
+if (JACK_LIBRARIES AND JACK_INCLUDE_DIRS)
+ # in cache already
+ set(JACK_FOUND TRUE)
+else (JACK_LIBRARIES AND JACK_INCLUDE_DIRS)
+ # use pkg-config to get the directories and then use these values
+ # in the FIND_PATH() and FIND_LIBRARY() calls
+ if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+ include(UsePkgConfig)
+ pkgconfig(jack _JACK_INCLUDEDIR _JACK_LIBDIR _JACK_LDFLAGS _JACK_CFLAGS)
+ else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+ find_package(PkgConfig)
+ if (PKG_CONFIG_FOUND)
+ pkg_check_modules(_JACK jack)
+ endif (PKG_CONFIG_FOUND)
+ endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+ find_path(JACK_INCLUDE_DIR
+ NAMES
+ jack/jack.h
+ PATHS
+ ${_JACK_INCLUDEDIR}
+ /usr/include
+ /usr/local/include
+ /opt/local/include
+ /sw/include
+ )
+
+ find_library(JACK_LIBRARY
+ NAMES
+ jack
+ PATHS
+ ${_JACK_LIBDIR}
+ /usr/lib
+ /usr/local/lib
+ /opt/local/lib
+ /sw/lib
+ )
+
+ if (JACK_LIBRARY)
+ set(JACK_FOUND TRUE)
+ endif (JACK_LIBRARY)
+
+ set(JACK_INCLUDE_DIRS
+ ${JACK_INCLUDE_DIR}
+ )
+
+ if (JACK_FOUND)
+ set(JACK_LIBRARIES
+ ${JACK_LIBRARIES}
+ ${JACK_LIBRARY}
+ )
+ endif (JACK_FOUND)
+
+ if (JACK_INCLUDE_DIRS AND JACK_LIBRARIES)
+ set(JACK_FOUND TRUE)
+ endif (JACK_INCLUDE_DIRS AND JACK_LIBRARIES)
+
+ if (JACK_FOUND)
+ if (NOT JACK_FIND_QUIETLY)
+ message(STATUS "Found jack: ${JACK_LIBRARY}")
+ endif (NOT JACK_FIND_QUIETLY)
+ else (JACK_FOUND)
+ if (JACK_FIND_REQUIRED)
+ message(FATAL_ERROR "Could not find JACK")
+ endif (JACK_FIND_REQUIRED)
+ endif (JACK_FOUND)
+
+ # show the JACK_INCLUDE_DIRS and JACK_LIBRARIES variables only in the advanced view
+ mark_as_advanced(JACK_INCLUDE_DIRS JACK_LIBRARIES)
+
+endif (JACK_LIBRARIES AND JACK_INCLUDE_DIRS)
+
diff --git a/cmake/Modules/FindOSS.cmake b/cmake/Modules/FindOSS.cmake
new file mode 100644
index 000000000..105b3ec9c
--- /dev/null
+++ b/cmake/Modules/FindOSS.cmake
@@ -0,0 +1,46 @@
+# - Find Oss
+# Find Oss headers and libraries.
+#
+# OSS_INCLUDE_DIR - where to find soundcard.h, etc.
+# OSS_FOUND - True if Oss found.
+
+
+FIND_PATH(LINUX_OSS_INCLUDE_DIR "linux/soundcard.h"
+ "/usr/include" "/usr/local/include"
+)
+
+FIND_PATH(SYS_OSS_INCLUDE_DIR "sys/soundcard.h"
+ "/usr/include" "/usr/local/include"
+)
+
+FIND_PATH(MACHINE_OSS_INCLUDE_DIR "machine/soundcard.h"
+ "/usr/include" "/usr/local/include"
+)
+
+SET(OSS_FOUND FALSE)
+
+IF(LINUX_OSS_INCLUDE_DIR)
+ SET(OSS_FOUND TRUE)
+ SET(OSS_INCLUDE_DIR ${LINUX_OSS_INCLUDE_DIR})
+ SET(HAVE_LINUX_SOUNDCARD_H 1)
+ENDIF()
+
+IF(SYS_OSS_INCLUDE_DIR)
+ SET(OSS_FOUND TRUE)
+ SET(OSS_INCLUDE_DIR ${SYS_OSS_INCLUDE_DIR})
+ SET(HAVE_SYS_SOUNDCARD_H 1)
+ENDIF()
+
+IF(MACHINE_OSS_INCLUDE_DIR)
+ SET(OSS_FOUND TRUE)
+ SET(OSS_INCLUDE_DIR ${MACHINE_OSS_INCLUDE_DIR})
+ SET(HAVE_MACHINE_SOUNDCARD_H 1)
+ENDIF()
+
+MARK_AS_ADVANCED (
+ OSS_FOUND
+ OSS_INCLUDE_DIR
+ LINUX_OSS_INCLUDE_DIR
+ SYS_OSS_INCLUDE_DIR
+ MACHINE_OSS_INCLUDE_DIR
+)
diff --git a/cmake/Modules/FindPortaudio.cmake b/cmake/Modules/FindPortaudio.cmake
new file mode 100644
index 000000000..158e20ee5
--- /dev/null
+++ b/cmake/Modules/FindPortaudio.cmake
@@ -0,0 +1,107 @@
+# - Try to find Portaudio
+# Once done this will define
+#
+# PORTAUDIO_FOUND - system has Portaudio
+# PORTAUDIO_INCLUDE_DIRS - the Portaudio include directory
+# PORTAUDIO_LIBRARIES - Link these to use Portaudio
+# PORTAUDIO_DEFINITIONS - Compiler switches required for using Portaudio
+# PORTAUDIO_VERSION - Portaudio version
+#
+# Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
+#
+# Redistribution and use is allowed according to the terms of the New BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+
+
+if (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS)
+ # in cache already
+ set(PORTAUDIO_FOUND TRUE)
+else (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS)
+ if (NOT WIN32)
+ include(FindPkgConfig)
+ pkg_check_modules(PORTAUDIO2 portaudio-2.0)
+ endif (NOT WIN32)
+
+ if (PORTAUDIO2_FOUND)
+ set(PORTAUDIO_INCLUDE_DIRS
+ ${PORTAUDIO2_INCLUDE_DIRS}
+ )
+ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ set(PORTAUDIO_LIBRARIES "${PORTAUDIO2_LIBRARY_DIRS}/lib${PORTAUDIO2_LIBRARIES}.dylib")
+ else (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ set(PORTAUDIO_LIBRARIES
+ ${PORTAUDIO2_LIBRARIES}
+ )
+ endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ set(PORTAUDIO_VERSION
+ 19
+ )
+ set(PORTAUDIO_FOUND TRUE)
+ else (PORTAUDIO2_FOUND)
+ find_path(PORTAUDIO_INCLUDE_DIR
+ NAMES
+ portaudio.h
+ PATHS
+ /usr/include
+ /usr/local/include
+ /opt/local/include
+ /sw/include
+ )
+
+ find_library(PORTAUDIO_LIBRARY
+ NAMES
+ portaudio
+ PATHS
+ /usr/lib
+ /usr/local/lib
+ /opt/local/lib
+ /sw/lib
+ )
+
+ find_path(PORTAUDIO_LIBRARY_DIR
+ NAMES
+ portaudio
+ PATHS
+ /usr/lib
+ /usr/local/lib
+ /opt/local/lib
+ /sw/lib
+ )
+
+ set(PORTAUDIO_INCLUDE_DIRS
+ ${PORTAUDIO_INCLUDE_DIR}
+ )
+ set(PORTAUDIO_LIBRARIES
+ ${PORTAUDIO_LIBRARY}
+ )
+
+ set(PORTAUDIO_LIBRARY_DIRS
+ ${PORTAUDIO_LIBRARY_DIR}
+ )
+
+ set(PORTAUDIO_VERSION
+ 18
+ )
+
+ if (PORTAUDIO_INCLUDE_DIRS AND PORTAUDIO_LIBRARIES)
+ set(PORTAUDIO_FOUND TRUE)
+ endif (PORTAUDIO_INCLUDE_DIRS AND PORTAUDIO_LIBRARIES)
+
+ if (PORTAUDIO_FOUND)
+ if (NOT Portaudio_FIND_QUIETLY)
+ message(STATUS "Found Portaudio: ${PORTAUDIO_LIBRARIES}")
+ endif (NOT Portaudio_FIND_QUIETLY)
+ else (PORTAUDIO_FOUND)
+ if (Portaudio_FIND_REQUIRED)
+ message(FATAL_ERROR "Could not find Portaudio")
+ endif (Portaudio_FIND_REQUIRED)
+ endif (PORTAUDIO_FOUND)
+ endif (PORTAUDIO2_FOUND)
+
+
+ # show the PORTAUDIO_INCLUDE_DIRS and PORTAUDIO_LIBRARIES variables only in the advanced view
+ mark_as_advanced(PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES)
+
+endif (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS)
+
diff --git a/cmake/Modules/FindQwt.cmake b/cmake/Modules/FindQwt.cmake
new file mode 100644
index 000000000..698edc8b9
--- /dev/null
+++ b/cmake/Modules/FindQwt.cmake
@@ -0,0 +1,13 @@
+# - try to find Qwt libraries and include files
+# QWT_INCLUDE_DIR where to find qwt_plot.h, etc.
+# QWT_LIBRARIES libraries to link against
+# QWT_FOUND If false, do not try to use Qwt
+
+find_path ( QWT_INCLUDE_DIRS qwt_plot.h /usr/include/qwt-qt4 /usr/include/qwt )
+
+find_library ( QWT_LIBRARIES NAMES qwt-qt4 qwt)
+
+# handle the QUIETLY and REQUIRED arguments and set QWT_FOUND to TRUE if
+# all listed variables are TRUE
+include ( FindPackageHandleStandardArgs )
+find_package_handle_standard_args( Qwt DEFAULT_MSG QWT_LIBRARIES QWT_INCLUDE_DIRS )
diff --git a/cmake/Modules/FindUHD.cmake b/cmake/Modules/FindUHD.cmake
new file mode 100644
index 000000000..7e9f70aa9
--- /dev/null
+++ b/cmake/Modules/FindUHD.cmake
@@ -0,0 +1,24 @@
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(UHD uhd)
+IF(NOT UHD_FOUND)
+
+FIND_PATH(
+ UHD_INCLUDE_DIRS
+ NAMES uhd/config.hpp
+ HINTS $ENV{UHD_DIR}/include
+ PATHS /usr/local/include
+ /usr/include
+)
+
+FIND_LIBRARY(
+ UHD_LIBRARIES
+ NAMES uhd
+ HINTS $ENV{UHD_DIR}/lib
+ PATHS /usr/local/lib
+ /usr/lib
+)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(UHD DEFAULT_MSG UHD_LIBRARIES UHD_INCLUDE_DIRS)
+
+ENDIF(NOT UHD_FOUND)
diff --git a/cmake/Modules/GrBoost.cmake b/cmake/Modules/GrBoost.cmake
new file mode 100644
index 000000000..4e515152d
--- /dev/null
+++ b/cmake/Modules/GrBoost.cmake
@@ -0,0 +1,62 @@
+# Copyright 2010-2011 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+IF(DEFINED __INCLUDED_GR_BOOST_CMAKE)
+ RETURN()
+ENDIF()
+SET(__INCLUDED_GR_BOOST_CMAKE TRUE)
+
+########################################################################
+# Setup Boost and handle some system specific things
+########################################################################
+
+SET(BOOST_REQUIRED_COMPONENTS
+ date_time
+ program_options
+ filesystem
+ system
+ thread
+)
+
+IF(UNIX AND EXISTS "/usr/lib64")
+ LIST(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
+ENDIF(UNIX AND EXISTS "/usr/lib64")
+
+IF(MSVC)
+ IF (NOT DEFINED BOOST_ALL_DYN_LINK)
+ SET(BOOST_ALL_DYN_LINK TRUE)
+ ENDIF()
+ SET(BOOST_ALL_DYN_LINK "${BOOST_ALL_DYN_LINK}" CACHE BOOL "boost enable dynamic linking")
+ IF(BOOST_ALL_DYN_LINK)
+ ADD_DEFINITIONS(-DBOOST_ALL_DYN_LINK) #setup boost auto-linking in msvc
+ ELSE(BOOST_ALL_DYN_LINK)
+ UNSET(BOOST_REQUIRED_COMPONENTS) #empty components list for static link
+ ENDIF(BOOST_ALL_DYN_LINK)
+ENDIF(MSVC)
+
+SET(Boost_ADDITIONAL_VERSIONS
+ "1.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39"
+ "1.40.0" "1.40" "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44"
+ "1.45.0" "1.45" "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49"
+ "1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54"
+ "1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59"
+ "1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64"
+ "1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69"
+)
+FIND_PACKAGE(Boost "1.35" COMPONENTS ${BOOST_REQUIRED_COMPONENTS})
diff --git a/cmake/Modules/GrComponent.cmake b/cmake/Modules/GrComponent.cmake
new file mode 100644
index 000000000..8a94e219a
--- /dev/null
+++ b/cmake/Modules/GrComponent.cmake
@@ -0,0 +1,82 @@
+# Copyright 2010-2011 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+IF(DEFINED __INCLUDED_GR_COMPONENT_CMAKE)
+ RETURN()
+ENDIF()
+SET(__INCLUDED_GR_COMPONENT_CMAKE TRUE)
+
+SET(_gr_enabled_components "" CACHE INTERNAL "" FORCE)
+SET(_gr_disabled_components "" CACHE INTERNAL "" FORCE)
+
+########################################################################
+# Register a component into the system
+# - name: canonical component name
+# - var: variable for enabled status
+# - argn: list of dependencies
+########################################################################
+FUNCTION(GR_REGISTER_COMPONENT name var)
+ INCLUDE(CMakeDependentOption)
+ MESSAGE(STATUS "")
+ MESSAGE(STATUS "Configuring ${name} support...")
+ FOREACH(dep ${ARGN})
+ MESSAGE(STATUS " Dependency ${dep} = ${${dep}}")
+ ENDFOREACH(dep)
+
+ #setup the dependent option for this component
+ CMAKE_DEPENDENT_OPTION(${var} "enable ${name} support" ON "${ARGN}" OFF)
+ SET(${var}_ "${${var}}" CACHE INTERNAL "" FORCE)
+
+ #append the component into one of the lists
+ IF(${var})
+ MESSAGE(STATUS " Enabling ${name} support.")
+ LIST(APPEND _gr_enabled_components ${name})
+ ELSE(${var})
+ MESSAGE(STATUS " Disabling ${name} support.")
+ LIST(APPEND _gr_disabled_components ${name})
+ ENDIF(${var})
+ MESSAGE(STATUS " Override with -D${var}=ON/OFF")
+
+ #make components lists into global variables
+ SET(_gr_enabled_components ${_gr_enabled_components} CACHE INTERNAL "" FORCE)
+ SET(_gr_disabled_components ${_gr_disabled_components} CACHE INTERNAL "" FORCE)
+ENDFUNCTION(GR_REGISTER_COMPONENT)
+
+########################################################################
+# Print the registered component summary
+########################################################################
+FUNCTION(GR_PRINT_COMPONENT_SUMMARY)
+ MESSAGE(STATUS "")
+ MESSAGE(STATUS "######################################################")
+ MESSAGE(STATUS "# Gnuradio enabled components ")
+ MESSAGE(STATUS "######################################################")
+ FOREACH(comp ${_gr_enabled_components})
+ MESSAGE(STATUS " * ${comp}")
+ ENDFOREACH(comp)
+
+ MESSAGE(STATUS "")
+ MESSAGE(STATUS "######################################################")
+ MESSAGE(STATUS "# Gnuradio disabled components ")
+ MESSAGE(STATUS "######################################################")
+ FOREACH(comp ${_gr_disabled_components})
+ MESSAGE(STATUS " * ${comp}")
+ ENDFOREACH(comp)
+
+ MESSAGE(STATUS "")
+ENDFUNCTION(GR_PRINT_COMPONENT_SUMMARY)
diff --git a/cmake/Modules/GrMiscUtils.cmake b/cmake/Modules/GrMiscUtils.cmake
new file mode 100644
index 000000000..c36c509b5
--- /dev/null
+++ b/cmake/Modules/GrMiscUtils.cmake
@@ -0,0 +1,86 @@
+# Copyright 2010-2011 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+IF(DEFINED __INCLUDED_GR_MISC_UTILS_CMAKE)
+ RETURN()
+ENDIF()
+SET(__INCLUDED_GR_MISC_UTILS_CMAKE TRUE)
+
+########################################################################
+# Set global variable macro.
+# Used for subdirectories to export settings.
+# Example: include and library paths.
+########################################################################
+FUNCTION(GR_SET_GLOBAL var)
+ SET(${var} ${ARGN} CACHE INTERNAL "" FORCE)
+ENDFUNCTION(GR_SET_GLOBAL)
+
+########################################################################
+# Set the pre-processor definition if the condition is true.
+# - def the pre-processor definition to set and condition name
+########################################################################
+FUNCTION(GR_ADD_COND_DEF def)
+ IF(${def})
+ ADD_DEFINITIONS(-D${def})
+ ENDIF(${def})
+ENDFUNCTION(GR_ADD_COND_DEF)
+
+########################################################################
+# Check for a header and conditionally set a compile define.
+# - hdr the relative path to the header file
+# - def the pre-processor definition to set
+########################################################################
+FUNCTION(GR_CHECK_HDR_N_DEF hdr def)
+ INCLUDE(CheckIncludeFileCXX)
+ CHECK_INCLUDE_FILE_CXX(${hdr} ${def})
+ GR_ADD_COND_DEF(${def})
+ENDFUNCTION(GR_CHECK_HDR_N_DEF)
+
+########################################################################
+# Include subdirectory macro.
+# Sets the CMake directory variables,
+# includes the subdirectory CMakeLists.txt,
+# resets the CMake directory variables.
+#
+# This macro includes subdirectories rather than adding them
+# so that the subdirectory can affect variables in the level above.
+# This provides a work-around for the lack of convenience libraries.
+# This way a subdirectory can append to the list of library sources.
+########################################################################
+MACRO(GR_INCLUDE_SUBDIRECTORY subdir)
+ #insert the current directories on the front of the list
+ LIST(INSERT _cmake_source_dirs 0 ${CMAKE_CURRENT_SOURCE_DIR})
+ LIST(INSERT _cmake_binary_dirs 0 ${CMAKE_CURRENT_BINARY_DIR})
+
+ #set the current directories to the names of the subdirs
+ SET(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${subdir})
+ SET(CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${subdir})
+
+ #include the subdirectory CMakeLists to run it
+ FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+ INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt)
+
+ #reset the value of the current directories
+ LIST(GET _cmake_source_dirs 0 CMAKE_CURRENT_SOURCE_DIR)
+ LIST(GET _cmake_binary_dirs 0 CMAKE_CURRENT_BINARY_DIR)
+
+ #pop the subdir names of the front of the list
+ LIST(REMOVE_AT _cmake_source_dirs 0)
+ LIST(REMOVE_AT _cmake_binary_dirs 0)
+ENDMACRO(GR_INCLUDE_SUBDIRECTORY)
diff --git a/cmake/Modules/GrPackage.cmake b/cmake/Modules/GrPackage.cmake
new file mode 100644
index 000000000..2fc9fc08a
--- /dev/null
+++ b/cmake/Modules/GrPackage.cmake
@@ -0,0 +1,134 @@
+# Copyright 2011 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+IF(DEFINED __INCLUDED_GR_PACKAGE_CMAKE)
+ RETURN()
+ENDIF()
+SET(__INCLUDED_GR_PACKAGE_CMAKE TRUE)
+
+INCLUDE(GrVersion) #sets version information
+INCLUDE(GrPlatform) #sets platform information
+
+#set the cpack generator based on the platform type
+IF(CPACK_GENERATOR)
+ #already set by user
+ELSEIF(APPLE)
+ SET(CPACK_GENERATOR PackageMaker)
+ELSEIF(WIN32)
+ SET(CPACK_GENERATOR NSIS)
+ELSEIF(DEBIAN)
+ SET(CPACK_GENERATOR DEB)
+ELSEIF(REDHAT)
+ SET(CPACK_GENERATOR RPM)
+ELSE()
+ SET(CPACK_GENERATOR TGZ)
+ENDIF()
+
+########################################################################
+# CPACK_SET - set a global variable and record the variable name
+########################################################################
+FUNCTION(CPACK_SET var)
+ SET(${var} ${ARGN} CACHE INTERNAL "")
+ LIST(APPEND _cpack_vars ${var})
+ LIST(REMOVE_DUPLICATES _cpack_vars)
+ SET(_cpack_vars ${_cpack_vars} CACHE INTERNAL "")
+ENDFUNCTION(CPACK_SET)
+
+########################################################################
+# CPACK_FINALIZE - include cpack and the unset all the cpack variables
+########################################################################
+FUNCTION(CPACK_FINALIZE)
+ INCLUDE(CPack) #finalize the cpack settings configured throughout the build system
+ FOREACH(var ${_cpack_vars})
+ UNSET(${var} CACHE)
+ ENDFOREACH(var)
+ UNSET(_cpack_vars CACHE)
+ENDFUNCTION(CPACK_FINALIZE)
+
+########################################################################
+# CPACK_COMPONENT - convenience function to create a cpack component
+#
+# Usage: CPACK_COMPONENT(
+# name
+# [GROUP group]
+# [DISPLAY_NAME display_name]
+# [DESCRIPTION description]
+# [DEPENDS depends]
+# )
+########################################################################
+FUNCTION(CPACK_COMPONENT name)
+ INCLUDE(CMakeParseArgumentsCopy)
+ SET(_options GROUP DISPLAY_NAME DESCRIPTION DEPENDS)
+ CMAKE_PARSE_ARGUMENTS(CPACK_COMPONENT "" "${_options}" "" ${ARGN})
+
+ STRING(TOUPPER "${name}" name_upper)
+ FOREACH(_option ${_options})
+ IF(CPACK_COMPONENT_${_option})
+ CPACK_SET(CPACK_COMPONENT_${name_upper}_${_option} "${CPACK_COMPONENT_${_option}}")
+ ENDIF()
+ ENDFOREACH(_option)
+
+ CPACK_SET(CPACK_COMPONENTS_ALL "${CPACK_COMPONENTS_ALL};${name}")
+
+ENDFUNCTION(CPACK_COMPONENT)
+
+########################################################################
+# Setup CPack
+########################################################################
+SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GNU Radio")
+SET(CPACK_PACKAGE_VENDOR "Free Software Foundation, Inc.")
+SET(CPACK_PACKAGE_CONTACT "Discuss-gnuradio@gnu.org")
+SET(CPACK_PACKAGE_VERSION ${VERSION})
+SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/README)
+SET(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/README)
+SET(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_SOURCE_DIR}/README)
+IF(${CPACK_GENERATOR} STREQUAL NSIS)
+ SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_PROJECT_NAME}")
+ENDIF()
+
+########################################################################
+# DEB package specific
+########################################################################
+SET(CPACK_DEBIAN_PACKAGE_DEPENDS
+ "libboost-all-dev"
+ "libfftw3-3"
+ "python"
+ "python-numpy"
+ "libqt4-core"
+ "libqwt5-qt4"
+ "libqwtplot3d-qt4-0"
+ "python-qt4"
+ "python-gtk2"
+ "python-lxml"
+ "python-Cheetah"
+)
+STRING(REPLACE ";" ", " CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}")
+SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${CMAKE_SOURCE_DIR}/debian/postinst ${CMAKE_SOURCE_DIR}/debian/prerm)
+
+########################################################################
+# RPM package specific
+########################################################################
+SET(CPACK_RPM_PACKAGE_REQUIRES "boost-devel") #TODO other packages
+
+########################################################################
+# NSIS package specific
+########################################################################
+SET(CPACK_NSIS_MODIFY_PATH ON)
+
+SET(HLKM_ENV "\\\"SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment\\\"")
diff --git a/cmake/Modules/GrPlatform.cmake b/cmake/Modules/GrPlatform.cmake
new file mode 100644
index 000000000..85f318618
--- /dev/null
+++ b/cmake/Modules/GrPlatform.cmake
@@ -0,0 +1,46 @@
+# Copyright 2011 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+IF(DEFINED __INCLUDED_GR_PLATFORM_CMAKE)
+ RETURN()
+ENDIF()
+SET(__INCLUDED_GR_PLATFORM_CMAKE TRUE)
+
+########################################################################
+# Setup additional defines for OS types
+########################################################################
+IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ SET(LINUX TRUE)
+ENDIF()
+
+IF(LINUX AND EXISTS "/etc/debian_version")
+ SET(DEBIAN TRUE)
+ENDIF()
+
+IF(LINUX AND EXISTS "/etc/redhat-release")
+ SET(REDHAT TRUE)
+ENDIF()
+
+########################################################################
+# when the library suffix should be 64 (applies to redhat linux family)
+########################################################################
+IF(NOT DEFINED LIB_SUFFIX AND REDHAT AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$")
+ SET(LIB_SUFFIX 64)
+ENDIF()
+SET(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix")
diff --git a/cmake/Modules/GrPython.cmake b/cmake/Modules/GrPython.cmake
new file mode 100644
index 000000000..f54dbc9ba
--- /dev/null
+++ b/cmake/Modules/GrPython.cmake
@@ -0,0 +1,177 @@
+# Copyright 2010-2011 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+IF(DEFINED __INCLUDED_GR_PYTHON_CMAKE)
+ RETURN()
+ENDIF()
+SET(__INCLUDED_GR_PYTHON_CMAKE TRUE)
+
+########################################################################
+# Setup the python interpreter:
+# This allows the user to specify a specific interpreter,
+# or finds the interpreter via the built-in cmake module.
+########################################################################
+#this allows the user to override PYTHON_EXECUTABLE
+IF(PYTHON_EXECUTABLE)
+
+ SET(PYTHONINTERP_FOUND TRUE)
+
+#otherwise if not set, try to automatically find it
+ELSE(PYTHON_EXECUTABLE)
+
+ #use the built-in find script
+ FIND_PACKAGE(PythonInterp)
+
+ #and if that fails use the find program routine
+ IF(NOT PYTHONINTERP_FOUND)
+ FIND_PROGRAM(PYTHON_EXECUTABLE NAMES python python2.7 python2.6 python2.5)
+ IF(PYTHON_EXECUTABLE)
+ SET(PYTHONINTERP_FOUND TRUE)
+ ENDIF(PYTHON_EXECUTABLE)
+ ENDIF(NOT PYTHONINTERP_FOUND)
+
+ENDIF(PYTHON_EXECUTABLE)
+
+#make the path to the executable appear in the cmake gui
+SET(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter")
+
+########################################################################
+# Check for the existence of a python module:
+# - desc a string description of the check
+# - mod the name of the module to import
+# - cmd an additional command to run
+# - have the result variable to set
+########################################################################
+MACRO(GR_PYTHON_CHECK_MODULE desc mod cmd have)
+ MESSAGE(STATUS "")
+ MESSAGE(STATUS "Python checking for ${desc}")
+ EXECUTE_PROCESS(
+ COMMAND ${PYTHON_EXECUTABLE} -c "
+#########################################
+try: import ${mod}
+except: exit(-1)
+try: assert ${cmd}
+except: exit(-1)
+#########################################"
+ RESULT_VARIABLE ${have}
+ )
+ IF(${have} EQUAL 0)
+ MESSAGE(STATUS "Python checking for ${desc} - found")
+ SET(${have} TRUE)
+ ELSE(${have} EQUAL 0)
+ MESSAGE(STATUS "Python checking for ${desc} - not found")
+ SET(${have} FALSE)
+ ENDIF(${have} EQUAL 0)
+ENDMACRO(GR_PYTHON_CHECK_MODULE)
+
+########################################################################
+# Sets the python installation directory GR_PYTHON_DIR
+########################################################################
+EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "
+from distutils import sysconfig
+print sysconfig.get_python_lib(plat_specific=True, prefix='')
+" OUTPUT_VARIABLE GR_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+FILE(TO_CMAKE_PATH ${GR_PYTHON_DIR} GR_PYTHON_DIR)
+
+########################################################################
+# Create an always-built target with a unique name
+# Usage: GR_UNIQUE_TARGET(<description> <dependencies list>)
+########################################################################
+FUNCTION(GR_UNIQUE_TARGET desc)
+ FILE(RELATIVE_PATH reldir ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR})
+ EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import re, hashlib
+unique = hashlib.md5('${reldir}${ARGN}').hexdigest()[:5]
+print(re.sub('\\W', '_', '${desc} ${reldir} ' + unique))"
+ OUTPUT_VARIABLE _target OUTPUT_STRIP_TRAILING_WHITESPACE)
+ ADD_CUSTOM_TARGET(${_target} ALL DEPENDS ${ARGN})
+ENDFUNCTION(GR_UNIQUE_TARGET)
+
+########################################################################
+# Install python sources (also builds and installs byte-compiled python)
+########################################################################
+FUNCTION(GR_PYTHON_INSTALL)
+ INCLUDE(CMakeParseArgumentsCopy)
+ CMAKE_PARSE_ARGUMENTS(GR_PYTHON_INSTALL "" "DESTINATION;COMPONENT" "FILES;PROGRAMS" ${ARGN})
+
+ ####################################################################
+ IF(GR_PYTHON_INSTALL_FILES)
+ ####################################################################
+ INSTALL(${ARGN}) #installs regular python files
+
+ FOREACH(pyfile ${GR_PYTHON_INSTALL_FILES})
+ GET_FILENAME_COMPONENT(pyfile_name ${pyfile} NAME)
+ GET_FILENAME_COMPONENT(pyfile ${pyfile} ABSOLUTE)
+ STRING(REPLACE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" pycfile "${pyfile}c")
+ LIST(APPEND python_install_gen_targets ${pycfile})
+
+ GET_FILENAME_COMPONENT(pycfile_path ${pycfile} PATH)
+ FILE(MAKE_DIRECTORY ${pycfile_path})
+
+ #create a command to generate the byte-compiled pyc file
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${pycfile} DEPENDS ${pyfile}
+ COMMAND ${PYTHON_EXECUTABLE} -c
+ \"import py_compile\; py_compile.compile(file='${pyfile}', cfile='${pycfile}', doraise=True)\"
+ COMMENT "Byte-compiling ${pyfile_name}"
+ )
+ INSTALL(FILES ${pycfile}
+ DESTINATION ${GR_PYTHON_INSTALL_DESTINATION}
+ COMPONENT ${GR_PYTHON_INSTALL_COMPONENT}
+ )
+ ENDFOREACH(pyfile)
+
+ ####################################################################
+ ELSEIF(GR_PYTHON_INSTALL_PROGRAMS)
+ ####################################################################
+ FILE(TO_NATIVE_PATH ${PYTHON_EXECUTABLE} pyexe_native)
+
+ FOREACH(pyfile ${GR_PYTHON_INSTALL_PROGRAMS})
+ GET_FILENAME_COMPONENT(pyfile_name ${pyfile} NAME)
+ GET_FILENAME_COMPONENT(pyfile ${pyfile} ABSOLUTE)
+ STRING(REPLACE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" pyexefile "${pyfile}.exe")
+ LIST(APPEND python_install_gen_targets ${pyexefile})
+
+ GET_FILENAME_COMPONENT(pyexefile_path ${pyexefile} PATH)
+ FILE(MAKE_DIRECTORY ${pyexefile_path})
+
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${pyexefile} DEPENDS ${pyfile}
+ COMMAND ${PYTHON_EXECUTABLE} -c
+ \"open('${pyexefile}', 'w').write('\#!${pyexe_native}\\n'+open('${pyfile}').read())\"
+ COMMENT "Shebangin ${pyfile_name}"
+ )
+
+ #on windows, python files need an extension to execute
+ GET_FILENAME_COMPONENT(pyfile_ext ${pyfile} EXT)
+ IF(WIN32 AND NOT pyfile_ext)
+ SET(pyfile_name "${pyfile_name}.py")
+ ENDIF()
+
+ INSTALL(PROGRAMS ${pyexefile} RENAME ${pyfile_name}
+ DESTINATION ${GR_PYTHON_INSTALL_DESTINATION}
+ COMPONENT ${GR_PYTHON_INSTALL_COMPONENT}
+ )
+ ENDFOREACH(pyfile)
+
+ ENDIF()
+
+ GR_UNIQUE_TARGET("pygen" ${python_install_gen_targets})
+
+ENDFUNCTION(GR_PYTHON_INSTALL)
diff --git a/cmake/Modules/GrSwig.cmake b/cmake/Modules/GrSwig.cmake
new file mode 100644
index 000000000..9fca29a4f
--- /dev/null
+++ b/cmake/Modules/GrSwig.cmake
@@ -0,0 +1,90 @@
+# Copyright 2010-2011 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+IF(DEFINED __INCLUDED_GR_SWIG_CMAKE)
+ RETURN()
+ENDIF()
+SET(__INCLUDED_GR_SWIG_CMAKE TRUE)
+
+########################################################################
+# Build a swig target for the common gnuradio use case. Usage:
+# GR_SWIG_MAKE(target ifile ifile ifile...)
+#
+# Set the following variables before calling:
+# - GR_SWIG_FLAGS
+# - GR_SWIG_INCLUDE_DIRS
+# - GR_SWIG_LIBRARIES
+# - GR_SWIG_SOURCE_DEPS
+# - GR_SWIG_TARGET_DEPS
+########################################################################
+MACRO(GR_SWIG_MAKE name)
+ SET(ifiles ${ARGN})
+
+ INCLUDE_DIRECTORIES(${GR_SWIG_INCLUDE_DIRS})
+ SET(SWIG_MODULE_${name}_EXTRA_DEPS ${GR_SWIG_SOURCE_DEPS})
+
+ FIND_PACKAGE(PythonLibs)
+ INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS})
+
+ #setup the swig flags with flags and include directories
+ SET(CMAKE_SWIG_FLAGS -fvirtual -modern -keyword -w511 -module ${name} ${GR_SWIG_FLAGS})
+ FOREACH(dir ${GR_SWIG_INCLUDE_DIRS})
+ LIST(APPEND CMAKE_SWIG_FLAGS "-I${dir}")
+ ENDFOREACH(dir)
+
+ #set the C++ property on the swig .i file so it builds
+ SET_SOURCE_FILES_PROPERTIES(${ifiles} PROPERTIES CPLUSPLUS ON)
+
+ #setup the actual swig library target to be built
+ INCLUDE(UseSWIG)
+ SWIG_ADD_MODULE(${name} python ${ifiles})
+ SWIG_LINK_LIBRARIES(${name} ${PYTHON_LIBRARIES} ${GR_SWIG_LIBRARIES})
+ IF(GR_SWIG_TARGET_DEPS)
+ ADD_DEPENDENCIES(${SWIG_MODULE_${name}_REAL_NAME} ${GR_SWIG_TARGET_DEPS})
+ ENDIF(GR_SWIG_TARGET_DEPS)
+
+ENDMACRO(GR_SWIG_MAKE)
+
+########################################################################
+# Install swig targets generated by GR_SWIG_MAKE. Usage:
+# GR_SWIG_INSTALL(
+# TARGETS target target target...
+# [DESTINATION destination]
+# [COMPONENT component]
+# )
+########################################################################
+MACRO(GR_SWIG_INSTALL)
+
+ INCLUDE(CMakeParseArgumentsCopy)
+ CMAKE_PARSE_ARGUMENTS(GR_SWIG_INSTALL "" "DESTINATION;COMPONENT" "TARGETS" ${ARGN})
+
+ FOREACH(name ${GR_SWIG_INSTALL_TARGETS})
+ INSTALL(TARGETS ${SWIG_MODULE_${name}_REAL_NAME}
+ DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
+ COMPONENT ${GR_SWIG_INSTALL_COMPONENT}
+ )
+
+ INCLUDE(GrPython)
+ GR_PYTHON_INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}.py
+ DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
+ COMPONENT ${GR_SWIG_INSTALL_COMPONENT}
+ )
+ ENDFOREACH(name)
+
+ENDMACRO(GR_SWIG_INSTALL)
diff --git a/cmake/Modules/GrTest.cmake b/cmake/Modules/GrTest.cmake
new file mode 100644
index 000000000..e9e2a0c2e
--- /dev/null
+++ b/cmake/Modules/GrTest.cmake
@@ -0,0 +1,133 @@
+# Copyright 2010-2011 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+IF(DEFINED __INCLUDED_GR_TEST_CMAKE)
+ RETURN()
+ENDIF()
+SET(__INCLUDED_GR_TEST_CMAKE TRUE)
+
+########################################################################
+# Add a unit test and setup the environment for a unit test.
+# Takes the same arguments as the ADD_TEST function.
+#
+# Before calling set the following variables:
+# GR_TEST_TARGET_DEPS - built targets for the library path
+# GR_TEST_LIBRARY_DIRS - directories for the library path
+# GR_TEST_PYTHON_DIRS - directories for the python path
+########################################################################
+FUNCTION(GR_ADD_TEST test_name)
+
+ IF(WIN32)
+ #Ensure that the build exe also appears in the PATH.
+ LIST(APPEND GR_TEST_TARGET_DEPS ${ARGN})
+
+ #In the land of windows, all libraries must be in the PATH.
+ #Since the dependent libraries are not yet installed,
+ #we must manually set them in the PATH to run tests.
+ #The following appends the path of a target dependency.
+ FOREACH(target ${GR_TEST_TARGET_DEPS})
+ GET_TARGET_PROPERTY(location ${target} LOCATION)
+ IF(location)
+ GET_FILENAME_COMPONENT(path ${location} PATH)
+ STRING(REGEX REPLACE "\\$\\(.*\\)" ${CMAKE_BUILD_TYPE} path ${path})
+ LIST(APPEND GR_TEST_LIBRARY_DIRS ${path})
+ ENDIF(location)
+ ENDFOREACH(target)
+
+ #SWIG generates the python library files into a subdirectory.
+ #Therefore, we must append this subdirectory into PYTHONPATH.
+ #Only do this for the python directories matching the following:
+ FOREACH(pydir ${GR_TEST_PYTHON_DIRS})
+ GET_FILENAME_COMPONENT(name ${pydir} NAME)
+ IF(name MATCHES "^(swig|lib|src)$")
+ LIST(APPEND GR_TEST_PYTHON_DIRS ${pydir}/${CMAKE_BUILD_TYPE})
+ ENDIF()
+ ENDFOREACH(pydir)
+ ENDIF(WIN32)
+
+ FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} srcdir)
+ FILE(TO_NATIVE_PATH "${GR_TEST_LIBRARY_DIRS}" libpath) #ok to use on dir list?
+ FILE(TO_NATIVE_PATH "${GR_TEST_PYTHON_DIRS}" pypath) #ok to use on dir list?
+
+ SET(environs "GR_DONT_LOAD_PREFS=1" "srcdir=${srcdir}")
+
+ #http://www.cmake.org/pipermail/cmake/2009-May/029464.html
+ #Replaced this add test + set environs code with the shell script generation.
+ #Its nicer to be able to manually run the shell script to diagnose problems.
+ #ADD_TEST(${ARGV})
+ #SET_TESTS_PROPERTIES(${test_name} PROPERTIES ENVIRONMENT "${environs}")
+
+ IF(UNIX)
+ SET(binpath "${CMAKE_CURRENT_BINARY_DIR}:$PATH")
+ #set both LD and DYLD paths to cover multiple UNIX OS library paths
+ LIST(APPEND libpath "$LD_LIBRARY_PATH" "$DYLD_LIBRARY_PATH")
+ LIST(APPEND pypath "$PYTHONPATH")
+
+ #replace list separator with the path separator
+ STRING(REPLACE ";" ":" libpath "${libpath}")
+ STRING(REPLACE ";" ":" pypath "${pypath}")
+ LIST(APPEND environs "PATH=${binpath}" "LD_LIBRARY_PATH=${libpath}" "DYLD_LIBRARY_PATH=${libpath}" "PYTHONPATH=${pypath}")
+
+ #generate a bat file that sets the environment and runs the test
+ FIND_PROGRAM(SHELL sh)
+ SET(sh_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.sh)
+ FILE(WRITE ${sh_file} "#!${SHELL}\n")
+ #each line sets an environment variable
+ FOREACH(environ ${environs})
+ FILE(APPEND ${sh_file} "export ${environ}\n")
+ ENDFOREACH(environ)
+ #load the command to run with its arguments
+ FOREACH(arg ${ARGN})
+ FILE(APPEND ${sh_file} "${arg} ")
+ ENDFOREACH(arg)
+ FILE(APPEND ${sh_file} "\n")
+
+ #make the shell file executable
+ EXECUTE_PROCESS(COMMAND chmod +x ${sh_file})
+
+ ADD_TEST(${test_name} ${SHELL} ${sh_file})
+
+ ENDIF(UNIX)
+
+ IF(WIN32)
+ LIST(APPEND libpath ${DLL_PATHS} "%PATH%")
+ LIST(APPEND pypath "%PYTHONPATH%")
+
+ #replace list separator with the path separator (escaped)
+ STRING(REPLACE ";" "\\;" libpath "${libpath}")
+ STRING(REPLACE ";" "\\;" pypath "${pypath}")
+ LIST(APPEND environs "PATH=${libpath}" "PYTHONPATH=${pypath}")
+
+ #generate a bat file that sets the environment and runs the test
+ SET(bat_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.bat)
+ FILE(WRITE ${bat_file} "@echo off\n")
+ #each line sets an environment variable
+ FOREACH(environ ${environs})
+ FILE(APPEND ${bat_file} "SET ${environ}\n")
+ ENDFOREACH(environ)
+ #load the command to run with its arguments
+ FOREACH(arg ${ARGN})
+ FILE(APPEND ${bat_file} "${arg} ")
+ ENDFOREACH(arg)
+ FILE(APPEND ${bat_file} "\n")
+
+ ADD_TEST(${test_name} ${bat_file})
+ ENDIF(WIN32)
+
+ENDFUNCTION(GR_ADD_TEST)
diff --git a/cmake/Modules/GrVersion.cmake b/cmake/Modules/GrVersion.cmake
new file mode 100644
index 000000000..ab2959c0d
--- /dev/null
+++ b/cmake/Modules/GrVersion.cmake
@@ -0,0 +1,73 @@
+# Copyright 2011 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+IF(DEFINED __INCLUDED_GR_VERSION_CMAKE)
+ RETURN()
+ENDIF()
+SET(__INCLUDED_GR_VERSION_CMAKE TRUE)
+
+########################################################################
+# Setup version variables.
+# Parse the output of git describe
+# sets VERSION and LIBVER
+########################################################################
+
+UNSET(VERSION)
+UNSET(LIBVER)
+
+########################################################################
+# Extract the version string from git describe.
+########################################################################
+FIND_PACKAGE(Git)
+IF(GIT_FOUND)
+ MESSAGE(STATUS "Extracting version information from git...")
+ EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} describe
+ OUTPUT_VARIABLE VERSION OUTPUT_STRIP_TRAILING_WHITESPACE
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ )
+ IF(NOT VERSION)
+ MESSAGE(WARNING "Tried to extract $VERSION from git describe but failed... using default")
+ ENDIF()
+ENDIF(GIT_FOUND)
+
+########################################################################
+# Extract the library version from the version string.
+########################################################################
+IF(VERSION)
+ INCLUDE(GrPython)
+ EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import re; print re.match('^v(\\d+\\.\\d+\\.\\d+)', '${VERSION}').groups()[0]"
+ OUTPUT_VARIABLE LIBVER OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ IF(NOT LIBVER)
+ MESSAGE(WARNING "Tried to extract $LIBVER from $VERSION but failed... using default")
+ ENDIF()
+ENDIF()
+
+########################################################################
+# Ensure that the version strings are set no matter what.
+########################################################################
+IF(NOT VERSION)
+ SET(VERSION "v3.x.x-unknown")
+ENDIF()
+
+IF(NOT LIBVER)
+ SET(LIBVER "3.x.x")
+ENDIF()
+
+MESSAGE(STATUS "VERSION: ${VERSION}, LIBVER: ${LIBVER}")
diff --git a/cmake/Modules/LibFindMacros.cmake b/cmake/Modules/LibFindMacros.cmake
new file mode 100644
index 000000000..69975c51b
--- /dev/null
+++ b/cmake/Modules/LibFindMacros.cmake
@@ -0,0 +1,99 @@
+# Works the same as find_package, but forwards the "REQUIRED" and "QUIET" arguments
+# used for the current package. For this to work, the first parameter must be the
+# prefix of the current package, then the prefix of the new package etc, which are
+# passed to find_package.
+macro (libfind_package PREFIX)
+ set (LIBFIND_PACKAGE_ARGS ${ARGN})
+ if (${PREFIX}_FIND_QUIETLY)
+ set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} QUIET)
+ endif (${PREFIX}_FIND_QUIETLY)
+ if (${PREFIX}_FIND_REQUIRED)
+ set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} REQUIRED)
+ endif (${PREFIX}_FIND_REQUIRED)
+ find_package(${LIBFIND_PACKAGE_ARGS})
+endmacro (libfind_package)
+
+# CMake developers made the UsePkgConfig system deprecated in the same release (2.6)
+# where they added pkg_check_modules. Consequently I need to support both in my scripts
+# to avoid those deprecated warnings. Here's a helper that does just that.
+# Works identically to pkg_check_modules, except that no checks are needed prior to use.
+macro (libfind_pkg_check_modules PREFIX PKGNAME)
+ if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+ include(UsePkgConfig)
+ pkgconfig(${PKGNAME} ${PREFIX}_INCLUDE_DIRS ${PREFIX}_LIBRARY_DIRS ${PREFIX}_LDFLAGS ${PREFIX}_CFLAGS)
+ else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+ find_package(PkgConfig)
+ if (PKG_CONFIG_FOUND)
+ pkg_check_modules(${PREFIX} ${PKGNAME})
+ endif (PKG_CONFIG_FOUND)
+ endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+endmacro (libfind_pkg_check_modules)
+
+# Do the final processing once the paths have been detected.
+# If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain
+# all the variables, each of which contain one include directory.
+# Ditto for ${PREFIX}_PROCESS_LIBS and library files.
+# Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES.
+# Also handles errors in case library detection was required, etc.
+macro (libfind_process PREFIX)
+ # Skip processing if already processed during this run
+ if (NOT ${PREFIX}_FOUND)
+ # Start with the assumption that the library was found
+ set (${PREFIX}_FOUND TRUE)
+
+ # Process all includes and set _FOUND to false if any are missing
+ foreach (i ${${PREFIX}_PROCESS_INCLUDES})
+ if (${i})
+ set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIRS} ${${i}})
+ mark_as_advanced(${i})
+ else (${i})
+ set (${PREFIX}_FOUND FALSE)
+ endif (${i})
+ endforeach (i)
+
+ # Process all libraries and set _FOUND to false if any are missing
+ foreach (i ${${PREFIX}_PROCESS_LIBS})
+ if (${i})
+ set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARIES} ${${i}})
+ mark_as_advanced(${i})
+ else (${i})
+ set (${PREFIX}_FOUND FALSE)
+ endif (${i})
+ endforeach (i)
+
+ # Print message and/or exit on fatal error
+ if (${PREFIX}_FOUND)
+ if (NOT ${PREFIX}_FIND_QUIETLY)
+ message (STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}")
+ endif (NOT ${PREFIX}_FIND_QUIETLY)
+ else (${PREFIX}_FOUND)
+ if (${PREFIX}_FIND_REQUIRED)
+ foreach (i ${${PREFIX}_PROCESS_INCLUDES} ${${PREFIX}_PROCESS_LIBS})
+ message("${i}=${${i}}")
+ endforeach (i)
+ message (FATAL_ERROR "Required library ${PREFIX} NOT FOUND.\nInstall the library (dev version) and try again. If the library is already installed, use ccmake to set the missing variables manually.")
+ endif (${PREFIX}_FIND_REQUIRED)
+ endif (${PREFIX}_FOUND)
+ endif (NOT ${PREFIX}_FOUND)
+endmacro (libfind_process)
+
+macro(libfind_library PREFIX basename)
+ set(TMP "")
+ if(MSVC80)
+ set(TMP -vc80)
+ endif(MSVC80)
+ if(MSVC90)
+ set(TMP -vc90)
+ endif(MSVC90)
+ set(${PREFIX}_LIBNAMES ${basename}${TMP})
+ if(${ARGC} GREATER 2)
+ set(${PREFIX}_LIBNAMES ${basename}${TMP}-${ARGV2})
+ string(REGEX REPLACE "\\." "_" TMP ${${PREFIX}_LIBNAMES})
+ set(${PREFIX}_LIBNAMES ${${PREFIX}_LIBNAMES} ${TMP})
+ endif(${ARGC} GREATER 2)
+ find_library(${PREFIX}_LIBRARY
+ NAMES ${${PREFIX}_LIBNAMES}
+ PATHS ${${PREFIX}_PKGCONF_LIBRARY_DIRS}
+ )
+endmacro(libfind_library)
+