summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/GrBoost.cmake42
-rw-r--r--cmake/Modules/GrComponent.cmake96
-rw-r--r--cmake/Modules/GrMiscUtils.cmake54
-rw-r--r--cmake/Modules/GrPackage.cmake112
-rw-r--r--cmake/Modules/GrPlatform.cmake34
-rw-r--r--cmake/Modules/GrPython.cmake146
-rw-r--r--cmake/Modules/GrSwig.cmake60
-rw-r--r--cmake/Modules/GrTest.cmake138
-rw-r--r--cmake/Modules/GrVersion.cmake56
9 files changed, 369 insertions, 369 deletions
diff --git a/cmake/Modules/GrBoost.cmake b/cmake/Modules/GrBoost.cmake
index 4e515152d..36890014d 100644
--- a/cmake/Modules/GrBoost.cmake
+++ b/cmake/Modules/GrBoost.cmake
@@ -17,16 +17,16 @@
# 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)
+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
+set(BOOST_REQUIRED_COMPONENTS
date_time
program_options
filesystem
@@ -34,23 +34,23 @@ SET(BOOST_REQUIRED_COMPONENTS
thread
)
-IF(UNIX AND EXISTS "/usr/lib64")
- LIST(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
-ENDIF(UNIX AND EXISTS "/usr/lib64")
+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)
+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
+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"
@@ -59,4 +59,4 @@ SET(Boost_ADDITIONAL_VERSIONS
"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})
+find_package(Boost "1.35" COMPONENTS ${BOOST_REQUIRED_COMPONENTS})
diff --git a/cmake/Modules/GrComponent.cmake b/cmake/Modules/GrComponent.cmake
index cbae1c4ff..876ec0baa 100644
--- a/cmake/Modules/GrComponent.cmake
+++ b/cmake/Modules/GrComponent.cmake
@@ -17,20 +17,20 @@
# 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)
+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)
+set(_gr_enabled_components "" CACHE INTERNAL "" FORCE)
+set(_gr_disabled_components "" CACHE INTERNAL "" FORCE)
-IF(NOT DEFINED ENABLE_DEFAULT)
- SET(ENABLE_DEFAULT ON)
- MESSAGE(STATUS "")
- MESSAGE(STATUS "The build system will automatically enable all components.")
- MESSAGE(STATUS "Use -DENABLE_DEFAULT=OFF to disable components by default.")
-ENDIF()
+if(NOT DEFINED ENABLE_DEFAULT)
+ set(ENABLE_DEFAULT ON)
+ message(STATUS "")
+ message(STATUS "The build system will automatically enable all components.")
+ message(STATUS "Use -DENABLE_DEFAULT=OFF to disable components by default.")
+endif()
########################################################################
# Register a component into the system
@@ -38,52 +38,52 @@ ENDIF()
# - 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)
+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" ${ENABLE_DEFAULT} "${ARGN}" OFF)
- SET(${var}_ "${${var}}" CACHE INTERNAL "" FORCE)
+ 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")
+ 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)
+ 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)
+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 "")
+ 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)
+ message(STATUS "")
+endfunction(GR_PRINT_COMPONENT_SUMMARY)
diff --git a/cmake/Modules/GrMiscUtils.cmake b/cmake/Modules/GrMiscUtils.cmake
index c36c509b5..871861e35 100644
--- a/cmake/Modules/GrMiscUtils.cmake
+++ b/cmake/Modules/GrMiscUtils.cmake
@@ -17,40 +17,40 @@
# 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)
+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)
+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)
+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)
+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)
+endfunction(GR_CHECK_HDR_N_DEF)
########################################################################
# Include subdirectory macro.
@@ -63,24 +63,24 @@ ENDFUNCTION(GR_CHECK_HDR_N_DEF)
# 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)
+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})
+ 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})
+ 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)
+ 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)
+ 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)
+ 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
index 2fc9fc08a..857d07c4d 100644
--- a/cmake/Modules/GrPackage.cmake
+++ b/cmake/Modules/GrPackage.cmake
@@ -17,49 +17,49 @@
# 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)
+if(DEFINED __INCLUDED_GR_PACKAGE_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_PACKAGE_CMAKE TRUE)
-INCLUDE(GrVersion) #sets version information
-INCLUDE(GrPlatform) #sets platform information
+include(GrVersion) #sets version information
+include(GrPlatform) #sets platform information
#set the cpack generator based on the platform type
-IF(CPACK_GENERATOR)
+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()
+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)
+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)
+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
@@ -72,40 +72,40 @@ ENDFUNCTION(CPACK_FINALIZE)
# [DEPENDS depends]
# )
########################################################################
-FUNCTION(CPACK_COMPONENT name)
- INCLUDE(CMakeParseArgumentsCopy)
- SET(_options GROUP DISPLAY_NAME DESCRIPTION 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})
+ 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)
+ endif()
+ endforeach(_option)
CPACK_SET(CPACK_COMPONENTS_ALL "${CPACK_COMPONENTS_ALL};${name}")
-ENDFUNCTION(CPACK_COMPONENT)
+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()
+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
+set(CPACK_DEBIAN_PACKAGE_DEPENDS
"libboost-all-dev"
"libfftw3-3"
"python"
@@ -118,17 +118,17 @@ SET(CPACK_DEBIAN_PACKAGE_DEPENDS
"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)
+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
+set(CPACK_RPM_PACKAGE_REQUIRES "boost-devel") #TODO other packages
########################################################################
# NSIS package specific
########################################################################
-SET(CPACK_NSIS_MODIFY_PATH ON)
+set(CPACK_NSIS_MODIFY_PATH ON)
-SET(HLKM_ENV "\\\"SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment\\\"")
+set(HLKM_ENV "\\\"SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment\\\"")
diff --git a/cmake/Modules/GrPlatform.cmake b/cmake/Modules/GrPlatform.cmake
index 85f318618..ce2e15fef 100644
--- a/cmake/Modules/GrPlatform.cmake
+++ b/cmake/Modules/GrPlatform.cmake
@@ -17,30 +17,30 @@
# 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)
+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(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/debian_version")
+ set(DEBIAN TRUE)
+endif()
-IF(LINUX AND EXISTS "/etc/redhat-release")
- SET(REDHAT 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")
+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
index b33c2fe62..51cd4bfb0 100644
--- a/cmake/Modules/GrPython.cmake
+++ b/cmake/Modules/GrPython.cmake
@@ -17,10 +17,10 @@
# 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)
+if(DEFINED __INCLUDED_GR_PYTHON_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_PYTHON_CMAKE TRUE)
########################################################################
# Setup the python interpreter:
@@ -28,40 +28,40 @@ SET(__INCLUDED_GR_PYTHON_CMAKE TRUE)
# or finds the interpreter via the built-in cmake module.
########################################################################
#this allows the user to override PYTHON_EXECUTABLE
-IF(PYTHON_EXECUTABLE)
+if(PYTHON_EXECUTABLE)
- SET(PYTHONINTERP_FOUND TRUE)
+ set(PYTHONINTERP_FOUND TRUE)
#otherwise if not set, try to automatically find it
-ELSE(PYTHON_EXECUTABLE)
+else(PYTHON_EXECUTABLE)
#use the built-in find script
- FIND_PACKAGE(PythonInterp)
+ 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)
+ 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)
+endif(PYTHON_EXECUTABLE)
#make the path to the executable appear in the cmake gui
-SET(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter")
+set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter")
#make sure we can use -B with python (introduced in 2.6)
-IF(PYTHON_EXECUTABLE)
- EXECUTE_PROCESS(
+if(PYTHON_EXECUTABLE)
+ execute_process(
COMMAND ${PYTHON_EXECUTABLE} -B -c ""
OUTPUT_QUIET ERROR_QUIET
RESULT_VARIABLE PYTHON_HAS_DASH_B_RESULT
)
- IF(PYTHON_HAS_DASH_B_RESULT EQUAL 0)
- SET(PYTHON_DASH_B "-B")
- ENDIF()
-ENDIF(PYTHON_EXECUTABLE)
+ if(PYTHON_HAS_DASH_B_RESULT EQUAL 0)
+ set(PYTHON_DASH_B "-B")
+ endif()
+endif(PYTHON_EXECUTABLE)
########################################################################
# Check for the existence of a python module:
@@ -70,10 +70,10 @@ ENDIF(PYTHON_EXECUTABLE)
# - 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(
+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}
@@ -83,87 +83,87 @@ 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)
+ 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 "
+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)
+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
+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)
+ 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)
+function(GR_PYTHON_INSTALL)
+ include(CMakeParseArgumentsCopy)
CMAKE_PARSE_ARGUMENTS(GR_PYTHON_INSTALL "" "DESTINATION;COMPONENT" "FILES;PROGRAMS" ${ARGN})
####################################################################
- IF(GR_PYTHON_INSTALL_FILES)
+ if(GR_PYTHON_INSTALL_FILES)
####################################################################
- INSTALL(${ARGN}) #installs regular python 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})
+ 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})
+ 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(
+ 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}
+ install(FILES ${pycfile}
DESTINATION ${GR_PYTHON_INSTALL_DESTINATION}
COMPONENT ${GR_PYTHON_INSTALL_COMPONENT}
)
- ENDFOREACH(pyfile)
+ endforeach(pyfile)
####################################################################
- ELSEIF(GR_PYTHON_INSTALL_PROGRAMS)
+ elseif(GR_PYTHON_INSTALL_PROGRAMS)
####################################################################
- FILE(TO_NATIVE_PATH ${PYTHON_EXECUTABLE} pyexe_native)
+ 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})
+ 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})
+ get_filename_component(pyexefile_path ${pyexefile} PATH)
+ file(MAKE_DIRECTORY ${pyexefile_path})
- ADD_CUSTOM_COMMAND(
+ add_custom_command(
OUTPUT ${pyexefile} DEPENDS ${pyfile}
COMMAND ${PYTHON_EXECUTABLE} -c
\"open('${pyexefile}', 'w').write('\#!${pyexe_native}\\n'+open('${pyfile}').read())\"
@@ -171,19 +171,19 @@ FUNCTION(GR_PYTHON_INSTALL)
)
#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()
+ 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}
+ install(PROGRAMS ${pyexefile} RENAME ${pyfile_name}
DESTINATION ${GR_PYTHON_INSTALL_DESTINATION}
COMPONENT ${GR_PYTHON_INSTALL_COMPONENT}
)
- ENDFOREACH(pyfile)
+ endforeach(pyfile)
- ENDIF()
+ endif()
GR_UNIQUE_TARGET("pygen" ${python_install_gen_targets})
-ENDFUNCTION(GR_PYTHON_INSTALL)
+endfunction(GR_PYTHON_INSTALL)
diff --git a/cmake/Modules/GrSwig.cmake b/cmake/Modules/GrSwig.cmake
index 0d4cce2b3..0fa1c7b77 100644
--- a/cmake/Modules/GrSwig.cmake
+++ b/cmake/Modules/GrSwig.cmake
@@ -17,12 +17,12 @@
# 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)
+if(DEFINED __INCLUDED_GR_SWIG_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_SWIG_CMAKE TRUE)
-INCLUDE(GrPython)
+include(GrPython)
########################################################################
# Build a swig target for the common gnuradio use case. Usage:
@@ -35,11 +35,11 @@ INCLUDE(GrPython)
# - GR_SWIG_SOURCE_DEPS
# - GR_SWIG_TARGET_DEPS
########################################################################
-MACRO(GR_SWIG_MAKE name)
- SET(ifiles ${ARGN})
+macro(GR_SWIG_MAKE name)
+ set(ifiles ${ARGN})
#determine include dependencies for swig file
- EXECUTE_PROCESS(
+ execute_process(
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/get_swig_deps.py
"${ifiles}" "${GR_SWIG_INCLUDE_DIRS}"
OUTPUT_STRIP_TRAILING_WHITESPACE
@@ -48,30 +48,30 @@ MACRO(GR_SWIG_MAKE name)
)
#append the specified include directories
- INCLUDE_DIRECTORIES(${GR_SWIG_INCLUDE_DIRS})
- LIST(APPEND SWIG_MODULE_${name}_EXTRA_DEPS ${GR_SWIG_SOURCE_DEPS})
+ include_directories(${GR_SWIG_INCLUDE_DIRS})
+ list(APPEND SWIG_MODULE_${name}_EXTRA_DEPS ${GR_SWIG_SOURCE_DEPS})
- FIND_PACKAGE(PythonLibs)
- INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS})
+ 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(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)
+ set_source_files_properties(${ifiles} PROPERTIES CPLUSPLUS ON)
#setup the actual swig library target to be built
- INCLUDE(UseSWIG)
+ 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)
+ 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)
+endmacro(GR_SWIG_MAKE)
########################################################################
# Install swig targets generated by GR_SWIG_MAKE. Usage:
@@ -81,25 +81,25 @@ ENDMACRO(GR_SWIG_MAKE)
# [COMPONENT component]
# )
########################################################################
-MACRO(GR_SWIG_INSTALL)
+macro(GR_SWIG_INSTALL)
- INCLUDE(CMakeParseArgumentsCopy)
+ 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}
+ 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)
+ include(GrPython)
GR_PYTHON_INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}.py
DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
COMPONENT ${GR_SWIG_INSTALL_COMPONENT}
)
- ENDFOREACH(name)
+ endforeach(name)
-ENDMACRO(GR_SWIG_INSTALL)
+endmacro(GR_SWIG_INSTALL)
########################################################################
# Generate a python file that can determine swig dependencies.
@@ -107,7 +107,7 @@ ENDMACRO(GR_SWIG_INSTALL)
# When you build C++, CMake figures out the header dependencies.
# This code essentially performs that logic for swig includes.
########################################################################
-FILE(WRITE ${CMAKE_BINARY_DIR}/get_swig_deps.py "
+file(WRITE ${CMAKE_BINARY_DIR}/get_swig_deps.py "
import os, sys, re
diff --git a/cmake/Modules/GrTest.cmake b/cmake/Modules/GrTest.cmake
index 8a73de3ce..bbb525dcc 100644
--- a/cmake/Modules/GrTest.cmake
+++ b/cmake/Modules/GrTest.cmake
@@ -17,10 +17,10 @@
# 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)
+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.
@@ -31,41 +31,41 @@ SET(__INCLUDED_GR_TEST_CMAKE TRUE)
# GR_TEST_LIBRARY_DIRS - directories for the library path
# GR_TEST_PYTHON_DIRS - directories for the python path
########################################################################
-FUNCTION(GR_ADD_TEST test_name)
+function(GR_ADD_TEST test_name)
#Ensure that the build exe also appears in the PATH.
- LIST(APPEND GR_TEST_TARGET_DEPS ${ARGN})
+ 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)
-
- IF(WIN32)
+ 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)
+
+ if(WIN32)
#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)
+ 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?
+ 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}")
+ 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.
@@ -73,65 +73,65 @@ FUNCTION(GR_ADD_TEST test_name)
#ADD_TEST(${ARGV})
#SET_TESTS_PROPERTIES(${test_name} PROPERTIES ENVIRONMENT "${environs}")
- IF(UNIX)
- SET(LD_PATH_VAR "LD_LIBRARY_PATH")
- IF(APPLE)
- SET(LD_PATH_VAR "DYLD_LIBRARY_PATH")
- ENDIF()
+ if(UNIX)
+ set(LD_PATH_VAR "LD_LIBRARY_PATH")
+ if(APPLE)
+ set(LD_PATH_VAR "DYLD_LIBRARY_PATH")
+ endif()
- SET(binpath "${CMAKE_CURRENT_BINARY_DIR}:$PATH")
- LIST(APPEND libpath "$${LD_PATH_VAR}")
- LIST(APPEND pypath "$PYTHONPATH")
+ set(binpath "${CMAKE_CURRENT_BINARY_DIR}:$PATH")
+ list(APPEND libpath "$${LD_PATH_VAR}")
+ 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_PATH_VAR}=${libpath}" "PYTHONPATH=${pypath}")
+ string(REPLACE ";" ":" libpath "${libpath}")
+ string(REPLACE ";" ":" pypath "${pypath}")
+ list(APPEND environs "PATH=${binpath}" "${LD_PATH_VAR}=${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")
+ 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)
+ 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")
+ 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})
+ execute_process(COMMAND chmod +x ${sh_file})
- ADD_TEST(${test_name} ${SHELL} ${sh_file})
+ add_test(${test_name} ${SHELL} ${sh_file})
- ENDIF(UNIX)
+ endif(UNIX)
- IF(WIN32)
- LIST(APPEND libpath ${DLL_PATHS} "%PATH%")
- LIST(APPEND pypath "%PYTHONPATH%")
+ 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}")
+ 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")
+ 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)
+ 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")
+ foreach(arg ${ARGN})
+ file(APPEND ${bat_file} "${arg} ")
+ endforeach(arg)
+ file(APPEND ${bat_file} "\n")
- ADD_TEST(${test_name} ${bat_file})
- ENDIF(WIN32)
+ add_test(${test_name} ${bat_file})
+ endif(WIN32)
-ENDFUNCTION(GR_ADD_TEST)
+endfunction(GR_ADD_TEST)
diff --git a/cmake/Modules/GrVersion.cmake b/cmake/Modules/GrVersion.cmake
index ab2959c0d..842537f18 100644
--- a/cmake/Modules/GrVersion.cmake
+++ b/cmake/Modules/GrVersion.cmake
@@ -17,10 +17,10 @@
# 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)
+if(DEFINED __INCLUDED_GR_VERSION_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_VERSION_CMAKE TRUE)
########################################################################
# Setup version variables.
@@ -28,46 +28,46 @@ SET(__INCLUDED_GR_VERSION_CMAKE TRUE)
# sets VERSION and LIBVER
########################################################################
-UNSET(VERSION)
-UNSET(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
+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)
+ 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]"
+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()
+ 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 VERSION)
+ set(VERSION "v3.x.x-unknown")
+endif()
-IF(NOT LIBVER)
- SET(LIBVER "3.x.x")
-ENDIF()
+if(NOT LIBVER)
+ set(LIBVER "3.x.x")
+endif()
-MESSAGE(STATUS "VERSION: ${VERSION}, LIBVER: ${LIBVER}")
+message(STATUS "VERSION: ${VERSION}, LIBVER: ${LIBVER}")