Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • danc/MicroCART
  • snawerdt/MicroCART_17-18
  • bbartels/MicroCART_17-18
  • jonahu/MicroCART
4 results
Show changes
Showing
with 0 additions and 1886 deletions
# - try to find VRPN library
#
# Cache Variables:
# VRPN_LIBRARY
# VRPN_SERVER_LIBRARY
# VRPN_INCLUDE_DIR
#
# Non-cache variables you might use in your CMakeLists.txt:
# VRPN_FOUND
# VRPN_SERVER_LIBRARIES - server libraries
# VRPN_LIBRARIES - client libraries
# VRPN_CLIENT_DEFINITIONS - definitions if you only use the client library
# VRPN_DEFINITIONS - Client-only definition if all we found was the client library.
# VRPN_INCLUDE_DIRS
#
# VRPN_ROOT_DIR is searched preferentially for these files
#
# Requires these CMake modules:
# FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
#
# Original Author:
# 2009-2012 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2012.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
set(VRPN_ROOT_DIR
"${VRPN_ROOT_DIR}"
CACHE
PATH
"Root directory to search for VRPN")
if("${CMAKE_SIZEOF_VOID_P}" MATCHES "8")
set(_libsuffixes lib64 lib)
# 64-bit dir: only set on win64
file(TO_CMAKE_PATH "$ENV{ProgramW6432}" _progfiles)
else()
set(_libsuffixes lib)
if(NOT "$ENV{ProgramFiles(x86)}" STREQUAL "")
# 32-bit dir: only set on win64
file(TO_CMAKE_PATH "$ENV{ProgramFiles(x86)}" _progfiles)
else()
# 32-bit dir on win32, useless to us on win64
file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _progfiles)
endif()
endif()
###
# Configure VRPN
###
find_path(VRPN_INCLUDE_DIR
NAMES
vrpn_Connection.h
PATH_SUFFIXES
include
include/vrpn
HINTS
"${VRPN_ROOT_DIR}"
PATHS
"${_progfiles}/VRPN"
C:/usr/local
/usr/local)
find_library(VRPN_LIBRARY
NAMES
vrpn
PATH_SUFFIXES
${_libsuffixes}
HINTS
"${VRPN_ROOT_DIR}"
PATHS
"${_progfiles}/VRPN"
C:/usr/local
/usr/local)
find_library(VRPN_SERVER_LIBRARY
NAMES
vrpnserver
PATH_SUFFIXES
${_libsuffixes}
HINTS
"${VRPN_ROOT_DIR}"
PATHS
"${_progfiles}/VRPN"
C:/usr/local
/usr/local)
###
# Dependencies
###
set(_deps_libs)
set(_deps_includes)
set(_deps_check)
find_package(quatlib)
list(APPEND _deps_libs ${QUATLIB_LIBRARIES})
list(APPEND _deps_includes ${QUATLIB_INCLUDE_DIRS})
list(APPEND _deps_check QUATLIB_FOUND)
if(NOT WIN32)
find_package(Threads)
list(APPEND _deps_libs ${CMAKE_THREAD_LIBS_INIT})
list(APPEND _deps_check CMAKE_HAVE_THREADS_LIBRARY)
endif()
# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(VRPN
DEFAULT_MSG
VRPN_LIBRARY
VRPN_INCLUDE_DIR
${_deps_check})
if(VRPN_FOUND)
set(VRPN_INCLUDE_DIRS "${VRPN_INCLUDE_DIR}" ${_deps_includes})
set(VRPN_LIBRARIES "${VRPN_LIBRARY}" ${_deps_libs})
set(VRPN_SERVER_LIBRARIES "${VRPN_SERVER_LIBRARY}" ${_deps_libs})
if(VRPN_LIBRARY)
set(VRPN_CLIENT_DEFINITIONS -DVRPN_CLIENT_ONLY)
else()
unset(VRPN_CLIENT_DEFINITIONS)
endif()
if(VRPN_LIBRARY AND NOT VRPN_SERVER_LIBRARY)
set(VRPN_DEFINITIONS -DVRPN_CLIENT_ONLY)
else()
unset(VRPN_DEFINITIONS)
endif()
mark_as_advanced(VRPN_ROOT_DIR)
endif()
mark_as_advanced(VRPN_LIBRARY VRPN_SERVER_LIBRARY VRPN_INCLUDE_DIR)
# - try to find Arrington Research ViewPoint EyeTracker SDK
#
# Cache Variables: (probably not for direct use in your scripts)
# VIEWPOINT_INCLUDE_DIR
# VIEWPOINT_LIBRARY
# VIEWPOINT_RUNTIME_LIBRARY
#
# Non-cache variables you might use in your CMakeLists.txt:
# VIEWPOINT_FOUND
# VIEWPOINT_INCLUDE_DIRS
# VIEWPOINT_LIBRARIES
# VIEWPOINT_RUNTIME_LIBRARIES - aka the dll for installing
# VIEWPOINT_RUNTIME_LIBRARY_DIRS
#
# Requires these CMake modules:
# FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
#
# Original Author:
# 2012 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2012.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
set(VIEWPOINT_ROOT_DIR
"${VIEWPOINT_ROOT_DIR}"
CACHE
PATH
"Directory to search for Arrington Research ViewPoint EyeTracker SDK")
if(CMAKE_SIZEOF_VOID_P MATCHES "8")
set(_LIBSUFFIXES /lib64 /lib)
else()
set(_LIBSUFFIXES /lib)
endif()
find_library(VIEWPOINT_LIBRARY
NAMES
VPX_InterApp
PATHS
"${VIEWPOINT_ROOT_DIR}"
PATH_SUFFIXES
"${_LIBSUFFIXES}")
get_filename_component(_libdir "${VIEWPOINT_LIBRARY}" PATH)
find_path(VIEWPOINT_INCLUDE_DIR
NAMES
vpx.h
HINTS
"${_libdir}"
PATHS
"${VIEWPOINT_ROOT_DIR}"
PATH_SUFFIXES
include/)
set(_deps_check)
if(WIN32)
find_file(VIEWPOINT_RUNTIME_LIBRARY
NAMES
VPX_InterApp.dll
HINTS
"${_libdir}")
set(VIEWPOINT_RUNTIME_LIBRARIES "${VIEWPOINT_RUNTIME_LIBRARY}")
get_filename_component(VIEWPOINT_RUNTIME_LIBRARY_DIRS
"${VIEWPOINT_RUNTIME_LIBRARY}"
PATH)
list(APPEND _deps_check VIEWPOINT_RUNTIME_LIBRARY)
else()
get_filename_component(VIEWPOINT_RUNTIME_LIBRARY_DIRS
"${VIEWPOINT_LIBRARY}"
PATH)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ViewPoint
DEFAULT_MSG
VIEWPOINT_LIBRARY
VIEWPOINT_INCLUDE_DIR
${_deps_check})
if(VIEWPOINT_FOUND)
set(VIEWPOINT_LIBRARIES "${VIEWPOINT_LIBRARY}")
set(VIEWPOINT_INCLUDE_DIRS "${VIEWPOINT_INCLUDE_DIR}")
mark_as_advanced(VIEWPOINT_ROOT_DIR)
endif()
mark_as_advanced(VIEWPOINT_INCLUDE_DIR
VIEWPOINT_LIBRARY
VIEWPOINT_RUNTIME_LIBRARY)
# - try to find WiiUse library
#
# Cache Variables: (probably not for direct use in your scripts)
# WIIUSE_INCLUDE_DIR
# WIIUSE_LIBRARY
#
# Non-cache variables you might use in your CMakeLists.txt:
# WIIUSE_FOUND
# WIIUSE_INCLUDE_DIRS
# WIIUSE_LIBRARIES
# WIIUSE_RUNTIME_LIBRARIES - aka the dll for installing
# WIIUSE_RUNTIME_LIBRARY_DIRS
#
# Requires these CMake modules:
# FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
set(WIIUSE_ROOT_DIR
"${WIIUSE_ROOT_DIR}"
CACHE
PATH
"Directory to search for WiiUse")
if(CMAKE_SIZEOF_VOID_P MATCHES "8")
set(_LIBSUFFIXES /lib64 /lib)
else()
set(_LIBSUFFIXES /lib)
endif()
find_library(WIIUSE_LIBRARY
NAMES
wiiuse
PATHS
"${WIIUSE_ROOT_DIR}"
PATH_SUFFIXES
"${_LIBSUFFIXES}")
get_filename_component(_libdir "${WIIUSE_LIBRARY}" PATH)
find_path(WIIUSE_INCLUDE_DIR
NAMES
wiiuse.h
HINTS
"${_libdir}"
"${_libdir}/.."
PATHS
"${WIIUSE_ROOT_DIR}"
PATH_SUFFIXES
include/)
set(_deps_check)
if(WIN32)
find_file(WIIUSE_RUNTIME_LIBRARY
NAMES
wiiuse.dll
HINTS
"${_libdir}"
"${_libdir}/.."
PATH_SUFFIXES
bin)
set(WIIUSE_RUNTIME_LIBRARIES "${WIIUSE_RUNTIME_LIBRARY}")
get_filename_component(WIIUSE_RUNTIME_LIBRARY_DIRS
"${WIIUSE_RUNTIME_LIBRARY}"
PATH)
list(APPEND _deps_check WIIUSE_RUNTIME_LIBRARY)
else()
set(WIIUSE_RUNTIME_LIBRARY "${WIIUSE_LIBRARY}")
set(WIIUSE_RUNTIME_LIBRARIES "${WIIUSE_RUNTIME_LIBRARY}")
get_filename_component(WIIUSE_RUNTIME_LIBRARY_DIRS
"${WIIUSE_LIBRARY}"
PATH)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(WiiUse
DEFAULT_MSG
WIIUSE_LIBRARY
WIIUSE_INCLUDE_DIR
${_deps_check})
if(WIIUSE_FOUND)
set(WIIUSE_LIBRARIES "${WIIUSE_LIBRARY}")
set(WIIUSE_INCLUDE_DIRS "${WIIUSE_INCLUDE_DIR}")
mark_as_advanced(WIIUSE_ROOT_DIR)
endif()
mark_as_advanced(WIIUSE_INCLUDE_DIR
WIIUSE_LIBRARY
WIIUSE_RUNTIME_LIBRARY)
# - try to find Windows HID support, part of the WDK/DDK
#
# Cache Variables: (probably not for direct use in your scripts)
# WINHID_INCLUDE_DIR
# WINHID_CRT_INCLUDE_DIR
# WINHID_LIBRARY
#
# Non-cache variables you might use in your CMakeLists.txt:
# WINHID_FOUND
# WINHID_INCLUDE_DIRS
# WINHID_LIBRARIES
#
# Requires these CMake modules:
# FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
# PrefixListGlob
# CleanDirectoryList
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(NOT WIN32)
find_package_handle_standard_args(WinHID
"Skipping search for Windows HID on non-Windows platform"
WIN32)
return()
endif()
if(MSVC)
if( (NOT WINHID_ROOT_DIR) AND (NOT ENV{DDKROOT} STREQUAL "") )
set(WINHID_ROOT_DIR "$ENV{DDKROOT}")
endif()
endif()
set(WINHID_ROOT_DIR
"${WINHID_ROOT_DIR}"
CACHE
PATH
"Directory to search")
if(CMAKE_SIZEOF_VOID_P MATCHES "8")
set(_arch amd64) # what the architecture used to be called
set(_arch8 x64) # what the WDK for Win8+ calls this architecture
else()
set(_arch i386) # what the architecture used to be called
set(_arch8 x86) # what the WDK for Win8+ calls this architecture
endif()
set(_deps_check)
set(_need_crt_dir)
if(MSVC)
include(PrefixListGlob)
include(CleanDirectoryList)
prefix_list_glob(_prefixed
"*/"
"$ENV{SYSTEMDRIVE}/WinDDK/"
"$ENV{ProgramFiles}/Windows Kits/"
"c:/WinDDK/")
clean_directory_list(_prefixed)
find_library(WINHID_LIBRARY
NAMES
hid
libhid
HINTS
"${WINHID_ROOT_DIR}"
${_prefixed}
PATH_SUFFIXES
"lib/w2k/${_arch}" # Win2k min requirement
"lib/wxp/${_arch}" # WinXP min requirement
"lib/wnet/${_arch}" # Win Server 2003 min requirement
"lib/wlh/${_arch}" # Win Vista ("Long Horn") min requirement
"lib/wlh/um/${_arch8}" # Win Vista ("Long Horn") min requirement
"lib/win7/${_arch}" # Win 7 min requirement
"lib/win7/um/${_arch8}" # Win 7 min requirement
"lib/win8/${_arch}" # Win 8 min requirement
"lib/win8/um/${_arch8}" # Win 8 min requirement
)
# Might want to look close to the library first for the includes.
if(WINHID_LIBRARY)
set(_prevdir)
get_filename_component(_basedir "${WINHID_LIBRARY}" PATH)
while(NOT IS_DIRECTORY "${_basedir}/lib" AND NOT (_basedir STREQUAL _prevdir))
set(_prevdir "${_basedir}")
get_filename_component(_basedir "${_basedir}/.." ABSOLUTE)
endwhile()
endif()
if(WINHID_LIBRARY AND EXISTS "${_basedir}/inc")
find_path(WINHID_CRT_INCLUDE_DIR # otherwise you get weird compile errors
NAMES
stdio.h
HINTS
"${_basedir}"
PATHS
"${WINHID_ROOT_DIR}"
PATH_SUFFIXES
inc/crt
NO_DEFAULT_PATH)
list(APPEND _deps_check WINHID_CRT_INCLUDE_DIR)
set(_need_crt_dir ON)
endif()
find_path(WINHID_INCLUDE_DIR
NAMES
hidsdi.h
HINTS
"${_basedir}"
PATHS
"${WINHID_ROOT_DIR}"
PATH_SUFFIXES
inc/ddk
inc/api
inc/w2k
inc/wxp
inc/wnet
include/shared)
else()
find_library(WINHID_LIBRARY
NAMES
libhid
HINTS
"${WINHID_ROOT_DIR}"
/mingw
PATH_SUFFIXES
lib
lib/w32api)
find_path(WINHID_INCLUDE_DIR
NAMES
hidsdi.h
PATHS
"${WINHID_ROOT_DIR}"
/mingw
PATH_SUFFIXES
include/w32api/ddk
include/ddk
ddk)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(WinHID
DEFAULT_MSG
WINHID_LIBRARY
WINHID_INCLUDE_DIR
${_deps_check})
if(WINHID_FOUND)
if(MSVC)
set(_winreq "Unknown")
if(WINHID_LIBRARY MATCHES "lib/w2k")
set(_winreq "Windows 2000")
elseif(WINHID_LIBRARY MATCHES "lib/wxp")
set(_winreq "Windows XP")
elseif(WINHID_LIBRARY MATCHES "lib/wnet")
set(_winreq "Windows Server 2003")
elseif(WINHID_LIBRARY MATCHES "lib/wlh")
set(_winreq "Windows Vista")
elseif(WINHID_LIBRARY MATCHES "lib/win7")
set(_winreq "Windows 7")
elseif(WINHID_LIBRARY MATCHES "lib/win8")
set(_winreq "Windows 8 (Possibly?)")
endif()
if(NOT "${WINHID_MIN_WINDOWS_VER}" STREQUAL "${_winreq}")
if(NOT WinHID_FIND_QUIETLY)
message(STATUS
"Linking against WINHID_LIBRARY will enforce this minimum version: ${_winreq}")
endif()
set(WINHID_MIN_WINDOWS_VER "${_winreq}" CACHE INTERNAL "" FORCE)
endif()
endif()
set(WINHID_LIBRARIES "${WINHID_LIBRARY}")
if(_need_crt_dir)
set(WINHID_INCLUDE_DIRS
"${WINHID_CRT_INCLUDE_DIR}"
"${WINHID_INCLUDE_DIR}")
else()
# Don't need that CRT include dir for WDK 8+
set(WINHID_INCLUDE_DIRS
"${WINHID_INCLUDE_DIR}")
endif()
mark_as_advanced(WINHID_ROOT_DIR)
endif()
mark_as_advanced(WINHID_INCLUDE_DIR
WINHID_CRT_INCLUDE_DIR
WINHID_LIBRARY)
# - Find the Windows SDK aka Platform SDK
#
# Relevant Wikipedia article: http://en.wikipedia.org/wiki/Microsoft_Windows_SDK
#
# Variables:
# WINDOWSSDK_FOUND - if any version of the windows or platform SDK was found that is usable with the current version of visual studio
# WINDOWSSDK_LATEST_DIR
# WINDOWSSDK_LATEST_NAME
# WINDOWSSDK_FOUND_PREFERENCE - if we found an entry indicating a "preferred" SDK listed for this visual studio version
# WINDOWSSDK_PREFERRED_DIR
# WINDOWSSDK_PREFERRED_NAME
#
# WINDOWSSDK_DIRS - contains no duplicates, ordered most recent first.
# WINDOWSSDK_PREFERRED_FIRST_DIRS - contains no duplicates, ordered with preferred first, followed by the rest in descending recency
#
# Functions:
# windowssdk_name_lookup(<directory> <output variable>) - Find the name corresponding with the SDK directory you pass in, or
# NOTFOUND if not recognized. Your directory must be one of WINDOWSSDK_DIRS for this to work.
#
# get_windowssdk_from_component(<file or dir> <output variable>) - Given a library or include dir,
# find the Windows SDK root dir corresponding to it, or NOTFOUND if unrecognized.
#
# get_windowssdk_library_dirs(<directory> <output variable>) - Find the architecture-appropriate
# library directories corresponding to the SDK directory you pass in (or NOTFOUND if none)
#
# get_windowssdk_include_dirs(<directory> <output variable>) - Find the
# include directories corresponding to the SDK directory you pass in (or NOTFOUND if none)
#
# Requires these CMake modules:
# FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
#
# Original Author:
# 2012 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2012.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
set(_preferred_sdk_dirs)
set(_win_sdk_dirs)
set(_win_sdk_versanddirs)
if(MSVC_VERSION GREATER 1310) # Newer than VS .NET/VS Toolkit 2003
# Environment variable for SDK dir
if(EXISTS "$ENV{WindowsSDKDir}" AND (NOT "$ENV{WindowsSDKDir}" STREQUAL ""))
message(STATUS "Got $ENV{WindowsSDKDir} - Windows/Platform SDK directories: ${_win_sdk_dirs}")
list(APPEND _preferred_sdk_dirs "$ENV{WindowsSDKDir}")
endif()
if(MSVC_VERSION LESS 1600)
# Per-user current Windows SDK for VS2005/2008
get_filename_component(_sdkdir
"[HKEY_CURRENT_USER\\Software\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]"
ABSOLUTE)
if(EXISTS "${_sdkdir}")
list(APPEND _preferred_sdk_dirs "${_sdkdir}")
endif()
# System-wide current Windows SDK for VS2005/2008
get_filename_component(_sdkdir
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]"
ABSOLUTE)
if(EXISTS "${_sdkdir}")
list(APPEND _preferred_sdk_dirs "${_sdkdir}")
endif()
endif()
if(MSVC_VERSION LESS 1700)
# VC 10 and older has broad target support
set(_winsdk_vistaonly)
else()
# VC 11 by default targets Vista and later only, so we can add a few more SDKs that (might?) only work on vista+
if("${CMAKE_VS_PLATFORM_TOOLSET}" MATCHES "_xp")
# This is the XP-compatible v110 toolset
elseif("${CMAKE_VS_PLATFORM_TOOLSET}" STREQUAL "v100")
# This is the VS2010 toolset
else()
if(NOT WINDOWSSDK_FOUND AND NOT WindowsSDK_FIND_QUIETLY)
message(STATUS "FindWindowsSDK: Detected Visual Studio 2012 or newer, not using the _xp toolset variant: including SDK versions that drop XP support in search!")
endif()
# These versions have no XP (and possibly Vista pre-SP1) support
set(_winsdk_vistaonly)
if(NOT MSVC_VERSION LESS 1800)
list(APPEND _winsdk_vistaonly
# Windows Software Development Kit (SDK) for Windows 8.1
# http://msdn.microsoft.com/en-gb/windows/desktop/bg162891
v8.1)
endif()
list(APPEND _winsdk_vistaonly
# Included in Visual Studio 2012
v8.0A
# Microsoft Windows SDK for Windows 8 and .NET Framework 4.5
# This is the first version to also include the DirectX SDK
# http://msdn.microsoft.com/en-US/windows/desktop/hh852363.aspx
v8.0
# Microsoft Windows SDK for Windows 7 and .NET Framework 4
# http://www.microsoft.com/downloads/en/details.aspx?FamilyID=6b6c21d2-2006-4afa-9702-529fa782d63b
v7.1
)
endif()
endif()
foreach(_winsdkver
${_winsdk_vistaonly}
# Included in Visual Studio 2013
# Includes the v120_xp toolset
v8.1A
# Included with VS 2012 Update 1 or later
# Introduces v110_xp toolset
v7.1A
# Included with VS 2010
v7.0A
# Windows SDK for Windows 7 and .NET Framework 3.5 SP1
# Works with VC9
#http://www.microsoft.com/en-us/download/details.aspx?id=18950
v7.0
# Two versions call themselves "v6.1":
# Older:
# Windows Vista Update & .NET 3.0 SDK
# http://www.microsoft.com/en-us/download/details.aspx?id=14477
# Newer:
# Windows Server 2008 & .NET 3.5 SDK
# may have broken VS9SP1? they recommend v7.0 instead, or a KB...
# http://www.microsoft.com/en-us/download/details.aspx?id=24826
v6.1
# Included in VS 2008
v6.0A
# Microsoft Windows Software Development Kit for Windows Vista and .NET Framework 3.0 Runtime Components
# http://blogs.msdn.com/b/stanley/archive/2006/11/08/microsoft-windows-software-development-kit-for-windows-vista-and-net-framework-3-0-runtime-components.aspx
v6.0)
get_filename_component(_sdkdir
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\${_winsdkver};InstallationFolder]"
ABSOLUTE)
if(EXISTS "${_sdkdir}")
list(APPEND _win_sdk_dirs "${_sdkdir}")
list(APPEND
_win_sdk_versanddirs
"Windows SDK ${_winsdkver}"
"${_sdkdir}")
endif()
endforeach()
endif()
if(MSVC_VERSION GREATER 1200)
foreach(_platformsdkinfo
"D2FF9F89-8AA2-4373-8A31-C838BF4DBBE1_Microsoft Platform SDK for Windows Server 2003 R2"
"8F9E5EF3-A9A5-491B-A889-C58EFFECE8B3_Microsoft Platform SDK for Windows Server 2003 SP1")
string(SUBSTRING "${_platformsdkinfo}" 0 36 _platformsdkguid)
string(SUBSTRING "${_platformsdkinfo}" 37 -1 _platformsdkname)
foreach(HIVE HKEY_LOCAL_MACHINE HKEY_CURRENT_USER)
get_filename_component(_sdkdir
"[${HIVE}\\SOFTWARE\\Microsoft\\MicrosoftSDK\\InstalledSDKs\\${_platformsdkguid};Install Dir]"
ABSOLUTE)
if(EXISTS "${_sdkdir}")
list(APPEND _win_sdk_dirs "${_sdkdir}")
list(APPEND _win_sdk_versanddirs "${_platformsdkname}" "${_sdkdir}")
endif()
endforeach()
endforeach()
endif()
set(_win_sdk_versanddirs
"${_win_sdk_versanddirs}"
CACHE
INTERNAL
"mapping between windows sdk version locations and names"
FORCE)
function(windowssdk_name_lookup _dir _outvar)
list(FIND _win_sdk_versanddirs "${_dir}" _diridx)
math(EXPR _nameidx "${_diridx} - 1")
if(${_nameidx} GREATER -1)
list(GET _win_sdk_versanddirs ${_nameidx} _sdkname)
else()
set(_sdkname "NOTFOUND")
endif()
set(${_outvar} "${_sdkname}" PARENT_SCOPE)
endfunction()
if(_win_sdk_dirs)
# Remove duplicates
list(REMOVE_DUPLICATES _win_sdk_dirs)
list(GET _win_sdk_dirs 0 WINDOWSSDK_LATEST_DIR)
windowssdk_name_lookup("${WINDOWSSDK_LATEST_DIR}"
WINDOWSSDK_LATEST_NAME)
set(WINDOWSSDK_DIRS ${_win_sdk_dirs})
endif()
if(_preferred_sdk_dirs)
list(GET _preferred_sdk_dirs 0 WINDOWSSDK_PREFERRED_DIR)
windowssdk_name_lookup("${WINDOWSSDK_LATEST_DIR}"
WINDOWSSDK_PREFERRED_NAME)
set(WINDOWSSDK_PREFERRED_FIRST_DIRS
${_preferred_sdk_dirs}
${_win_sdk_dirs})
list(REMOVE_DUPLICATES WINDOWSSDK_PREFERRED_FIRST_DIRS)
set(WINDOWSSDK_FOUND_PREFERENCE ON)
# In case a preferred dir was found that isn't found otherwise
#set(WINDOWSSDK_DIRS ${WINDOWSSDK_DIRS} ${WINDOWSSDK_PREFERRED_FIRST_DIRS})
#list(REMOVE_DUPLICATES WINDOWSSDK_DIRS)
else()
set(WINDOWSSDK_PREFERRED_DIR "${WINDOWSSDK_LATEST_DIR}")
set(WINDOWSSDK_PREFERRED_NAME "${WINDOWSSDK_LATEST_NAME}")
set(WINDOWSSDK_PREFERRED_FIRST_DIRS ${WINDOWSSDK_DIRS})
set(WINDOWSSDK_FOUND_PREFERENCE OFF)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(WindowsSDK
"No compatible version of the Windows SDK or Platform SDK found."
WINDOWSSDK_DIRS)
if(WINDOWSSDK_FOUND)
if(NOT _winsdk_remembered_dirs STREQUAL WINDOWSSDK_DIRS)
set(_winsdk_remembered_dirs
"${WINDOWSSDK_DIRS}"
CACHE
INTERNAL
""
FORCE)
if(NOT WindowsSDK_FIND_QUIETLY)
foreach(_sdkdir ${WINDOWSSDK_DIRS})
windowssdk_name_lookup("${_sdkdir}" _sdkname)
message(STATUS " - Found ${_sdkname} at ${_sdkdir}")
endforeach()
endif()
endif()
# Internal: Architecture-appropriate library directory names.
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "ARM")
set(_winsdk_archbare /arm) # what the architecture used to be called in oldest SDKs
set(_winsdk_arch arm) # what the architecture used to be called
set(_winsdk_arch8 arm) # what the WDK for Win8+ calls this architecture
else()
if(CMAKE_SIZEOF_VOID_P MATCHES "8")
set(_winsdk_archbare /x64) # what the architecture used to be called in oldest SDKs
set(_winsdk_arch amd64) # what the architecture used to be called
set(_winsdk_arch8 x64) # what the WDK for Win8+ calls this architecture
else()
set(_winsdk_archbare ) # what the architecture used to be called in oldest SDKs
set(_winsdk_arch i386) # what the architecture used to be called
set(_winsdk_arch8 x86) # what the WDK for Win8+ calls this architecture
endif()
endif()
function(get_windowssdk_from_component _component _var)
get_filename_component(_component "${_component}" ABSOLUTE)
file(TO_CMAKE_PATH "${_component}" _component)
foreach(_sdkdir ${WINDOWSSDK_DIRS})
get_filename_component(_sdkdir "${_sdkdir}" ABSOLUTE)
string(LENGTH "${_sdkdir}" _sdklen)
file(RELATIVE_PATH _rel "${_sdkdir}" "${_component}")
# If we don't have any "parent directory" items...
if(NOT "${_rel}" MATCHES "[.][.]")
set(${_var} "${_sdkdir}" PARENT_SCOPE)
return()
endif()
endforeach()
# Fail.
set(${_var} "NOTFOUND" PARENT_SCOPE)
endfunction()
function(get_windowssdk_library_dirs _winsdk_dir _var)
set(_result)
foreach(_suffix
"lib${_winsdk_archbare}" # SDKs like 7.1A
"lib/w2k/${_winsdk_arch}" # Win2k min requirement
"lib/wxp/${_winsdk_arch}" # WinXP min requirement
"lib/wnet/${_winsdk_arch}" # Win Server 2003 min requirement
"lib/wlh/${_winsdk_arch}" # Win Vista ("Long Horn") min requirement
"lib/wlh/um/${_winsdk_arch8}" # Win Vista ("Long Horn") min requirement
"lib/win7/${_winsdk_arch}" # Win 7 min requirement
"lib/win7/um/${_winsdk_arch8}" # Win 7 min requirement
"lib/win8/um/${_winsdk_arch8}" # Win 8 min requirement
"lib/win8/km/${_winsdk_arch8}" # Win 8 min requirement
"lib/winv6.3/km/${_winsdk_arch8}" # Win 8.1 min requirement
"lib/winv6.3/um/${_winsdk_arch8}" # Win 8.1 min requirement
)
# Check to see if a library actually exists here.
file(GLOB _libs "${_winsdk_dir}/${_suffix}/*.lib")
if(_libs)
list(APPEND _result "${_winsdk_dir}/${_suffix}")
endif()
endforeach()
if(NOT _result)
set(_result NOTFOUND)
endif()
set(${_var} ${_result} PARENT_SCOPE)
endfunction()
function(get_windowssdk_include_dirs _winsdk_dir _var)
set(_result)
foreach(_suffix
"Include"
"Include/shared"
"Include/um"
"Include/winrt"
"Include/km"
"Include/wdf"
)
# Check to see if a header file actually exists here.
file(GLOB _headers "${_winsdk_dir}/${_suffix}/*.h")
if(_headers)
list(APPEND _result "${_winsdk_dir}/${_suffix}")
endif()
endforeach()
if(NOT _result)
set(_result NOTFOUND)
endif()
set(${_var} ${_result} PARENT_SCOPE)
endfunction()
endif()
# - try to find cppcheck tool
#
# Cache Variables:
# CPPCHECK_EXECUTABLE
#
# Non-cache variables you might use in your CMakeLists.txt:
# CPPCHECK_FOUND
# CPPCHECK_POSSIBLEERROR_ARG
# CPPCHECK_UNUSEDFUNC_ARG
# CPPCHECK_STYLE_ARG
# CPPCHECK_QUIET_ARG
# CPPCHECK_INCLUDEPATH_ARG
# CPPCHECK_FAIL_REGULAR_EXPRESSION
# CPPCHECK_WARN_REGULAR_EXPRESSION
# CPPCHECK_MARK_AS_ADVANCED - whether to mark our vars as advanced even
# if we don't find this program.
#
# Requires these CMake modules:
# FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
file(TO_CMAKE_PATH "${CPPCHECK_ROOT_DIR}" CPPCHECK_ROOT_DIR)
set(CPPCHECK_ROOT_DIR
"${CPPCHECK_ROOT_DIR}"
CACHE
PATH
"Path to search for cppcheck")
# cppcheck app bundles on Mac OS X are GUI, we want command line only
set(_oldappbundlesetting ${CMAKE_FIND_APPBUNDLE})
set(CMAKE_FIND_APPBUNDLE NEVER)
if(CPPCHECK_EXECUTABLE AND NOT EXISTS "${CPPCHECK_EXECUTABLE}")
set(CPPCHECK_EXECUTABLE "notfound" CACHE PATH FORCE "")
endif()
# If we have a custom path, look there first.
if(CPPCHECK_ROOT_DIR)
find_program(CPPCHECK_EXECUTABLE
NAMES
cppcheck
cli
PATHS
"${CPPCHECK_ROOT_DIR}"
PATH_SUFFIXES
cli
NO_DEFAULT_PATH)
endif()
find_program(CPPCHECK_EXECUTABLE NAMES cppcheck)
# Restore original setting for appbundle finding
set(CMAKE_FIND_APPBUNDLE ${_oldappbundlesetting})
# Find out where our test file is
get_filename_component(_cppcheckmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
set(_cppcheckdummyfile "${_cppcheckmoddir}/Findcppcheck.cpp")
if(NOT EXISTS "${_cppcheckdummyfile}")
message(FATAL_ERROR
"Missing file ${_cppcheckdummyfile} - should be alongside Findcppcheck.cmake, can be found at https://github.com/rpavlik/cmake-modules")
endif()
function(_cppcheck_test_arg _resultvar _arg)
if(NOT CPPCHECK_EXECUTABLE)
set(${_resultvar} NO)
return()
endif()
execute_process(COMMAND
"${CPPCHECK_EXECUTABLE}"
"${_arg}"
"--quiet"
"${_cppcheckdummyfile}"
RESULT_VARIABLE
_cppcheck_result
OUTPUT_QUIET
ERROR_QUIET)
if("${_cppcheck_result}" EQUAL 0)
set(${_resultvar} YES PARENT_SCOPE)
else()
set(${_resultvar} NO PARENT_SCOPE)
endif()
endfunction()
function(_cppcheck_set_arg_var _argvar _arg)
if("${${_argvar}}" STREQUAL "")
_cppcheck_test_arg(_cppcheck_arg "${_arg}")
if(_cppcheck_arg)
set(${_argvar} "${_arg}" PARENT_SCOPE)
endif()
endif()
endfunction()
if(CPPCHECK_EXECUTABLE)
# Check for the two types of command line arguments by just trying them
_cppcheck_set_arg_var(CPPCHECK_STYLE_ARG "--enable=style")
_cppcheck_set_arg_var(CPPCHECK_STYLE_ARG "--style")
if("${CPPCHECK_STYLE_ARG}" STREQUAL "--enable=style")
_cppcheck_set_arg_var(CPPCHECK_UNUSEDFUNC_ARG
"--enable=unusedFunction")
_cppcheck_set_arg_var(CPPCHECK_INFORMATION_ARG "--enable=information")
_cppcheck_set_arg_var(CPPCHECK_MISSINGINCLUDE_ARG
"--enable=missingInclude")
_cppcheck_set_arg_var(CPPCHECK_POSIX_ARG "--enable=posix")
_cppcheck_set_arg_var(CPPCHECK_POSSIBLEERROR_ARG
"--enable=possibleError")
_cppcheck_set_arg_var(CPPCHECK_POSSIBLEERROR_ARG "--enable=all")
if(MSVC)
set(CPPCHECK_TEMPLATE_ARG --template vs)
set(CPPCHECK_FAIL_REGULAR_EXPRESSION "[(]error[)]")
set(CPPCHECK_WARN_REGULAR_EXPRESSION "[(]style[)]")
elseif(CMAKE_COMPILER_IS_GNUCXX)
set(CPPCHECK_TEMPLATE_ARG --template gcc)
set(CPPCHECK_FAIL_REGULAR_EXPRESSION " error: ")
set(CPPCHECK_WARN_REGULAR_EXPRESSION " style: ")
else()
set(CPPCHECK_TEMPLATE_ARG --template gcc)
set(CPPCHECK_FAIL_REGULAR_EXPRESSION " error: ")
set(CPPCHECK_WARN_REGULAR_EXPRESSION " style: ")
endif()
elseif("${CPPCHECK_STYLE_ARG}" STREQUAL "--style")
# Old arguments
_cppcheck_set_arg_var(CPPCHECK_UNUSEDFUNC_ARG "--unused-functions")
_cppcheck_set_arg_var(CPPCHECK_POSSIBLEERROR_ARG "--all")
set(CPPCHECK_FAIL_REGULAR_EXPRESSION "error:")
set(CPPCHECK_WARN_REGULAR_EXPRESSION "[(]style[)]")
else()
# No idea - some other issue must be getting in the way
message(STATUS
"WARNING: Can't detect whether CPPCHECK wants new or old-style arguments!")
endif()
set(CPPCHECK_QUIET_ARG "--quiet")
set(CPPCHECK_INCLUDEPATH_ARG "-I")
endif()
set(CPPCHECK_ALL
"${CPPCHECK_EXECUTABLE} ${CPPCHECK_POSSIBLEERROR_ARG} ${CPPCHECK_UNUSEDFUNC_ARG} ${CPPCHECK_STYLE_ARG} ${CPPCHECK_QUIET_ARG} ${CPPCHECK_INCLUDEPATH_ARG} some/include/path")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(cppcheck
DEFAULT_MSG
CPPCHECK_ALL
CPPCHECK_EXECUTABLE
CPPCHECK_POSSIBLEERROR_ARG
CPPCHECK_UNUSEDFUNC_ARG
CPPCHECK_STYLE_ARG
CPPCHECK_INCLUDEPATH_ARG
CPPCHECK_QUIET_ARG)
if(CPPCHECK_FOUND OR CPPCHECK_MARK_AS_ADVANCED)
mark_as_advanced(CPPCHECK_ROOT_DIR)
endif()
mark_as_advanced(CPPCHECK_EXECUTABLE)
/**
* \file Findcppcheck.cpp
* \brief Dummy C++ source file used by CMake module Findcppcheck.cmake
*
* \author
* Ryan Pavlik, 2009-2010
* <rpavlik@iastate.edu>
* http://academic.cleardefinition.com/
*
*/
int main(int argc, char* argv[]) {
return 0;
}
# - Find quatlib
# Find the quatlib headers and libraries.
#
# QUATLIB_INCLUDE_DIRS - where to find quat.h
# QUATLIB_LIBRARIES - List of libraries when using quatlib.
# QUATLIB_FOUND - True if quatlib found.
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(TARGET quat)
# Look for the header file.
find_path(QUATLIB_INCLUDE_DIR NAMES quat.h
PATHS ${quatlib_SOURCE_DIR})
set(QUATLIB_LIBRARY "quat")
else()
set(QUATLIB_ROOT_DIR
"${QUATLIB_ROOT_DIR}"
CACHE
PATH
"Root directory to search for quatlib")
if(DEFINED VRPN_ROOT_DIR AND NOT QUATLIB_ROOT_DIR)
set(QUATLIB_ROOT_DIR "${VRPN_ROOT_DIR}")
mark_as_advanced(QUATLIB_ROOT_DIR)
endif()
if("${CMAKE_SIZEOF_VOID_P}" MATCHES "8")
set(_libsuffixes lib64 lib)
# 64-bit dir: only set on win64
file(TO_CMAKE_PATH "$ENV{ProgramW6432}" _progfiles)
else()
set(_libsuffixes lib)
if(NOT "$ENV{ProgramFiles(x86)}" STREQUAL "")
# 32-bit dir: only set on win64
file(TO_CMAKE_PATH "$ENV{ProgramFiles(x86)}" _progfiles)
else()
# 32-bit dir on win32, useless to us on win64
file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _progfiles)
endif()
endif()
# Look for the header file.
find_path(QUATLIB_INCLUDE_DIR
NAMES
quat.h
HINTS
"${QUATLIB_ROOT_DIR}"
PATH_SUFFIXES
include
PATHS
"${_progfiles}/VRPN"
"${_progfiles}/quatlib"
C:/usr/local
/usr/local)
# Look for the library.
find_library(QUATLIB_LIBRARY
NAMES
quat.lib
libquat.a
HINTS
"${QUATLIB_ROOT_DIR}"
PATH_SUFFIXES
${_libsuffixes}
PATHS
"${_progfiles}/VRPN"
"${_progfiles}/quatlib"
C:/usr/local
/usr/local)
endif()
# handle the QUIETLY and REQUIRED arguments and set QUATLIB_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(quatlib
DEFAULT_MSG
QUATLIB_LIBRARY
QUATLIB_INCLUDE_DIR)
if(QUATLIB_FOUND)
set(QUATLIB_LIBRARIES ${QUATLIB_LIBRARY})
if(NOT WIN32)
list(APPEND QUATLIB_LIBRARIES m)
endif()
set(QUATLIB_INCLUDE_DIRS ${QUATLIB_INCLUDE_DIR})
mark_as_advanced(QUATLIB_ROOT_DIR)
else()
set(QUATLIB_LIBRARIES)
set(QUATLIB_INCLUDE_DIRS)
endif()
mark_as_advanced(QUATLIB_LIBRARY QUATLIB_INCLUDE_DIR)
# - Utility function to return a human-useful-only string ID'ing the compiler
#
# get_compiler_info_string(<resultvar>)
#
# and some helper functions:
# get_gcc_version(<resultvar>)
# get_vs_short_version_string(<generator> <resultvar>)
#
# You might consider using it when setting up CTest options, for example:
# include(GetCompilerInfoString)
# get_compiler_info_string(COMPILERID)
# set(CTEST_BUILD_NAME "${CMAKE_SYSTEM}-${CMAKE_SYSTEM_PROCESSOR}-${COMPILERID}")
#
# Requires these CMake modules:
# no additional modules required
#
# Original Author:
# 2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# Some functions based on cmake-2.8.0 modules FindBoost.cmake and CTest.cmake
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
# Copyright 2006-2008 Andreas Schneider <mail@cynapses.org>
# Copyright 2007 Wengo
# Copyright 2007 Mike Jackson
# Copyright 2008 Andreas Pakulat <apaku@gmx.de>
# Copyright 2008-2009 Philip Lowman <philip@yhbt.com>
# Copyright 2010 Iowa State University (Ryan Pavlik <abiryan@ryand.net>)
#
# 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.
#=============================================================================
# CMake - Cross Platform Makefile Generator
# Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
# nor the names of their contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
if(__get_compiler_info_string)
return()
endif()
set(__get_compiler_info_string YES)
function(get_compiler_info_string _var)
set(_out)
if(CTEST_CMAKE_GENERATOR AND NOT CMAKE_GENERATOR)
# We're running in CTest - use that generator.
set(CMAKE_GENERATOR ${CTEST_CMAKE_GENERATOR})
endif()
if(NOT CMAKE_CXX_COMPILER)
# Also for use in CTest scripts
include(CMakeDetermineCXXCompiler)
endif()
if(MSVC)
# Parse version for Visual Studio
get_vs_short_version_string("${CMAKE_GENERATOR}" _verstring)
if(${CMAKE_GENERATOR} MATCHES "Win64")
set(_verstring "${_verstring}win64")
endif()
elseif(CMAKE_COMPILER_IS_GNUCXX)
# Parse version for GCC
get_gcc_version(_gccver)
set(_verstring "gcc${_gccver}")
else()
# Some other compiler we don't handle in more detail yet.
string(REGEX REPLACE " " "_" _verstring "${CMAKE_GENERATOR}")
set(_verstring "${CMAKE_CXX_COMPILER_ID}:generator:${_verstring}")
endif()
# Return _verstring
set(${_var} "${_verstring}" PARENT_SCOPE)
endfunction()
## Based on a function in FindBoost.cmake from CMake 2.8.0
#-------------------------------------------------------------------------------
#
# Runs compiler with "-dumpversion" and parses major/minor
# version with a regex.
#
function(get_gcc_version _var)
exec_program(${CMAKE_CXX_COMPILER}
ARGS
${CMAKE_CXX_COMPILER_ARG1}
-dumpversion
OUTPUT_VARIABLE
_compilerinfo_COMPILER_VERSION)
string(REGEX
MATCH
"([.0-9]+)"
"\\1"
_compilerinfo_COMPILER_VERSION
"${_compilerinfo_COMPILER_VERSION}")
set(${_var} ${_compilerinfo_COMPILER_VERSION} PARENT_SCOPE)
endfunction()
## Based on a function in CTest.cmake from CMake 2.8.0
#-------------------------------------------------------------------------------
#
# function to turn generator name into a version string
# like vs7 vs71 vs8 vs9
#
function(get_vs_short_version_string _generator _var)
set(_ver_string)
if("${_generator}" MATCHES "Visual Studio")
string(REGEX
REPLACE
"Visual Studio ([0-9][0-9]?)($|.*)"
"\\1"
_vsver
"${_generator}")
if("${_generator}" MATCHES "Visual Studio 7 .NET 2003")
# handle the weird one
set(_ver_string "vs71")
else()
set(_ver_string "vs${_vsver}")
endif()
elseif(MSVC)
if(MSVC71)
set(_ver_string "vs71")
else()
foreach(_ver 6 7 8 9 10)
if(MSVC${_ver}0)
set(_ver_string "vs${_ver}")
break()
endif()
endforeach()
endif()
endif()
if(_ver_string)
set(${_var} ${_ver_string} PARENT_SCOPE)
endif()
endfunction()
# - Script to get the value of a preprocessor definition that is a string,
# after including the given files
# Requires that the associated source file be present: GetDefineString.cpp.in.
#
# get_define_string(NAME <define_name> [INCLUDES <files>] RESULT <variable>
# [FLAGS <compile-flags>]
# [INCLUDE_DIRS <include-dirs>]
# [DEFINES] <-Ddefinitions>)
# Original Author:
# 2014 Ryan Pavlik <ryan@sensics.com> <abiryan@ryand.net>
#
# Copyright Sensics, Inc. 2014.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
get_filename_component(_getdefinestring_moddir "${CMAKE_CURRENT_LIST_FILE}" PATH)
function(get_define_string)
include(CMakeParseArguments)
cmake_parse_arguments(_gds "" "NAME;RESULT" "INCLUDES;FLAGS;INCLUDE_DIRS;DEFINES" ${ARGN})
if(NOT _gds_NAME)
message(FATAL_ERROR "Must pass NAME to get_define_string!")
endif()
if(NOT _gds_RESULT)
message(FATAL_ERROR "Must pass RESULT to get_define_string!")
endif()
if(NOT DEFINED "${_gds_RESULT}_CHECKED" OR (NOT "${${_gds_RESULT}_CHECKED}" STREQUAL "${ARGN}"))
set(${_gds_RESULT}_CHECKED "${ARGN}" CACHE INTERNAL "" FORCE)
set(GET_DEFINE_STRING_NAME ${_gds_NAME})
set(_INCLUDES)
if(_gds_INCLUDE_DIRS)
set(_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${_gds_INCLUDE_DIRS}")
endif()
set(GET_DEFINE_STRING_INCLUDES)
foreach(_file ${_gds_INCLUDES})
set(GET_DEFINE_STRING_INCLUDES "${GET_DEFINE_STRING_INCLUDES}#include <${_file}>\n")
endforeach()
set(_src "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/GetDefineString${_gds_RESULT}.cpp")
set(_out "${CMAKE_CURRENT_BINARY_DIR}/GetDefineString${_gds_RESULT}.out")
configure_file("${_getdefinestring_moddir}/GetDefineString.cpp.in" "${_src}")
try_compile(_result "${CMAKE_CURRENT_BINARY_DIR}" SOURCES "${_src}"
CMAKE_FLAGS ${_INCLUDES}
COMPILE_DEFINITIONS ${_gds_DEFINES}
OUTPUT_VARIABLE OUTPUT
COPY_FILE "${_out}")
if(_result)
file(STRINGS "${_out}" _result_string REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
if("${_result_string}" MATCHES "INFO:define\\[([^]\"]*)\\]")
set(${_gds_RESULT}_CACHED "${CMAKE_MATCH_1}" CACHE INTERNAL "" FORCE)
endif()
else()
set(${_gds_RESULT}_CACHED NOTFOUND)
endif()
endif()
set(${_gds_RESULT} ${${_gds_RESULT}_CACHED} PARENT_SCOPE)
endfunction()
\ No newline at end of file
@GET_DEFINE_STRING_INCLUDES@
char const * info = "INFO" ":" "define[" @GET_DEFINE_STRING_NAME@ "]";
int main(int argc, char * argv[]) {
int require = 0;
require += info[argc];
(void)argv;
return require;
}
\ No newline at end of file
# - Returns a list of the parent directories of all files passed
#
# get_directory_list(<listvar> <file path> [<additional file paths>...])
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__get_directory_list)
return()
endif()
set(__get_directory_list YES)
function(get_directory_list _var)
# combine variable's current value with additional list items
set(_in ${ARGN})
if(_in)
# Initial list cleaning
list(REMOVE_DUPLICATES _in)
# Grab the absolute path of each actual directory
set(_out)
foreach(_file ${_in})
get_filename_component(_dir "${_file}" PATH)
if(IS_DIRECTORY "${_dir}")
get_filename_component(_dir "${_dir}" ABSOLUTE)
file(TO_CMAKE_PATH "${_dir}" _dir)
list(APPEND _out "${_dir}")
endif()
endforeach()
if(_out)
# Clean up the output list now
list(REMOVE_DUPLICATES _out)
endif()
# return _out
set(${_var} "${_out}" PARENT_SCOPE)
endif()
endfunction()
# - Returns a version string from Git
#
# These functions force a re-configure on each git commit so that you can
# trust the values of the variables in your build system.
#
# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
#
# Returns the refspec and sha hash of the current head revision
#
# git_describe(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe on the source tree, and adjusting
# the output so that it tests false if an error occurs.
#
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe --exact-match on the source tree,
# and adjusting the output so that it tests false if there was no exact
# matching tag.
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__get_git_revision_description)
return()
endif()
set(__get_git_revision_description YES)
# We must run the following at "include" time, not at function call time,
# to find the path to this module rather than the path to a calling list file
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
function(get_git_head_revision _refspecvar _hashvar)
set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
# We have reached the root directory, we are not in git
set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
return()
endif()
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
endwhile()
# check if this is a submodule
if(NOT IS_DIRECTORY ${GIT_DIR})
file(READ ${GIT_DIR} submodule)
string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
endif()
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
if(NOT EXISTS "${GIT_DATA}")
file(MAKE_DIRECTORY "${GIT_DATA}")
endif()
if(NOT EXISTS "${GIT_DIR}/HEAD")
return()
endif()
set(HEAD_FILE "${GIT_DATA}/HEAD")
configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
"${GIT_DATA}/grabRef.cmake"
@ONLY)
include("${GIT_DATA}/grabRef.cmake")
set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
endfunction()
function(git_describe _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
get_git_head_revision(refspec hash)
if(NOT GIT_FOUND)
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
return()
endif()
if(NOT hash)
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
return()
endif()
# TODO sanitize
#if((${ARGN}" MATCHES "&&") OR
# (ARGN MATCHES "||") OR
# (ARGN MATCHES "\\;"))
# message("Please report the following error to the project!")
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
#endif()
#message(STATUS "Arguments to execute_process: ${ARGN}")
execute_process(COMMAND
"${GIT_EXECUTABLE}"
describe
${hash}
${ARGN}
WORKING_DIRECTORY
"${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE
res
OUTPUT_VARIABLE
out
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0)
set(out "${out}-${res}-NOTFOUND")
endif()
set(${_var} "${out}" PARENT_SCOPE)
endfunction()
function(git_get_exact_tag _var)
git_describe(out --exact-match ${ARGN})
set(${_var} "${out}" PARENT_SCOPE)
endfunction()
#
# Internal file for GetGitRevisionDescription.cmake
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
set(HEAD_HASH)
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
if(HEAD_CONTENTS MATCHES "ref")
# named branch
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
elseif(EXISTS "@GIT_DIR@/logs/${HEAD_REF}")
configure_file("@GIT_DIR@/logs/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
set(HEAD_HASH "${HEAD_REF}")
endif()
else()
# detached HEAD
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
endif()
if(NOT HEAD_HASH)
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
string(STRIP "${HEAD_HASH}" HEAD_HASH)
endif()
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
# - Combine lists of prefixes and suffixes in all combinations
#
# list_combinations(var PREFIXES listitems... SUFFIXES listitems...) -
# where var is the name of your desired output variable and PREFIXES
# and SUFFIXES are special arguments that indicate the start of your
# list of prefixes or suffixes respectively.
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__list_combinations)
return()
endif()
set(__list_combinations YES)
function(list_combinations var)
# Parse arguments
set(_prefixes)
set(_suffixes)
set(_nowhere)
set(_curdest _nowhere)
foreach(_element ${ARGN})
if("${_element}" STREQUAL "PREFIXES")
set(_curdest _prefixes)
elseif("${_element}" STREQUAL "SUFFIXES")
set(_curdest _suffixes)
else()
list(APPEND ${_curdest} "${_element}")
endif()
endforeach()
if(_nowhere)
message(STATUS "_prefixes ${_prefixes}")
message(STATUS "_prefixes ${_suffixes}")
message(STATUS "_prefixes ${_nowhere}")
message(FATAL_ERROR
"Syntax error in use of ${CMAKE_CURRENT_LIST_FILE}")
endif()
foreach(_prefix ${_prefixes})
foreach(_suffix ${_suffixes})
list(APPEND _out "${_prefix}${_suffix}")
endforeach()
endforeach()
set(${var} "${_out}" PARENT_SCOPE)
endfunction()
# - Compile with multiple processes on MSVC
#
# include(MSVCMultipleProcessCompile)
#
# Requires these CMake modules:
# ListCombinations.cmake
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(MSVC AND NOT "${MSVC_VERSION}" LESS 1400)
# Only available in VS 2005 and newer
string(TOUPPER "${CMAKE_CONFIGURATION_TYPES}" _conftypesUC)
include(ListCombinations)
list_combinations(_varnames
PREFIXES
CMAKE_C_FLAGS_
CMAKE_CXX_FLAGS_
SUFFIXES
${_conftypesUC})
foreach(_var ${_varnames})
set(${_var} "${${_var}} /MP")
endforeach()
endif()
# - Add an option that depends on one or more variables being true.
#
# option_requires(<option_name> <description> <variable_name> [<variable_name>...])
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
function(option_requires name desc)
set(args ${ARGN})
set(OFF_BY_DEFAULT false)
list(FIND args "OFF_BY_DEFAULT" _off_found)
if(NOT _off_found EQUAL -1)
list(REMOVE_AT args ${_off_found})
set(OFF_BY_DEFAULT true)
endif()
set(found)
set(missing)
foreach(var ${args})
if(${var})
list(APPEND found ${var})
else()
list(APPEND missing ${var})
endif()
endforeach()
if(NOT missing)
set(OK TRUE)
else()
set(OK FALSE)
endif()
set(default ${OK})
if(OFF_BY_DEFAULT)
set(default OFF)
endif()
option(${name} "${desc}" ${default})
if(${name} AND (NOT OK))
message(FATAL_ERROR
"${name} enabled but these dependencies were not valid: ${missing}")
endif()
endfunction()
# - For each given prefix in a list, glob using the prefix+pattern
#
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__prefix_list_glob)
return()
endif()
set(__prefix_list_glob YES)
function(prefix_list_glob var pattern)
set(_out)
set(_result)
foreach(prefix ${ARGN})
file(GLOB _globbed ${prefix}${pattern})
if(_globbed)
list(SORT _globbed)
list(REVERSE _globbed)
list(APPEND _out ${_globbed})
endif()
endforeach()
foreach(_name ${_out})
get_filename_component(_name "${_name}" ABSOLUTE)
list(APPEND _result "${_name}")
endforeach()
set(${var} "${_result}" PARENT_SCOPE)
endfunction()
# - Find bit-appropriate program files directories matching a given pattern
#
# Requires these CMake modules:
# CleanDirectoryList
# PrefixListGlob
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
include(PrefixListGlob)
include(CleanDirectoryList)
if(__program_files_glob)
return()
endif()
set(__program_files_glob YES)
function(program_files_glob var pattern)
# caution - ENV{ProgramFiles} on Win64 is adjusted to point to the arch
# of the running executable which, since CMake is 32-bit on Windows as
# I write this, will always be = $ENV{ProgramFiles(x86)}.
# Thus, we only use this environment variable if we are on a 32 machine
# 32-bit dir on win32, useless to us on win64
file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _PROG_FILES)
# 32-bit dir: only set on win64
file(TO_CMAKE_PATH "$ENV{ProgramFiles(x86)}" _PROG_FILES_X86)
# 64-bit dir: only set on win64
file(TO_CMAKE_PATH "$ENV{ProgramW6432}" _PROG_FILES_W6432)
if(CMAKE_SIZEOF_VOID_P MATCHES "8")
# 64-bit build on win64
set(_PROGFILESDIRS "${_PROG_FILES_W6432}")
else()
if(_PROG_FILES_W6432)
# 32-bit build on win64
set(_PROGFILESDIRS "${_PROG_FILES_X86}")
else()
# 32-bit build on win32
set(_PROGFILESDIRS "${_PROG_FILES}")
endif()
endif()
prefix_list_glob(_prefixed "${pattern}" ${_PROGFILESDIRS})
clean_directory_list(_prefixed)
set(${var} ${_prefixed} PARENT_SCOPE)
endfunction()
function(program_files_fallback_glob var pattern)
# caution - ENV{ProgramFiles} on Win64 is adjusted to point to the arch
# of the running executable which, since CMake is 32-bit on Windows as
# I write this, will always be = $ENV{ProgramFiles(x86)}.
# Thus, we only use this environment variable if we are on a 32 machine
# 32-bit dir on win32, useless to us on win64
file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _PROG_FILES)
# 32-bit dir: only set on win64
file(TO_CMAKE_PATH "$ENV{ProgramFiles(x86)}" _PROG_FILES_X86)
# 64-bit dir: only set on win64
file(TO_CMAKE_PATH "$ENV{ProgramW6432}" _PROG_FILES_W6432)
if(CMAKE_SIZEOF_VOID_P MATCHES "8")
# 64-bit build on win64
# look in the "32 bit" (c:\program files (x86)\) directory as a
# fallback in case of weird/poorly written installers, like those
# that put both 64- and 32-bit libs in the same program files directory
set(_PROGFILESDIRS "${_PROG_FILES_W6432}" "${_PROG_FILES_X86}")
else()
if(_PROG_FILES_W6432)
# 32-bit build on win64
# look in the "64 bit" (c:\program files\) directory as a fallback
# in case of old/weird/poorly written installers
set(_PROGFILESDIRS "${_PROG_FILES_X86}" "${_PROG_FILES_W6432}")
else()
# 32-bit build on win32
set(_PROGFILESDIRS "${_PROG_FILES}")
endif()
endif()
prefix_list_glob(_prefixed "${pattern}" ${_PROGFILESDIRS})
clean_directory_list(_prefixed)
set(${var} ${_prefixed} PARENT_SCOPE)
endfunction()