summaryrefslogtreecommitdiffstats
path: root/contrib/cmake/FindMILES.cmake
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-03-22 14:51:52 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-03-22 14:51:52 (GMT)
commitab94ab804aab3d9171cebee4252f533968c7e0ff (patch)
tree714ac1c5c9a52bfcd74a6ac36d0a113b3d350286 /contrib/cmake/FindMILES.cmake
parent973a3a9d26ba8205405917c9944e9ab5e28a1e45 (diff)
downloaduscxml-ab94ab804aab3d9171cebee4252f533968c7e0ff.zip
uscxml-ab94ab804aab3d9171cebee4252f533968c7e0ff.tar.gz
uscxml-ab94ab804aab3d9171cebee4252f533968c7e0ff.tar.bz2
Fixed FindMILES issue
Diffstat (limited to 'contrib/cmake/FindMILES.cmake')
-rw-r--r--contrib/cmake/FindMILES.cmake157
1 files changed, 157 insertions, 0 deletions
diff --git a/contrib/cmake/FindMILES.cmake b/contrib/cmake/FindMILES.cmake
new file mode 100644
index 0000000..f86e695
--- /dev/null
+++ b/contrib/cmake/FindMILES.cmake
@@ -0,0 +1,157 @@
+# - Find Miles
+# This module checks if Miles is installed and determines where the
+# include files and libraries are. This code sets the following
+# variables:
+#
+# MILES_INCLUDE_DIR = The full path to the miles headers
+# MILES_LIBRARIES = All miles libraries for release and debug builds
+#
+# Example:
+# find_package(MILES REQUIRED audio network)
+# include_directories(${MILES_INCLUDE_DIR})
+#
+
+# is this a 64Bit host?
+# if (NOT APPLE)
+# if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+# set(_MILES_64BIT_LIB_POSTFIX 64)
+# else()
+# set(_MILES_64BIT_LIB_POSTFIX "")
+# endif()
+# endif()
+
+###################################################
+# where to search for miles headers and libraries
+###################################################
+set(_MILES_LIB_SEARCHPATH
+ "/usr/local"
+ "/opt/local"
+ "C:/Program Files (x86)/miles"
+ "C:/Program Files/miles"
+)
+
+###################################################
+# get a list of components the user requested
+###################################################
+set(_MILES_COMPONENTS_TO_PROCESS)
+foreach(_MILES_COMPONENT ${MILES_FIND_COMPONENTS})
+ STRING(TOUPPER ${_MILES_COMPONENT} _MILES_COMPONENT_UC)
+ list(APPEND _MILES_COMPONENTS_TO_PROCESS ${_MILES_COMPONENT_UC})
+endforeach()
+list(APPEND _MILES_COMPONENTS_TO_PROCESS "CORE")
+list(REMOVE_DUPLICATES _MILES_COMPONENTS_TO_PROCESS)
+
+###################################################
+# find the miles header files
+###################################################
+FIND_PATH(MILES_INCLUDE_DIR miles/miles.h
+ PATH_SUFFIXES include
+ PATHS ${_MILES_LIB_SEARCHPATH}
+ ENV MILES_INCLUDE_DIR
+)
+
+###################################################
+# iterate components and try to find libraries
+# in debug and release configuration. For release
+# we prefer MinSizeRel, for debug we prefer
+# RelWithDebInfo.
+###################################################
+SET(MILES_LIBRARIES)
+
+list(LENGTH MILES_FIND_COMPONENTS MILES_NR_COMPONENTS)
+if (MILES_NR_COMPONENTS GREATER 0)
+ foreach (_MILES_COMPONENT ${_MILES_COMPONENTS_TO_PROCESS})
+ SET(_CURR_COMPONENT "MILES_${_MILES_COMPONENT}_LIBRARY")
+ STRING(TOLOWER ${_MILES_COMPONENT}${_MILES_64BIT_LIB_POSTFIX} _MILES_COMPONENT_LC)
+
+ # prefer MinSizeRel libraries
+ FIND_LIBRARY(${_CURR_COMPONENT}
+ PATH_SUFFIXES lib
+ NAMES miles_${_MILES_COMPONENT_LC}_s
+ PATHS ${_MILES_LIB_SEARCHPATH}
+ ENV MILES_LIB_DIR
+ )
+ if (${_CURR_COMPONENT})
+ list(APPEND MILES_LIBRARIES optimized ${${_CURR_COMPONENT}})
+ else()
+ # if no minsize libraries were found try normal release
+ FIND_LIBRARY(${_CURR_COMPONENT}
+ PATH_SUFFIXES lib
+ NAMES miles_${_MILES_COMPONENT_LC}
+ PATHS ${_MILES_LIB_SEARCHPATH}
+ ENV MILES_LIB_DIR
+ )
+ if (${_CURR_COMPONENT})
+ list(APPEND MILES_LIBRARIES optimized ${${_CURR_COMPONENT}})
+ endif()
+ endif()
+
+ # prefer RelWithDebInfo libraries
+ FIND_LIBRARY(${_CURR_COMPONENT}_DEBUG
+ PATH_SUFFIXES lib
+ NAMES miles_${_MILES_COMPONENT_LC}_rd
+ PATHS ${_MILES_LIB_SEARCHPATH}
+ ENV MILES_LIB_DIR
+ )
+ if (${_CURR_COMPONENT}_DEBUG)
+ list(APPEND MILES_LIBRARIES debug ${${_CURR_COMPONENT}_DEBUG})
+ else()
+ FIND_LIBRARY(${_CURR_COMPONENT}_DEBUG
+ PATH_SUFFIXES lib
+ NAMES miles_${_MILES_COMPONENT_LC}_d
+ PATHS ${_MILES_LIB_SEARCHPATH}
+ ENV MILES_LIB_DIR
+ )
+ if (${_CURR_COMPONENT}_DEBUG)
+ list(APPEND MILES_LIBRARIES debug ${${_CURR_COMPONENT}_DEBUG})
+ endif()
+ endif()
+ endforeach()
+else()
+ FIND_LIBRARY(MILES_RELEASE
+ PATH_SUFFIXES lib
+ NAMES miles_s
+ PATHS ${_MILES_LIB_SEARCHPATH}
+ ENV MILES_LIB_DIR
+ )
+ if (MILES_RELEASE)
+ list(APPEND MILES_LIBRARIES optimized ${MILES_RELEASE})
+ else()
+ # if no minsize libraries were found try normal release
+ FIND_LIBRARY(MILES_RELEASE
+ PATH_SUFFIXES lib
+ NAMES miles
+ PATHS ${_MILES_LIB_SEARCHPATH}
+ ENV MILES_LIB_DIR
+ )
+ if (MILES_RELEASE)
+ list(APPEND MILES_LIBRARIES optimized ${MILES_RELEASE})
+ endif()
+ endif()
+
+ # prefer RelWithDebInfo libraries
+ FIND_LIBRARY(MILES_DEBUG
+ PATH_SUFFIXES lib
+ NAMES miles_rd
+ PATHS ${_MILES_LIB_SEARCHPATH}
+ ENV MILES_LIB_DIR
+ )
+ if (MILES_DEBUG)
+ list(APPEND MILES_LIBRARIES debug ${MILES_DEBUG})
+ else()
+ FIND_LIBRARY(MILES_DEBUG
+ PATH_SUFFIXES lib
+ NAMES miles_d
+ PATHS ${_MILES_LIB_SEARCHPATH}
+ ENV MILES_LIB_DIR
+ )
+ if (MILES_DEBUG)
+ list(APPEND MILES_LIBRARIES debug ${MILES_DEBUG})
+ endif()
+ endif()
+
+endif()
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(MILES DEFAULT_MSG MILES_LIBRARIES MILES_INCLUDE_DIR)
+MARK_AS_ADVANCED(MILES_INCLUDE_DIR MILES_LIBRARIES)