From 0e90a8b58e9bccb15296ffa433afffb86ce68bda Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Tue, 20 Nov 2018 16:51:47 -0600 Subject: [PATCH] Squashed 'cmake/' changes from cac13f1..38131f4 38131f4 Merge pull request #47 from wmamrak/patch-1 d4d1d54 Updated Windows 10 SDK versions ad436ee Add creator's update windows SDK to search directories. 6c3c6b0 Merge branch 'nickbroon-improve-cppcheck' 58843ae CppcheckTargets: update credits 66fe49e CppcheckTargets: fix indents 7638eb5 Rename convenience target back to all_cppcheck from cppcheck. 35e6823 Update requirement info for CppcheckTargets 065ecf1 Merge branch 'improve-cppcheck' of https://github.com/nickbroon/cmake-modules into nickbroon-improve-cppcheck 98e28d2 Merge pull request #44 from AlessandroMenti/boost-test-targets-check-fix 82e5a29 Merge pull request #45 from noma/master deca4d3 Added git_local_changes() to GetGitRevisionDescription.cmake 08987b5 Update to stash map config to make it actually properly push and pop c330929 New module: stash map config. 8a18a1b Add new InstallDebugSymbols module. 30573d3 Small JsonCpp cleanup. 2ef829d Fix "no target to set property" error in FindJsonCpp 997754e Fix wrong check in BoostTestTargets.cmake 41e1651 libusb1 enhancements from VRPN 7ef3955 Fixes to FindWindowsSDK so it doesn't return TRUE as the first element of every directory list. a497482 Fix indentation and accidentally-left-in debug messages in FindDirectShow b43b5e2 Bug fix in backported FindGit. 7c8c792 Add a greatly enhanced FindGLEW (for CMake 2.8.12+), based on the upstream. ec0c486 Add the Windows 10 1607 "Anniversary Update" SDK version to the WindowsSDK list. 7dc5198 Fix building against jsoncpp when the build types don't exactly match. 0875d12 FindSDL2: standardize indentation within the file. 75ba012 FindSDL2: Use MinGWSearchPathExtras if it's available and suitable. 66d7885 MinGW: build a list of prefixes too. 83f169b FindSDL2: sdlmain must come before sdl2. 6d639f6 Update list of dependencies in FindWinHID 2c5bec7 Update WinHID drastically to use FindWindowsSDK, so it can easily build against much newer SDKs/DDKs/WDKs. 2273ac4 Add two new functions to FindWindowsSDK eded907 Fix quietness of finding windows SDK and add comment 3f5f7df Add a module to help find things on MinGW (specifically MSYS2). c90ca93 Backported bugfixed version of WriteCompilerDetectionHeader. 6a941e5 ColibriApi: Module written for VRPN. 1dd3d89 Another flag in ExtraCompilerWarnings, to get GCC to stop whining about boost::optional. 90d1a89 Formatting fix in finddirectshow 8b37b27 Updated the InterSense finder to look in default install locations. bd6a7ca Improvements to the WindowsSDK finder for newer win10 sdks and better handling of them. 58ed198 Add a minor tweak to the VRPN module 83a2091 Add a FindJsonCpp module I wrote for various OSVR projects. faf198f Major improvements to FindSDL2 for Mac support. Thanks to David, aka @d235j for lots of help. fe2273c Add GenerateCompatibilityVersionFile, for keeping your msvc from compiling against your android builds. 01d0c41 Major improvements to FindWindowsSDK and FindDirectShow 16a3a8c Add an upstream "FindGit" from CMake 3.2.0 6bc6a53 Fix up create dashboard scripts to use a shared Git location. 1cc81cc Improve SDL2 finder 53d7c1b Improve quiet finding. dbd7ca2 Trailing newline 834581c Add a handful of new modules. 403a97d Fix copyright line. 3e2ae75 Merge pull request #40 from Meinersbur/patch-2 a3da0c4 Use CMAKE_CURRENT_SOURCE_DIR consistently 1932f85 Return to more conservative default settings. b1d2d88 cppcheck will check C as well as C++ a4561de Improvements on cppcheck 5b85e5c Merge pull request #23 from StudioEtrange/master e5a5957 Merge pull request #26 from tomgey/master 23aa3af Merge pull request #31 from janisz/Get_CPU_count be74670 Merge pull request #34 from redstar/packed_ref b9ae011 Use .git/packed-refs if ref is not found. c999fd3 Rename opencv finder to indicate it only looks for old OpenCV. 4fec79f Add CopyImportedTarget. 403d8a9 Update readme. eb5d23a Add udev and Xrandr finder, by @godbyk 5d6c1fe Add Oculus SDK finder - initial version by @godbyk, tweaks by me. d2d8ee7 VRPN: Optionally include LibUSB1 fe91913 Add some more ghost fake ehaders. 1cf5047 Update comment. 55d43d6 VRPN/quatlib: Look in where the VRPN CMake installs by default. 66ef6a7 Minor HIDAPI finding changes. 21d2a60 CMake >= 3.1 doesn't like the construction "$ENV{ProgramFiles(x86)}", so we work around it. 2ea7475 Improve directx support. af2331f Find and use MSCGEN in Doxygen. 2ff8db9 Merge pull request #32 from vladzzag/master fef6dfd Added FindWayland.cmake f9bdb65 Set CPU_Count in GetCPUDetails 0f545c3 Update launcher templates to match attributes. 5be4bc0 Add a module to extract a preprocessor definition. da8b557 Find libfreespace c230fc3 Get better at finding libusb1 without pkg-config 87b6fa2 Fix tabs 6870fac Update directshow, windowssdk, directx, and winhid (related) 9728850 Remove outdated/replaced module ceb6031 Don't use the -Weffc++ warning flag 7b5680a Improvements to doxygentargets 4bc009e Add gitattributes file, primarily to handle launcher templates. 1abc46a Fixes to DoxygenTargets.cmake 039b677 Merge pull request #27 from inolen/master 2ee9364 Update README.markdown 2784e2f added FORCE parameter to enable checking all preprocessor configurations use target's INCLUDE_DIRECTORIES property to pass include directories to cppcheck 370d602 BoostTestTargets: fix setting FAIL_REGULAR_EXPRESSION without TESTS list ee59dc8 BoostTestTargets: compatibility with CMake 2.6 08e6657 allow to use semi colon in var like ENVIRONMENT. We need this on windows for setting PATH variable. ce48ca6 agive a chance to choose PLATFORM and fxes when RUNTIME_LIBRARIES_ENVIRONMENT is empty 298ec78 Use CMAKE_CURRENT_SOURCE_DIR in GetGitRevisionDescription. 8def499 Windows SDK updates from working on VRPN 9244b84 Impending CMake 3.0 implies that 2.9.0 is no longer ~= infinity. 368d53e Update backported module and add backported ParseArguments. 5fa68c1 Merge pull request #19 from PiQuer/master ef7faf4 use CMAKE_CURRENT_LISTDIR instead of CMAKE_SOURCE_DIR as GIT_PARENT This guarantees that the search begins in the subdirectory (submodule) where the function is called. Otherwise we will most likely pick up the super-repository. e557594 Merge pull request #17 from gunnarbeutner/patch-1 dc238c7 Merge pull request #18 from PiQuer/master 41097f2 make GetGitRevisionDescription.cmake aware of submodules 67c8277 Fix syntax error in BoostTestTargets.cmake f77873d Update help files. 7eef0a6 Add FindInterSense.cmake 3f1a82f Fix up OpenHaptics nested targets. 4f298e1 Improve windows SDK finding. 11b88e5 Find DirectX XInput library 29bb4a7 Merge pull request #15 from freitass/patch-1 df6aaf4 Merge pull request #16 from lpberg/winhid-wdk8 a287055 added support for wdk8 in WinHID d3a5109 Make launchers on *nix executable 95ae78e Fix VR Juggler base path determination. c9b7f60 Fix CreateLaunchers to support forward-compatible VC versions ec42f07 Skip calibration.table - not used 739f05a Fix FindVRJuggler for newer cmake versions 7eb150d Update help. 3c6058b Update find vrjuggler 3.0 to work more reliably f72cefb Fixed cppcheck unusedFunction option f9fd40c Try handling new versions of cppdom that have their own config file. b13f248 Update WindowsSDK for VS2012 f763d94 Explicitly specify a binary dir for openhaptics nested targets. 0dd813a Update copyright date 1ad505f Update note about git-subtree 3af26c6 Improve finder for winhid git-subtree-dir: cmake git-subtree-split: 38131f4c7b0914b450c5d03396954629eb13c537 --- .gitattributes | 10 + BoostTestTargets.cmake | 32 +- CompatibilityVersionFile-BASIC.cmake.in | 19 + CompatibilityVersionFile-CXX_ABI.cmake.in | 29 + CompatibilityVersionFile-CXX_LAYOUT.cmake.in | 16 + CompatibilityVersionFile-C_ABI.cmake.in | 16 + CopyImportedTarget.cmake | 32 + CppcheckTargets.cmake | 66 +- CreateDashboardScripts.cmake | 21 +- CreateLaunchers.cmake | 78 +- DoxygenTargets.cmake | 69 +- DoxygenTargets.doxyfile.in | 5 + EnableExtraCompilerWarnings.cmake | 11 +- FindCPPDOM.cmake | 18 +- FindColibriApi.cmake | 120 +++ FindDirectInput.cmake | 180 ----- FindDirectShow.cmake | 88 ++- FindDirectX.cmake | 120 ++- FindGLEW.cmake | 132 ++++ FindHIDAPI.cmake | 6 +- FindInterSense.cmake | 108 +++ FindJsonCpp.cmake | 392 ++++++++++ FindLibFreespace.cmake | 78 ++ FindLibusb1.cmake | 11 +- FindOVR.cmake | 219 ++++++ FindOpenCV.cmake => FindOpenCV1.cmake | 0 FindOpenHaptics.cmake | 14 +- FindSDL2.cmake | 249 +++++++ FindVRJuggler.cmake | 6 +- FindVRJuggler30.cmake | 27 +- FindVRPN.cmake | 34 +- FindWayland.cmake | 45 ++ FindWinHID.cmake | 207 +++++- FindWindowsSDK.cmake | 626 ++++++++++++++-- FindXrandr.cmake | 78 ++ Findcppcheck.cmake | 8 +- Findquatlib.cmake | 13 +- Findudev.cmake | 77 ++ GenerateCompatibilityVersionFile.cmake | 83 +++ GetCPUDetails.cmake | 28 + GetDefineString.cmake | 58 ++ GetDefineString.cpp.in | 10 + GetGitRevisionDescription.cmake | 49 +- GetGitRevisionDescription.cmake.in | 11 +- GetMSVCVersion.cmake | 127 ++++ InstallDebugSymbols.cmake | 85 +++ MapImportedReleaseVariants.cmake | 21 + MinGWSearchPathExtras.cmake | 94 +++ PlatformDefinitions.cmake | 45 ++ ProgramFilesGlob.cmake | 23 +- README.markdown | 49 +- StashMapConfig.cmake | 86 +++ UseFolders.cmake | 34 + .../CMakePackageConfigHelpers.cmake | 254 ------- .../CMakePackageConfigHelpers.cmake | 358 +++++++++ .../CMakeParseArguments.cmake | 187 +++++ cmake-2.8.3-modules/FixWinInstallPrefix.cmake | 5 +- cmake-3.2.0-modules/FindGit.cmake | 106 +++ .../WriteCompilerDetectionHeader.cmake | 692 ++++++++++++++++++ .../RequireOutOfSourceBuild.cmake | 0 .../autoinclude.cmake | 0 .../from-ITK-3.18.0/FindFFTW.cmake | 0 ghost-fake-stl/alloc.h | 14 + ghost-fake-stl/hash_map.h | 28 + ghost-fake-stl/pair.h | 17 + launcher-templates/genericlauncher.cmd.in | 26 +- launcher-templates/launcher.env.cmd.in | 2 +- launcher-templates/perconfig.vcproj.user.in | 56 +- launcher-templates/perconfig.vcxproj.user.in | 14 +- launcher-templates/targetlauncher.cmd.in | 14 +- launcher-templates/vcproj.user.in | 20 +- launcher-templates/vcxproj.user.in | 8 +- module-help.html | 389 ++++++---- module-help.txt | 52 +- nested_targets/OpenHaptics/CMakeLists.txt | 8 +- 75 files changed, 5341 insertions(+), 972 deletions(-) create mode 100644 .gitattributes create mode 100644 CompatibilityVersionFile-BASIC.cmake.in create mode 100644 CompatibilityVersionFile-CXX_ABI.cmake.in create mode 100644 CompatibilityVersionFile-CXX_LAYOUT.cmake.in create mode 100644 CompatibilityVersionFile-C_ABI.cmake.in create mode 100644 CopyImportedTarget.cmake create mode 100644 FindColibriApi.cmake delete mode 100644 FindDirectInput.cmake create mode 100644 FindGLEW.cmake create mode 100644 FindInterSense.cmake create mode 100644 FindJsonCpp.cmake create mode 100644 FindLibFreespace.cmake create mode 100644 FindOVR.cmake rename FindOpenCV.cmake => FindOpenCV1.cmake (100%) create mode 100644 FindSDL2.cmake create mode 100644 FindWayland.cmake create mode 100644 FindXrandr.cmake create mode 100644 Findudev.cmake create mode 100644 GenerateCompatibilityVersionFile.cmake create mode 100644 GetDefineString.cmake create mode 100644 GetDefineString.cpp.in create mode 100644 GetMSVCVersion.cmake create mode 100644 InstallDebugSymbols.cmake create mode 100644 MapImportedReleaseVariants.cmake create mode 100644 MinGWSearchPathExtras.cmake create mode 100644 PlatformDefinitions.cmake create mode 100644 StashMapConfig.cmake create mode 100644 UseFolders.cmake delete mode 100644 cmake-2.8.10-modules/CMakePackageConfigHelpers.cmake create mode 100644 cmake-2.8.12-modules/CMakePackageConfigHelpers.cmake create mode 100644 cmake-2.8.12-modules/CMakeParseArguments.cmake create mode 100644 cmake-3.2.0-modules/FindGit.cmake create mode 100644 cmake-3.3.0-modules/WriteCompilerDetectionHeader.cmake rename {cmake-2.9.0-modules => cmake-4.0.0-modules}/RequireOutOfSourceBuild.cmake (100%) rename {cmake-2.9.0-modules => cmake-4.0.0-modules}/autoinclude.cmake (100%) rename {cmake-2.9.0-modules => cmake-4.0.0-modules}/from-ITK-3.18.0/FindFFTW.cmake (100%) create mode 100644 ghost-fake-stl/alloc.h create mode 100644 ghost-fake-stl/hash_map.h create mode 100644 ghost-fake-stl/pair.h diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..c20db92 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,10 @@ +# Auto detect text files and perform LF normalization +* text=auto + +*.sh text eol=lf + +# cmake launcher templates +*.sh.in text eol=lf +*.cmd.in text eol=crlf +*vcproj.user.in text eol=crlf +*vcxproj.user.in text eol=crlf diff --git a/BoostTestTargets.cmake b/BoostTestTargets.cmake index 05d59c1..31b3ae6 100644 --- a/BoostTestTargets.cmake +++ b/BoostTestTargets.cmake @@ -93,19 +93,6 @@ function(add_boost_test _name) if(NOT BUILD_TESTING) return() endif() - if("${CMAKE_VERSION}" VERSION_LESS "2.8.0") - if(NOT "${_boost_test_cmakever_pestered}x" EQUALS "${CMAKE_VERSION}x") - message(STATUS - "Not adding boost::test targets - CMake 2.8.0 or newer required, using ${CMAKE_VERSION}") - set(_boost_test_cmakever_pestered - "${CMAKE_VERSION}" - CACHE - INTERNAL - "" - FORCE) - endif() - return() - endif() # parse arguments set(_nowhere) @@ -172,7 +159,7 @@ function(add_boost_test _name) endforeach() if(NOT _boostTestTargetsNagged${_name} STREQUAL "${includeType}") - if("includeType" STREQUAL "CONFIGURED") + if("${includeType}" STREQUAL "CONFIGURED") message(STATUS "Test '${_name}' uses the CMake-configurable form of the boost test framework - congrats! (Including File: ${includeFileLoc})") elseif("${includeType}" STREQUAL "INCLUDED") @@ -238,12 +225,10 @@ function(add_boost_test _name) if(TESTS AND ( "${Boost_VERSION}" VERSION_GREATER "103799" )) foreach(_test ${TESTS}) - add_test(NAME + add_test( ${_name}-${_test} - COMMAND - ${_test_command} - --run_test=${_test} - ${Boost_TEST_FLAGS}) + ${_test_command} --run_test=${_test} ${Boost_TEST_FLAGS} + ) if(FAIL_REGULAR_EXPRESSION) set_tests_properties(${_name}-${_test} PROPERTIES @@ -252,13 +237,12 @@ function(add_boost_test _name) endif() endforeach() else() - add_test(NAME + add_test( ${_name}-boost_test - COMMAND - ${_test_command} - ${Boost_TEST_FLAGS}) + ${_test_command} ${Boost_TEST_FLAGS} + ) if(FAIL_REGULAR_EXPRESSION) - set_tests_properties(${_name}-${_test} + set_tests_properties(${_name}-boost_test PROPERTIES FAIL_REGULAR_EXPRESSION "${FAIL_REGULAR_EXPRESSION}") diff --git a/CompatibilityVersionFile-BASIC.cmake.in b/CompatibilityVersionFile-BASIC.cmake.in new file mode 100644 index 0000000..d2b97ba --- /dev/null +++ b/CompatibilityVersionFile-BASIC.cmake.in @@ -0,0 +1,19 @@ +# will always be the actual version one +# Wrapped in a macro because it's got a return before we want. +macro(_gcvf_version) + @GCVF_PREVIOUS_FILE@ +endmacro() +_gcvf_version() + + +if(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "@CMAKE_SYSTEM_NAME@") + set(PACKAGE_VERSION "${PACKAGE_VERSION} (@CMAKE_SYSTEM_NAME@)") + set(PACKAGE_VERSION_UNSUITABLE TRUE) + return() +endif() + +if(ANDROID AND NOT ("${ANDROID_ABI}" STREQUAL "@ANDROID_ABI@")) + set(PACKAGE_VERSION "${PACKAGE_VERSION} (Android @ANDROID_ABI@)") + set(PACKAGE_VERSION_UNSUITABLE TRUE) + return() +endif() \ No newline at end of file diff --git a/CompatibilityVersionFile-CXX_ABI.cmake.in b/CompatibilityVersionFile-CXX_ABI.cmake.in new file mode 100644 index 0000000..f09043d --- /dev/null +++ b/CompatibilityVersionFile-CXX_ABI.cmake.in @@ -0,0 +1,29 @@ +@GCVF_PREVIOUS_FILE@ + +if(MSVC) + if(NOT "${MSVC_VERSION}" STREQUAL "@MSVC_VERSION@") + set(PACKAGE_VERSION "${PACKAGE_VERSION} (@GCVF_WIN_CXXLAYOUT@)") + set(PACKAGE_VERSION_UNSUITABLE TRUE) + return() + endif() +endif() + +macro(_gcvf_compute_cxxabi _var _compilerid _compilerver) + set(${_var}) + if("${_compilerid}" STREQUAL "GNU" AND NOT ("${_compilerver}" STREQUAL "")) + if("${_compilerver}" VER_LESS 5.0) + # This is pre-gcc5, not compatible with post-gcc5 + set(${_var} "g++ < 5.0") + else() + set(${_var} "g++ >= 5.0") + endif() + endif() +endmacro() +_gcvr_compute_cxxabi(_installed_cxx "@CMAKE_CXX_COMPILER_ID@" "@CMAKE_CXX_COMPILER_VERSION@") +_gcvr_compute_cxxabi(_current_cxx "${CMAKE_CXX_COMPILER_ID}" "${CMAKE_CXX_COMPILER_VERSION}") + +# if(NOT "${_installed_cxx}" STREQUAL "${_current_cxx}") +# set(PACKAGE_VERSION "${PACKAGE_VERSION} (${_installed_cxx})") +# set(PACKAGE_VERSION_UNSUITABLE TRUE) +# return() +# endif() diff --git a/CompatibilityVersionFile-CXX_LAYOUT.cmake.in b/CompatibilityVersionFile-CXX_LAYOUT.cmake.in new file mode 100644 index 0000000..8f98a08 --- /dev/null +++ b/CompatibilityVersionFile-CXX_LAYOUT.cmake.in @@ -0,0 +1,16 @@ +@GCVF_PREVIOUS_FILE@ + +set(GCVF_WIN_CXXLAYOUT) +if(MSVC) + set(GCVF_WIN_CXXLAYOUT "MSVC") +elseif(MINGW) + set(GCVF_WIN_CXXLAYOUT "MinGW") +elseif(WIN32) + set(GCVF_WIN_CXXLAYOUT "other") +endif() + +if(NOT "@GCVF_WIN_CXXLAYOUT@" STREQUAL "${GCVF_WIN_CXXLAYOUT}") + set(PACKAGE_VERSION "${PACKAGE_VERSION} (@GCVF_WIN_CXXLAYOUT@)") + set(PACKAGE_VERSION_UNSUITABLE TRUE) + return() +endif() diff --git a/CompatibilityVersionFile-C_ABI.cmake.in b/CompatibilityVersionFile-C_ABI.cmake.in new file mode 100644 index 0000000..656e90f --- /dev/null +++ b/CompatibilityVersionFile-C_ABI.cmake.in @@ -0,0 +1,16 @@ +@GCVF_PREVIOUS_FILE@ + +if(NOT ("${CMAKE_C_COMPILER_ABI}" STREQUAL "") AND NOT ("@CMAKE_C_COMPILER_ABI@" STREQUAL "")) + if(NOT "${CMAKE_C_COMPILER_ABI}" STREQUAL "@CMAKE_C_COMPILER_ABI@") + set(PACKAGE_VERSION "${PACKAGE_VERSION} (@CMAKE_C_COMPILER_ABI@)") + set(PACKAGE_VERSION_UNSUITABLE TRUE) + return() + endif() +endif() + +if(NOT "${CMAKE_C_COMPILER_TARGET}" STREQUAL "@CMAKE_C_COMPILER_TARGET@") + set(PACKAGE_VERSION "${PACKAGE_VERSION} (@CMAKE_C_COMPILER_TARGET@)") + set(PACKAGE_VERSION_UNSUITABLE TRUE) + return() +endif() +# todo anything for a C ABI beyond just "basic"? \ No newline at end of file diff --git a/CopyImportedTarget.cmake b/CopyImportedTarget.cmake new file mode 100644 index 0000000..fed23b4 --- /dev/null +++ b/CopyImportedTarget.cmake @@ -0,0 +1,32 @@ +# - Copy shared libraries from imported targets to the target build directory +# on Windows during post-build. Install them in all cases. +# +# copy_imported_targets( [ ...]) +# +# install_imported_target( +# +# Copyright Sensics, Inc. 2015. +# 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(copy_imported_targets _target) + foreach(_dep ${ARGN}) + if(WIN32) + add_custom_command(TARGET ${_target} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy $ $ + COMMENT "Copying required DLL for dependency ${_dep}" + VERBATIM) + endif() + endforeach() +endfunction() + + +function(install_imported_target _dep) + install(FILES $ ${ARGN}) +endfunction() diff --git a/CppcheckTargets.cmake b/CppcheckTargets.cmake index 8553e08..cb21bed 100644 --- a/CppcheckTargets.cmake +++ b/CppcheckTargets.cmake @@ -1,22 +1,26 @@ # - Run cppcheck on c++ source files as a custom target and a test # # include(CppcheckTargets) -# add_cppcheck( [UNUSED_FUNCTIONS] [STYLE] [POSSIBLE_ERROR] [FAIL_ON_WARNINGS]) - +# add_cppcheck( [UNUSED_FUNCTIONS] [STYLE] [POSSIBLE_ERROR] [FORCE] [FAIL_ON_WARNINGS]) - # Create a target to check a target's sources with cppcheck and the indicated options -# add_cppcheck_sources( [UNUSED_FUNCTIONS] [STYLE] [POSSIBLE_ERROR] [FAIL_ON_WARNINGS]) - +# add_cppcheck_sources( [UNUSED_FUNCTIONS] [STYLE] [POSSIBLE_ERROR] [FORCE] [FAIL_ON_WARNINGS]) - # Create a target to check standalone sources with cppcheck and the indicated options # # Requires these CMake modules: # Findcppcheck # -# Requires CMake 2.6 or newer (uses the 'function' command) +# Requires CMake 2.8 or newer (uses VERSION_LESS) # # Original Author: -# 2009-2010 Ryan Pavlik +# 2009-2010 Ryan Pavlik # http://academic.cleardefinition.com # Iowa State University HCI Graduate Program/VRAC # # Copyright Iowa State University 2009-2010. +# Copyright Anthony Pesch 2014 +# Copyright Stefan Eilemann 2014 +# Copyright Nicholas Brown 2015 +# Copyright Ryan Pavlik 2017 # 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) @@ -30,16 +34,24 @@ if(NOT CPPCHECK_FOUND) find_package(cppcheck QUIET) endif() -if(CPPCHECK_FOUND) - if(NOT TARGET all_cppcheck) - add_custom_target(all_cppcheck) - set_target_properties(all_cppcheck PROPERTIES EXCLUDE_FROM_ALL TRUE) - endif() +if(NOT CPPCHECK_FOUND) + add_custom_target(all_cppcheck + COMMENT "cppcheck executable not found") + set_target_properties(all_cppcheck PROPERTIES EXCLUDE_FROM_ALL TRUE) +elseif(CPPCHECK_VERSION VERSION_LESS 1.53.0) + add_custom_target(all_cppcheck + COMMENT "Need at least cppcheck 1.53, found ${CPPCHECK_VERSION}") + set_target_properties(all_cppcheck PROPERTIES EXCLUDE_FROM_ALL TRUE) + set(CPPCHECK_FOUND) +endif() + +if(NOT TARGET all_cppcheck) + add_custom_target(all_cppcheck) endif() function(add_cppcheck_sources _targetname) if(CPPCHECK_FOUND) - set(_cppcheck_args) + set(_cppcheck_args -I ${CMAKE_SOURCE_DIR} ${CPPCHECK_EXTRA_ARGS}) set(_input ${ARGN}) list(FIND _input UNUSED_FUNCTIONS _unused_func) if("${_unused_func}" GREATER "-1") @@ -59,6 +71,12 @@ function(add_cppcheck_sources _targetname) list(REMOVE_AT _input ${_poss_err}) endif() + list(FIND _input FORCE _force) + if("${_force}" GREATER "-1") + list(APPEND _cppcheck_args "--force") + list(REMOVE_AT _input ${_force}) + endif() + list(FIND _input FAIL_ON_WARNINGS _fail_on_warn) if("${_fail_on_warn}" GREATER "-1") list(APPEND @@ -73,7 +91,7 @@ function(add_cppcheck_sources _targetname) if(_cppcheck_loc) # This file has a source file property, carry on. get_source_file_property(_cppcheck_lang "${_source}" LANGUAGE) - if("${_cppcheck_lang}" MATCHES "CXX") + if(("${_cppcheck_lang}" STREQUAL "C") OR ("${_cppcheck_lang}" STREQUAL "CXX")) list(APPEND _files "${_cppcheck_loc}") endif() else() @@ -113,9 +131,7 @@ function(add_cppcheck_sources _targetname) FAIL_REGULAR_EXPRESSION "${CPPCHECK_FAIL_REGULAR_EXPRESSION}") - add_custom_command(TARGET - all_cppcheck - PRE_BUILD + add_custom_target(${_targetname}_cppcheck COMMAND ${CPPCHECK_EXECUTABLE} ${CPPCHECK_QUIET_ARG} @@ -127,6 +143,7 @@ function(add_cppcheck_sources _targetname) COMMENT "${_targetname}_cppcheck: Running cppcheck on target ${_targetname}..." VERBATIM) + add_dependencies(cppcheck ${_targetname}_cppcheck) endif() endfunction() @@ -136,7 +153,7 @@ function(add_cppcheck _name) "add_cppcheck given a target name that does not exist: '${_name}' !") endif() if(CPPCHECK_FOUND) - set(_cppcheck_args) + set(_cppcheck_args -I ${CMAKE_SOURCE_DIR} ${CPPCHECK_EXTRA_ARGS}) list(FIND ARGN UNUSED_FUNCTIONS _unused_func) if("${_unused_func}" GREATER "-1") @@ -153,6 +170,11 @@ function(add_cppcheck _name) list(APPEND _cppcheck_args ${CPPCHECK_POSSIBLEERROR_ARG}) endif() + list(FIND ARGN FORCE _force) + if("${_force}" GREATER "-1") + list(APPEND _cppcheck_args "--force") + endif() + list(FIND _input FAIL_ON_WARNINGS _fail_on_warn) if("${_fail_on_warn}" GREATER "-1") list(APPEND @@ -161,12 +183,18 @@ function(add_cppcheck _name) list(REMOVE_AT _input ${_unused_func}) endif() + get_target_property(_cppcheck_includes "${_name}" INCLUDE_DIRECTORIES) + set(_includes) + foreach(_include ${_cppcheck_includes}) + list(APPEND _includes "-I${_include}") + endforeach() + get_target_property(_cppcheck_sources "${_name}" SOURCES) set(_files) foreach(_source ${_cppcheck_sources}) get_source_file_property(_cppcheck_lang "${_source}" LANGUAGE) get_source_file_property(_cppcheck_loc "${_source}" LOCATION) - if("${_cppcheck_lang}" MATCHES "CXX") + if(("${_cppcheck_lang}" STREQUAL "C") OR ("${_cppcheck_lang}" STREQUAL "CXX")) list(APPEND _files "${_cppcheck_loc}") endif() endforeach() @@ -194,20 +222,20 @@ function(add_cppcheck _name) FAIL_REGULAR_EXPRESSION "${CPPCHECK_FAIL_REGULAR_EXPRESSION}") - add_custom_command(TARGET - all_cppcheck - PRE_BUILD + add_custom_target(${_name}_cppcheck COMMAND ${CPPCHECK_EXECUTABLE} ${CPPCHECK_QUIET_ARG} ${CPPCHECK_TEMPLATE_ARG} ${_cppcheck_args} + ${_includes} ${_files} WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" COMMENT "${_name}_cppcheck: Running cppcheck on target ${_name}..." VERBATIM) + add_dependencies(all_cppcheck ${_name}_cppcheck) endif() endfunction() diff --git a/CreateDashboardScripts.cmake b/CreateDashboardScripts.cmake index ec1664a..22420b5 100644 --- a/CreateDashboardScripts.cmake +++ b/CreateDashboardScripts.cmake @@ -16,7 +16,8 @@ # Requires these CMake modules: # GetCompilerInfoString # -# Requires CMake 2.6 or newer (uses the 'function' command) +# Requires CMake 2.6 or newer (uses the 'function' command), +# as well as FindGit.cmake (included with 2.8.2, may be backported) # # Original Author: # 2009-2010 Ryan Pavlik @@ -118,13 +119,21 @@ if(NOT IN_DASHBOARD_SCRIPT) if(NOT "1.${CMAKE_VERSION}" VERSION_LESS "1.2.8.0") if(IS_DIRECTORY "${CMAKE_SOURCE_DIRECTORY}/.git") - find_program(DASHBOARDSCRIPT_GIT_EXECUTABLE NAMES git git.cmd) - if(DASHBOARDSCRIPT_GIT_EXECUTABLE) - + if(NOT GIT_FOUND) + find_package(Git QUIET) + endif() + # If we have a valid git we found ourselves in older version of the module, + # let the regular FindGit module (since 2.8.2) know. + if(DASHBOARDSCRIPT_GIT_EXECUTABLE AND EXISTS "${DASHBOARDSCRIPT_GIT_EXECUTABLE}" AND NOT GIT_FOUND) + set(GIT_EXECUTABLE "${DASHBOARDSCRIPT_GIT_EXECUTABLE}" CACHE FILEPATH "Git executable" FORCE) + find_package(Git QUIET) + endif() + unset(DASHBOARDSCRIPT_GIT_EXECUTABLE) + unset(DASHBOARDSCRIPT_GIT_EXECUTABLE CACHE) + if(GIT_FOUND) set(UPDATE_TYPE "git") - set(UPDATE_COMMAND "${DASHBOARDSCRIPT_GIT_EXECUTABLE}") + set(UPDATE_COMMAND "${GIT_EXECUTABLE}") set(UPDATE_OPTIONS "") - mark_as_advanced(DASHBOARDSCRIPT_GIT_EXECUTABLE) endif() endif() endif() diff --git a/CreateLaunchers.cmake b/CreateLaunchers.cmake index 6cbf234..571f044 100644 --- a/CreateLaunchers.cmake +++ b/CreateLaunchers.cmake @@ -67,19 +67,17 @@ macro(_launcher_system_settings) set(VCPROJ_TYPE vcproj) set(USERFILE_EXTENSION ${SYSTEM_NAME}.${USER_NAME}.user) set(LAUNCHER_LINESEP " ") - if(MSVC10) - set(LAUNCHER_LINESEP "\n") - set(USERFILE_VC_VERSION 10.00) - set(USERFILE_EXTENSION user) - set(VCPROJ_TYPE vcxproj) - elseif(MSVC90) + if(MSVC90) set(USERFILE_VC_VERSION 9.00) elseif(MSVC80) set(USERFILE_VC_VERSION 8.00) elseif(MSVC71) set(USERFILE_VC_VERSION 7.10) - elseif(MSVC) - message(STATUS "MSVC but unrecognized version!") + elseif(MSVC10 OR (MSVC AND MSVC_VERSION GREATER 1600)) # 2010 or newer + set(LAUNCHER_LINESEP "\n") + set(USERFILE_VC_VERSION 10.00) + set(USERFILE_EXTENSION user) + set(VCPROJ_TYPE vcxproj) endif() if(BITS EQUAL 64) set(USERFILE_PLATFORM x64) @@ -116,12 +114,14 @@ macro(_launcher_process_args) ARGS RUNTIME_LIBRARY_DIRS WORKING_DIRECTORY - ENVIRONMENT) + ENVIRONMENT + TARGET_PLATFORM) set(_bool_args FORWARD_ARGS) foreach(_arg ${_val_args} ${_bool_args}) set(${_arg}) endforeach() foreach(_element ${ARGN}) + string(REPLACE ";" "\\;" _element "${_element}") list(FIND _val_args "${_element}" _val_arg_find) list(FIND _bool_args "${_element}" _bool_arg_find) if("${_val_arg_find}" GREATER "-1") @@ -160,22 +160,31 @@ macro(_launcher_process_args) set(FWD_ARGS) endif() + if(TARGET_PLATFORM) + set(USERFILE_PLATFORM ${TARGET_PLATFORM}) + endif() + set(USERFILE_WORKING_DIRECTORY "${WORKING_DIRECTORY}") set(USERFILE_COMMAND_ARGUMENTS "${ARGS}") set(LAUNCHERSCRIPT_COMMAND_ARGUMENTS "${ARGS} ${FWD_ARGS}") if(WIN32) - set(RUNTIME_LIBRARIES_ENVIRONMENT "PATH=${_runtime_lib_dirs};%PATH%") + if(_runtime_lib_dirs) + set(RUNTIME_LIBRARIES_ENVIRONMENT "PATH=${_runtime_lib_dirs};%PATH%") + endif() file(READ "${_launchermoddir}/launcher.env.cmd.in" _cmdenv) else() - if(APPLE) - set(RUNTIME_LIBRARIES_ENVIRONMENT - "DYLD_LIBRARY_PATH=${_runtime_lib_dirs}:$DYLD_LIBRARY_PATH") - else() - set(RUNTIME_LIBRARIES_ENVIRONMENT - "LD_LIBRARY_PATH=${_runtime_lib_dirs}:$LD_LIBRARY_PATH") + if(_runtime_lib_dirs) + if(APPLE) + + set(RUNTIME_LIBRARIES_ENVIRONMENT + "DYLD_LIBRARY_PATH=${_runtime_lib_dirs}:$DYLD_LIBRARY_PATH") + else() + set(RUNTIME_LIBRARIES_ENVIRONMENT + "LD_LIBRARY_PATH=${_runtime_lib_dirs}:$LD_LIBRARY_PATH") + endif() endif() file(READ "${_launchermoddir}/launcher.env.sh.in" @@ -185,10 +194,12 @@ macro(_launcher_process_args) set(USERFILE_ENV_COMMANDS) foreach(_arg "${RUNTIME_LIBRARIES_ENVIRONMENT}" ${ENVIRONMENT}) - string(CONFIGURE - "@USERFILE_ENVIRONMENT@@LAUNCHER_LINESEP@@_arg@" - USERFILE_ENVIRONMENT - @ONLY) + if(_arg) + string(CONFIGURE + "@USERFILE_ENVIRONMENT@@LAUNCHER_LINESEP@@_arg@" + USERFILE_ENVIRONMENT + @ONLY) + endif() string(CONFIGURE "@USERFILE_ENV_COMMANDS@${_cmdenv}" USERFILE_ENV_COMMANDS @@ -224,6 +235,17 @@ macro(_launcher_produce_vcproj_user) endmacro() +macro(_launcher_configure_executable _src _tmp _target) +# get_filename_component(_targetname "${_target}" NAME) + get_filename_component(_targetpath "${_target}" PATH) + configure_file("${_src}" + "${_tmp}" + @ONLY) + file(COPY "${_tmp}" + DESTINATION "${_targetpath}" + FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) +endmacro() + macro(_launcher_create_target_launcher) if(CMAKE_CONFIGURATION_TYPES) # Multi-config generator - multiple launchers @@ -234,9 +256,10 @@ macro(_launcher_create_target_launcher) file(TO_NATIVE_PATH "${USERFILE_${_config}_COMMAND}" USERFILE_COMMAND) - configure_file("${_launchermoddir}/targetlauncher.${_suffix}.in" - "${CMAKE_CURRENT_BINARY_DIR}/launch-${_targetname}-${_config}.${_suffix}" - @ONLY) + set(_fn "launch-${_targetname}-${_config}.${_suffix}") + _launcher_configure_executable("${_launchermoddir}/targetlauncher.${_suffix}.in" + "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_fn}" + "${CMAKE_CURRENT_BINARY_DIR}/${_fn}") endforeach() else() # Single-config generator - single launcher @@ -246,7 +269,8 @@ macro(_launcher_create_target_launcher) file(TO_NATIVE_PATH "${USERFILE_COMMAND}" USERFILE_COMMAND) - configure_file("${_launchermoddir}/targetlauncher.${_suffix}.in" + _launcher_configure_executable("${_launchermoddir}/targetlauncher.${_suffix}.in" + "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/launch-${_targetname}.${_suffix}" "${CMAKE_CURRENT_BINARY_DIR}/launch-${_targetname}.${_suffix}" @ONLY) endif() @@ -291,9 +315,9 @@ function(create_generic_launcher _launchername) "Program terminated with signal") endif() - configure_file("${_launchermoddir}/genericlauncher.${_suffix}.in" - "${_launchername}" - @ONLY) + _launcher_configure_executable("${_launchermoddir}/genericlauncher.${_suffix}.in" + "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/genericlauncher.${_suffix}.in" + "${_launchername}") endfunction() function(guess_runtime_library_dirs _var) diff --git a/DoxygenTargets.cmake b/DoxygenTargets.cmake index 2c6bc78..df7c088 100644 --- a/DoxygenTargets.cmake +++ b/DoxygenTargets.cmake @@ -2,6 +2,9 @@ # # include(DoxygenTargets) # add_doxygen( [OUTPUT_DIRECTORY ] +# [EXTRA_INPUT ] +# [EXTRA_STRIP_FROM_PATH ] +# [EXTRA_STRIP_FROM_INC_PATH ] # [INSTALL_DESTINATION # [INSTALL_COMPONENT ] # [INSTALL_PDF_NAME ] ] @@ -59,6 +62,17 @@ if(PDFLATEX_COMPILER) set(DOXYGEN_PDFLATEX "YES") endif() +set(_PF86 "ProgramFiles(x86)") +find_program(DOXYGEN_MSCGEN_EXECUTABLE + mscgen + PATHS + "$ENV{ProgramFiles}/Mscgen" + "$ENV{${_PF86}}/Mscgen" + "$ENV{ProgramW6432}/Mscgen") +if(DOXYGEN_MSCGEN_EXECUTABLE) + mark_as_advanced(DOXYGEN_MSCGEN_EXECUTABLE) +endif() + # An optional single-file install that supports cmake older than 2.8.0 # For internal use function(_dt_install_file target filename dest rename) @@ -147,6 +161,9 @@ function(add_doxygen _doxyfile) set(_curdest _nowhere) set(_val_args OUTPUT_DIRECTORY + EXTRA_INPUT + EXTRA_STRIP_FROM_PATH + EXTRA_STRIP_FROM_INC_PATH DOC_TARGET INSTALL_DESTINATION INSTALL_COMPONENT @@ -198,22 +215,8 @@ function(add_doxygen _doxyfile) endif() if(DOXYGEN_FOUND) - if(NOT TARGET ${DOC_TARGET}) - - if(NOT IN_DASHBOARD_SCRIPT) - add_custom_target(${DOC_TARGET}) - set_target_properties(${DOC_TARGET} - PROPERTIES - EXCLUDE_FROM_ALL - TRUE) - set_target_properties(${DOC_TARGET} - PROPERTIES - EXCLUDE_FROM_DEFAULT_BUILD - TRUE) - else() - add_custom_target(${DOC_TARGET} ALL) - endif() - + if(TARGET ${DOC_TARGET}) + message(FATAL_ERROR "Documentation target ${DOC_TARGET} already exists!") endif() if(NOT IS_ABSOLUTE "${OUTPUT_DIRECTORY}") @@ -232,13 +235,14 @@ function(add_doxygen _doxyfile) if(NOT TARGET ${DOC_TARGET}_open) # Create a target to open the generated HTML file. if(WIN32) - set(DOXYGEN_LAUNCHER_COMMAND start "Documentation") + set(DOXYGEN_LAUNCHER_COMMAND start) elseif(NOT APPLE) set(DOXYGEN_LAUNCHER_COMMAND xdg-open) endif() if(DOXYGEN_LAUNCHER_COMMAND) add_custom_target(${DOC_TARGET}_open - COMMAND ${DOXYGEN_LAUNCHER_COMMAND} "${OUTPUT_DIRECTORY}/html/index.html") + COMMAND ${DOXYGEN_LAUNCHER_COMMAND} "${OUTPUT_DIRECTORY}/html/index.html" + VERBATIM) set_target_properties(${DOC_TARGET}_open PROPERTIES EXCLUDE_FROM_ALL @@ -278,6 +282,10 @@ function(add_doxygen _doxyfile) set(DOT_PATH) endif() + if(DOXYGEN_MSCGEN_EXECUTABLE) + get_filename_component(MSCGEN_PATH "${DOXYGEN_MSCGEN_EXECUTABLE}" PATH) + endif() + # See http://www.cmake.org/pipermail/cmake/2006-August/010786.html # for info on this variable if("${CMAKE_BUILD_TOOL}" MATCHES "(msdev|devenv)") @@ -287,14 +295,19 @@ function(add_doxygen _doxyfile) endif() configure_file("${_doxygenmoddir}/DoxygenTargets.doxyfile.in" - "${CMAKE_CURRENT_BINARY_DIR}/${_doxyfile}.additional" + "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.${DOC_TARGET}.additional" @ONLY) - add_custom_command(TARGET - ${DOC_TARGET} + if(IN_DASHBOARD_SCRIPT) + set(ALL_IN_DASHBOARD ALL) + else() + set(ALL_IN_DASHBOARD) + endif() + + add_custom_target(${DOC_TARGET} ${ALL_IN_DASHBOARD} COMMAND - ${DOXYGEN_EXECUTABLE} - "${CMAKE_CURRENT_BINARY_DIR}/${_doxyfile}.additional" + "${DOXYGEN_EXECUTABLE}" + "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.${DOC_TARGET}.additional" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" #MAIN_DEPENDENCY ${DOC_TARGET} @@ -302,6 +315,16 @@ function(add_doxygen _doxyfile) "Running Doxygen with configuration ${_doxyfile}..." VERBATIM) + if(NOT IN_DASHBOARD_SCRIPT) + set_target_properties(${DOC_TARGET} + PROPERTIES + EXCLUDE_FROM_ALL + TRUE) + set_target_properties(${DOC_TARGET} + PROPERTIES + EXCLUDE_FROM_DEFAULT_BUILD + TRUE) + endif() if(MAKE_PDF) add_custom_command(TARGET ${DOC_TARGET} diff --git a/DoxygenTargets.doxyfile.in b/DoxygenTargets.doxyfile.in index e08f56e..3cf36ab 100644 --- a/DoxygenTargets.doxyfile.in +++ b/DoxygenTargets.doxyfile.in @@ -6,6 +6,7 @@ GENERATE_LATEX = "@GENERATE_LATEX@" USE_PDFLATEX = @USE_PDFLATEX@ HAVE_DOT = @HAVE_DOT@ DOT_PATH = "@DOT_PATH@" +MSCGEN_PATH = "@MSCGEN_PATH@" LATEX_CMD_NAME = "@LATEX_COMPILER@" MAKEINDEX_CMD_NAME = "@MAKEINDEX_COMPILER@" @@ -14,5 +15,9 @@ WARN_FORMAT = @WARN_FORMAT@ PROJECT_NUMBER = @PROJECT_NUMBER@ +INPUT += @EXTRA_INPUT@ +STRIP_FROM_PATH += @EXTRA_STRIP_FROM_PATH@ +STRIP_FROM_INC_PATH += @EXTRA_STRIP_FROM_INC_PATH@ + LATEX_BATCHMODE = YES QUIET = YES diff --git a/EnableExtraCompilerWarnings.cmake b/EnableExtraCompilerWarnings.cmake index 0115ef3..4c0e5c7 100644 --- a/EnableExtraCompilerWarnings.cmake +++ b/EnableExtraCompilerWarnings.cmake @@ -50,9 +50,14 @@ macro(_enable_extra_compiler_warnings_flags) set(_flags "${_flags} -Wextra") endif() - check_cxx_compiler_flag(-Weffc++ SUPPORTS_WEFFCXX_FLAG) - if(SUPPORTS_WEFFCXX_FLAG) - set(_flags "${_flags} -Weffc++") + if(SUPPORTS_WALL_FLAG) + # At least GCC includes -Wmaybe-uninitialized in -Wall, which + # unneccesarily whines about boost::optional (by it's nature + # it's a "maybe" warning - prone to noisy false-positives) + check_cxx_compiler_flag(-Wno-maybe-uninitialized SUPPORTS_WNO_MAYBE_UNINITIALIZED_FLAG) + if(SUPPORTS_WNO_MAYBE_UNINITIALIZED_FLAG) + set(_flags "${_flags} -Wno-maybe-uninitialized") + endif() endif() endif() endmacro() diff --git a/FindCPPDOM.cmake b/FindCPPDOM.cmake index 7fa8808..449ab73 100644 --- a/FindCPPDOM.cmake +++ b/FindCPPDOM.cmake @@ -68,6 +68,23 @@ include(SelectLibraryConfigurations) include(CreateImportedTarget) include(CleanLibraryList) include(CleanDirectoryList) +include(FindPackageHandleStandardArgs) + +# Handle the case where a recent cppdom is supplying its own cmake config file. +option(CPPDOM_ATTEMPT_CMAKE_MODULE "Should we attempt to use CPPDOM's own CMake module for configuration?" ON) +mark_as_advanced(CPPDOM_ATTEMPT_CMAKE_MODULE) +if(NOT cppdom_FOUND) + find_package(cppdom QUIET NO_MODULE) + if(cppdom_FOUND) + set(CPPDOM_LIBRARIES ${cppdom_LIBRARIES}) + set(CPPDOM_INCLUDE_DIRS ${cppdom_INCLUDE_DIRS}) + find_package_handle_standard_args(CPPDOM + DEFAULT_MSG + CPPDOM_LIBRARIES + CPPDOM_INCLUDE_DIRS) + return() + endif() +endif() if(CPPDOM_INCLUDE_DIRS AND CPPDOM_LIBRARIES) # in cache already @@ -180,7 +197,6 @@ 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(CPPDOM DEFAULT_MSG CPPDOM_LIBRARY diff --git a/FindColibriApi.cmake b/FindColibriApi.cmake new file mode 100644 index 0000000..0d7b4ff --- /dev/null +++ b/FindColibriApi.cmake @@ -0,0 +1,120 @@ +# - try to find Trivisio Colibri API library +# +# Cache Variables: +# COLIBRIAPI_LIBRARY +# COLIBRIAPI_INCLUDE_DIR +# +# Non-cache variables you might use in your CMakeLists.txt: +# COLIBRIAPI_FOUND +# COLIBRIAPI_SERVER_LIBRARIES - server libraries +# COLIBRIAPI_LIBRARIES - client libraries +# COLIBRIAPI_CLIENT_DEFINITIONS - definitions if you only use the client library +# COLIBRIAPI_DEFINITIONS - Client-only definition if all we found was the client library. +# COLIBRIAPI_INCLUDE_DIRS +# +# COLIBRIAPI_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 +# 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(COLIBRIAPI_ROOT_DIR + "${COLIBRIAPI_ROOT_DIR}" + CACHE + PATH + "Root directory to search for Colibri API") + +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) + set(_PF86 "ProgramFiles(x86)") + if(NOT "$ENV{${_PF86}}" STREQUAL "") + # 32-bit dir: only set on win64 + file(TO_CMAKE_PATH "$ENV{${_PF86}}" _progfiles) + else() + # 32-bit dir on win32, useless to us on win64 + file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _progfiles) + endif() +endif() + +### +# Configure COLIBRIAPI +### + +find_path(COLIBRIAPI_INCLUDE_DIR + NAMES + colibri_api.h + PATH_SUFFIXES + include + HINTS + "${COLIBRIAPI_ROOT_DIR}" + PATHS + "${_progfiles}/ColibriAPI 1.1.20140925 (64-bit)" + "$ENV{HOME}" + "$ENV{HOME}/ColibriAPI-1.1.20140710-Linux-amd64" + C:/usr/local + /usr/local) + +find_library(COLIBRIAPI_LIBRARY + NAMES + colibri-api + PATH_SUFFIXES + ${_libsuffixes} + HINTS + "${COLIBRIAPI_ROOT_DIR}" + PATHS + "${_progfiles}/ColibriAPI 1.1.20140925 (64-bit)" + "$ENV{HOME}" + "$ENV{HOME}/ColibriAPI-1.1.20140710-Linux-amd64" + 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(ColibriApi + DEFAULT_MSG + COLIBRIAPI_LIBRARY + COLIBRIAPI_INCLUDE_DIR + ${_deps_check}) + +if(COLIBRIAPI_FOUND) + set(COLIBRIAPI_INCLUDE_DIRS "${COLIBRIAPI_INCLUDE_DIR}" ${_deps_includes}) + set(COLIBRIAPI_LIBRARIES "${COLIBRIAPI_LIBRARY}" ${_deps_libs}) + + mark_as_advanced(COLIBRIAPI_ROOT_DIR) +endif() + +mark_as_advanced(COLIBRIAPI_LIBRARY COLIBRIAPI_INCLUDE_DIR) diff --git a/FindDirectInput.cmake b/FindDirectInput.cmake deleted file mode 100644 index a530ff0..0000000 --- a/FindDirectInput.cmake +++ /dev/null @@ -1,180 +0,0 @@ -# - try to find DirectInput library (part of DirectX SDK) -# -# Cache Variables: (probably not for direct use in your scripts) -# DIRECTINPUT_DXGUID_LIBRARY -# DIRECTINPUT_DXERR_LIBRARY -# DIRECTINPUT_DINPUT_LIBRARY -# DIRECTINPUT_INCLUDE_DIR -# -# Non-cache variables you should use in your CMakeLists.txt: -# DIRECTINPUT_LIBRARIES -# DIRECTINPUT_INCLUDE_DIRS -# DIRECTINPUT_FOUND - if this is not true, do not attempt to use this library -# -# Requires these CMake modules: -# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) -# -# Original Author: -# 2011 Ryan Pavlik -# http://academic.cleardefinition.com -# Iowa State University HCI Graduate Program/VRAC -# -# Copyright Iowa State University 2011. -# 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(DIRECTINPUT_ROOT_DIR - "${DIRECTINPUT_ROOT_DIR}" - CACHE - PATH - "Root directory to search for DirectX/DirectInput") - -if(MSVC) - file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _PROG_FILES) - file(TO_CMAKE_PATH "$ENV{ProgramFiles(x86)}" _PROG_FILES_X86) - if(_PROG_FILES_X86) - set(_PROG_FILES "${_PROG_FILES_X86}") - endif() - if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(_lib_suffixes lib/x64 lib) - else() - set(_lib_suffixes lib/x86 lib) - endif() - macro(_append_dxsdk_in_inclusive_range _low _high) - if((NOT MSVC_VERSION LESS ${_low}) AND (NOT MSVC_VERSION GREATER ${_high})) - list(APPEND DXSDK_DIRS ${ARGN}) - endif() - endmacro() - _append_dxsdk_in_inclusive_range(1500 1600 "${_PROG_FILES}/Microsoft DirectX SDK (June 2010)") - _append_dxsdk_in_inclusive_range(1400 1600 - "${_PROG_FILES}/Microsoft DirectX SDK (February 2010)" - "${_PROG_FILES}/Microsoft DirectX SDK (August 2009)" - "${_PROG_FILES}/Microsoft DirectX SDK (March 2009)" - "${_PROG_FILES}/Microsoft DirectX SDK (November 2008)" - "${_PROG_FILES}/Microsoft DirectX SDK (August 2008)" - "${_PROG_FILES}/Microsoft DirectX SDK (June 2008)" - "${_PROG_FILES}/Microsoft DirectX SDK (March 2008)") - _append_dxsdk_in_inclusive_range(1310 1500 - "${_PROG_FILES}/Microsoft DirectX SDK (November 2007)" - "${_PROG_FILES}/Microsoft DirectX SDK (August 2007)" - "${_PROG_FILES}/Microsoft DirectX SDK (June 2007)" - "${_PROG_FILES}/Microsoft DirectX SDK (April 2007)" - "${_PROG_FILES}/Microsoft DirectX SDK (February 2007)" - "${_PROG_FILES}/Microsoft DirectX SDK (December 2006)" - "${_PROG_FILES}/Microsoft DirectX SDK (October 2006)" - "${_PROG_FILES}/Microsoft DirectX SDK (August 2006)" - "${_PROG_FILES}/Microsoft DirectX SDK (June 2006)" - "${_PROG_FILES}/Microsoft DirectX SDK (April 2006)" - "${_PROG_FILES}/Microsoft DirectX SDK (February 2006)") - - file(TO_CMAKE_PATH "$ENV{DXSDK_DIR}" ENV_DXSDK_DIR) - if(ENV_DXSDK_DIR) - list(APPEND DXSDK_DIRS ${ENV_DXSDK_DIR}) - endif() -else() - set(_lib_suffixes lib) - set(DXSDK_DIRS /mingw) -endif() - -find_path(DIRECTINPUT_INCLUDE_DIR - NAMES - dinput.h - PATHS - ${DXSDK_DIRS} - HINTS - "${DIRECTINPUT_ROOT_DIR}" - PATH_SUFFIXES - include) - -find_library(DIRECTINPUT_DXGUID_LIBRARY - NAMES - dxguid - PATHS - ${DXSDK_DIRS} - HINTS - "${DIRECTINPUT_ROOT_DIR}" - PATH_SUFFIXES - ${_lib_suffixes}) - -if(DIRECTINPUT_DXGUID_LIBRARY) - get_filename_component(_dinput_lib_dir - ${DIRECTINPUT_DXGUID_LIBRARY} - PATH) -endif() - -find_library(DIRECTINPUT_DINPUT_LIBRARY - NAMES - dinput8 - dinput - PATHS - ${DXSDK_DIRS} - HINTS - "${_dinput_lib_dir}" - "${DIRECTINPUT_ROOT_DIR}" - PATH_SUFFIXES - ${_lib_suffixes}) - -find_library(DIRECTINPUT_DXERR_LIBRARY - NAMES - dxerr - dxerr9 - dxerr8 - PATHS - ${DXSDK_DIRS} - HINTS - "${_dinput_lib_dir}" - "${DIRECTINPUT_ROOT_DIR}" - PATH_SUFFIXES - ${_lib_suffixes}) -set(DIRECTINPUT_EXTRA_CHECK) -if(DIRECTINPUT_INCLUDE_DIR) - if(MSVC80) - set(DXSDK_DEPRECATION_BUILD 1962) - endif() - - if(DXSDK_DEPRECATION_BUILD) - include(CheckCSourceCompiles) - set(_dinput_old_includes ${CMAKE_REQUIRED_INCLUDES}) - set(CMAKE_REQUIRED_INCLUDES "${DIRECTINPUT_INCLUDE_DIR}") - check_c_source_compiles( - " - #include - #if _DXSDK_BUILD_MAJOR >= ${DXSDK_DEPRECATION_BUILD} - #error - #else - int main(int argc, char * argv[]) { - return 0; - } - " - DIRECTINPUT_SDK_SUPPORTS_COMPILER) - set(DIRECTINPUT_EXTRA_CHECK DIRECTINPUT_SDK_SUPPORTS_COMPILER) - set(CMAKE_REQUIRED_INCLUDES "${_dinput_old_includes}") - endif() -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(DirectInput - DEFAULT_MSG - DIRECTINPUT_DINPUT_LIBRARY - DIRECTINPUT_DXGUID_LIBRARY - DIRECTINPUT_DXERR_LIBRARY - DIRECTINPUT_INCLUDE_DIR - ${DIRECTINPUT_EXTRA_CHECK}) - -if(DIRECTINPUT_FOUND) - set(DIRECTINPUT_LIBRARIES - "${DIRECTINPUT_DXGUID_LIBRARY}" - "${DIRECTINPUT_DXERR_LIBRARY}" - "${DIRECTINPUT_DINPUT_LIBRARY}") - - set(DIRECTINPUT_INCLUDE_DIRS "${DIRECTINPUT_INCLUDE_DIR}") - - mark_as_advanced(DIRECTINPUT_ROOT_DIR) -endif() - -mark_as_advanced(DIRECTINPUT_DINPUT_LIBRARY - DIRECTINPUT_DXGUID_LIBRARY - DIRECTINPUT_DXERR_LIBRARY - DIRECTINPUT_INCLUDE_DIR) diff --git a/FindDirectShow.cmake b/FindDirectShow.cmake index 69c225b..1fb3306 100644 --- a/FindDirectShow.cmake +++ b/FindDirectShow.cmake @@ -21,8 +21,12 @@ # Look for one of the sample files. -find_package(WindowsSDK) -find_package(DirectX QUIET) +set(_ds_quiet) +if(DirectShow_FIND_QUIETLY) + set(_ds_quiet QUIET) +endif() +find_package(WindowsSDK ${_ds_quiet}) +find_package(DirectX ${_ds_quiet}) set(DIRECTSHOW_WINDOWSSDK_ROOT "${DIRECTSHOW_WINDOWSSDK_ROOT}" @@ -67,6 +71,52 @@ find_path(DIRECTSHOW_WINDOWSSDK_INCLUDE_DIR PATH_SUFFIXES "Include") +### +# Begin code dedicated to finding a proper qedit.h file... +### + +# Checks to see if a directory has qedit.h and if that file contains ISampleGrabber. +function(_directshow_check_qedit _dir _var) + set(fn "${_dir}/qedit.h") + if(NOT EXISTS "${fn}") + set(${_var} FALSE PARENT_SCOPE) + return() + endif() + file(STRINGS "${fn}" samplegrabber REGEX ISampleGrabber) + if(NOT samplegrabber) + set(${_var} FALSE PARENT_SCOPE) + return() + endif() + set(${_var} TRUE PARENT_SCOPE) +endfunction() + +function(_directshow_check_current_qedit) + if(DIRECTSHOW_QEDIT_INCLUDE_DIR) + _directshow_check_qedit("${DIRECTSHOW_QEDIT_INCLUDE_DIR}" _ds_ok) + if(NOT _ds_ok) + message(STATUS "FindDirectShow: qedit.h in ${DIRECTSHOW_QEDIT_INCLUDE_DIR} lacks ISampleGrabber, unsetting DIRECTSHOW_QEDIT_INCLUDE_DIR") + set(DIRECTSHOW_QEDIT_INCLUDE_DIR "" CACHE PATH "" FORCE) + endif() + endif() +endfunction() + +# Check before deciding if we should make our list of possible locations. +_directshow_check_current_qedit() + +# Compose a list of possible directories that might hold a qedit.h file. +set(DIRECTSHOW_QEDIT_SEARCH) +if(WINDOWSSDK_FOUND AND NOT DIRECTSHOW_QEDIT_INCLUDE_DIR) + foreach(_sdk ${WINDOWSSDK_DIRS}) + windowssdk_build_lookup("${_sdk}" _build) + if(_build AND ("${_build}" VERSION_LESS 6.2)) + get_windowssdk_include_dirs("${_sdk}" _dirs) + if(_dirs) + list(APPEND DIRECTSHOW_QEDIT_SEARCH ${_dirs}) + endif() + endif() + endforeach() +endif() + # This one we can grab from another SDK version. find_path(DIRECTSHOW_QEDIT_INCLUDE_DIR NAMES @@ -74,17 +124,46 @@ find_path(DIRECTSHOW_QEDIT_INCLUDE_DIR HINTS "${DIRECTSHOW_WINDOWSSDK_ROOT}" PATHS - ${WINDOWSSDK_DIRS} + ${DIRECTSHOW_QEDIT_SEARCH} PATH_SUFFIXES "Include") +# Check if the directory is OK after the search. +_directshow_check_current_qedit() + +# If we didn't find a proper qedit, manually look through the possibilities. +if(NOT DIRECTSHOW_QEDIT_INCLUDE_DIR) + foreach(_dir "${DIRECTSHOW_WINDOWSSDK_ROOT}/Include" ${DIRECTSHOW_QEDIT_SEARCH}) + if(NOT DIRECTSHOW_QEDIT_INCLUDE_DIR) + _directshow_check_qedit("${_dir}" _ds_ok) + if(_ds_ok) + set(DIRECTSHOW_QEDIT_INCLUDE_DIR "${_dir}" CACHE PATH "" FORCE) + endif() + endif() + endforeach() +endif() + +### +# End qedit.h section. +### + +set(DIRECTSHOW_STRMIIDS_SEARCH) +if(WINDOWSSDK_FOUND AND NOT DIRECTSHOW_STRMIIDS_LIBRARY) + foreach(_sdk ${WINDOWSSDK_DIRS}) + get_windowssdk_library_dirs("${_sdk}" _dirs) + if(_dirs) + list(APPEND DIRECTSHOW_STRMIIDS_SEARCH ${_dirs}) + endif() + endforeach() +endif() + find_library(DIRECTSHOW_STRMIIDS_LIBRARY NAMES strmiids HINTS "${DIRECTSHOW_WINDOWSSDK_ROOT}" PATHS - ${_acceptable_winsdk} + ${DIRECTSHOW_STRMIIDS_SEARCH} PATH_SUFFIXES "Lib${DIRECTSHOW_LIB_SUBDIR}") @@ -95,7 +174,6 @@ find_package_handle_standard_args(DirectShow DIRECTSHOW_WINDOWSSDK_INCLUDE_DIR DIRECTSHOW_QEDIT_INCLUDE_DIR DIRECTX_INCLUDE_DIR - DIRECTX_FOUND DIRECTSHOW_STRMIIDS_LIBRARY) if(DIRECTSHOW_FOUND) diff --git a/FindDirectX.cmake b/FindDirectX.cmake index 2c44c7a..d77ca75 100644 --- a/FindDirectX.cmake +++ b/FindDirectX.cmake @@ -4,8 +4,8 @@ # DIRECTX_INCLUDE_DIR # # Variables you should use in your CMakeLists.txt: -# DIRECTX_DXGUID_LIBRARY -# DIRECTX_DXERR_LIBRARY +# DIRECTX_DXGUID_LIBRARY - deprecated, see below +# DIRECTX_DXERR_LIBRARY - deprecated, see http://blogs.msdn.com/b/chuckw/archive/2012/04/24/where-s-dxerr-lib.aspx # DIRECTX_DINPUT_LIBRARY # DIRECTX_DINPUT_INCLUDE_DIR # DIRECTX_D3D9_LIBRARY @@ -14,6 +14,9 @@ # DIRECTX_INCLUDE_DIRS # DIRECTX_FOUND - if this is not true, do not attempt to use this library # +# Defines these macros: +# find_directx_include - wrapper for find_path that provides PATHS, HINTS, and PATH_SUFFIXES. +# find_directx_library - wrapper for find_library that provides PATHS, HINTS, and PATH_SUFFIXES. # Requires these CMake modules: # FindPackageHandleStandardArgs (known included with CMake >=2.6.2) # SelectLibraryConfigurations @@ -37,15 +40,32 @@ set(DIRECTX_ROOT_DIR if(MSVC) file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _PROG_FILES) - file(TO_CMAKE_PATH "$ENV{ProgramFiles(x86)}" _PROG_FILES_X86) + set(_PF86 "ProgramFiles(x86)") + file(TO_CMAKE_PATH "$ENV{${_PF86}}" _PROG_FILES_X86) if(_PROG_FILES_X86) set(_PROG_FILES "${_PROG_FILES_X86}") endif() if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(_lib_suffixes lib/x64 lib) + set(_dx_lib_suffixes lib/x64 lib) else() - set(_lib_suffixes lib/x86 lib) + set(_dx_lib_suffixes lib/x86 lib) endif() + set(DXSDK_DIRS) + + set(_dx_quiet) + if(DirectX_FIND_QUIETLY) + set(_dx_quiet QUIET) + endif() + find_package(WindowsSDK ${_dx_quiet}) + if(WINDOWSSDK_FOUND) + foreach(_dir ${WINDOWSSDK_DIRS}) + get_windowssdk_include_dirs(${_dir} _include_dirs) + if(_include_dirs) + list(APPEND DXSDK_DIRS ${_include_dirs}) + endif() + endforeach() + endif() + macro(_append_dxsdk_in_inclusive_range _low _high) if((NOT MSVC_VERSION LESS ${_low}) AND (NOT MSVC_VERSION GREATER ${_high})) list(APPEND DXSDK_DIRS ${ARGN}) @@ -78,7 +98,7 @@ if(MSVC) list(APPEND DXSDK_DIRS ${ENV_DXSDK_DIR}) endif() else() - set(_lib_suffixes lib) + set(_dx_lib_suffixes lib) set(DXSDK_DIRS /mingw) endif() @@ -103,18 +123,41 @@ find_path(DIRECTX_DINPUT_INCLUDE_DIR PATH_SUFFIXES include) +set(DXLIB_HINTS) +if(WINDOWSSDK_FOUND AND DIRECTX_INCLUDE_DIR) + get_windowssdk_from_component("${DIRECTX_INCLUDE_DIR}" _winsdk) + if(_winsdk) + get_windowssdk_library_dirs("${_winsdk}" _libdirs) + if(_libdirs) + list(APPEND DXLIB_HINTS ${_libdirs}) + endif() + endif() +endif() + +if(WINDOWSSDK_FOUND AND DIRECTX_DINPUT_INCLUDE_DIR) + get_windowssdk_from_component("${DIRECTX_DINPUT_INCLUDE_DIR}" _winsdk) + if(_winsdk) + get_windowssdk_library_dirs("${_winsdk}" _includes) + if(_includes) + list(APPEND DXLIB_HINTS ${_includes}) + endif() + endif() +endif() + find_library(DIRECTX_DXGUID_LIBRARY NAMES dxguid PATHS + ${DXLIB_HINTS} ${DXSDK_DIRS} HINTS "${DIRECTX_ROOT_DIR}" PATH_SUFFIXES - ${_lib_suffixes}) + ${_dx_lib_suffixes}) if(DIRECTX_DXGUID_LIBRARY) get_filename_component(_dxsdk_lib_dir ${DIRECTX_DXGUID_LIBRARY} PATH) + list(APPEND DXLIB_HINTS "${_dxsdk_lib_dir}") endif() find_library(DIRECTX_DINPUT_LIBRARY @@ -124,10 +167,10 @@ find_library(DIRECTX_DINPUT_LIBRARY PATHS ${DXSDK_DIRS} HINTS - "${_dxsdk_lib_dir}" + ${DXLIB_HINTS} "${DIRECTX_ROOT_DIR}" PATH_SUFFIXES - ${_lib_suffixes}) + ${_dx_lib_suffixes}) find_library(DIRECTX_DXERR_LIBRARY NAMES @@ -137,10 +180,10 @@ find_library(DIRECTX_DXERR_LIBRARY PATHS ${DXSDK_DIRS} HINTS - "${_dxsdk_lib_dir}" + ${DXLIB_HINTS} "${DIRECTX_ROOT_DIR}" PATH_SUFFIXES - ${_lib_suffixes}) + ${_dx_lib_suffixes}) find_library(DIRECTX_D3D9_LIBRARY NAMES @@ -148,10 +191,10 @@ find_library(DIRECTX_D3D9_LIBRARY PATHS ${DXSDK_DIRS} HINTS - "${_dxsdk_lib_dir}" + ${DXLIB_HINTS} "${DIRECTX_ROOT_DIR}" PATH_SUFFIXES - ${_lib_suffixes}) + ${_dx_lib_suffixes}) find_library(DIRECTX_D3DXOF_LIBRARY NAMES @@ -159,10 +202,10 @@ find_library(DIRECTX_D3DXOF_LIBRARY PATHS ${DXSDK_DIRS} HINTS - "${_dxsdk_lib_dir}" + ${DXLIB_HINTS} "${DIRECTX_ROOT_DIR}" PATH_SUFFIXES - ${_lib_suffixes}) + ${_dx_lib_suffixes}) find_library(DIRECTX_D3DX9_LIBRARY_RELEASE NAMES @@ -170,10 +213,10 @@ find_library(DIRECTX_D3DX9_LIBRARY_RELEASE PATHS ${DXSDK_DIRS} HINTS - "${_dxsdk_lib_dir}" + ${DXLIB_HINTS} "${DIRECTX_ROOT_DIR}" PATH_SUFFIXES - ${_lib_suffixes}) + ${_dx_lib_suffixes}) find_library(DIRECTX_D3DX9_LIBRARY_DEBUG NAMES @@ -181,10 +224,22 @@ find_library(DIRECTX_D3DX9_LIBRARY_DEBUG PATHS ${DXSDK_DIRS} HINTS - "${_dxsdk_lib_dir}" + ${DXLIB_HINTS} "${DIRECTX_ROOT_DIR}" PATH_SUFFIXES - ${_lib_suffixes}) + ${_dx_lib_suffixes}) + +find_library(DIRECTX_XINPUT_LIBRARY + NAMES + Xinput9_1_0 + Xinput + PATHS + ${DXSDK_DIRS} + HINTS + ${DXLIB_HINTS} + "${DIRECTX_ROOT_DIR}" + PATH_SUFFIXES + ${_dx_lib_suffixes}) include(SelectLibraryConfigurations) select_library_configurations(DIRECTX_D3DX9) @@ -207,10 +262,14 @@ if(DIRECTX_INCLUDE_DIR) int main(int argc, char * argv[]) { return 0; } + #endif " DIRECTX_SDK_SUPPORTS_COMPILER) set(DIRECTX_EXTRA_CHECK DIRECTX_SDK_SUPPORTS_COMPILER) set(CMAKE_REQUIRED_INCLUDES "${_dinput_old_includes}") + else() + # Until proven otherwise. + set(DIRECTX_SDK_SUPPORTS_COMPILER TRUE) endif() endif() @@ -219,14 +278,12 @@ find_package_handle_standard_args(DirectX DEFAULT_MSG DIRECTX_DXGUID_LIBRARY DIRECTX_DINPUT_LIBRARY - DIRECTX_DXERR_LIBRARY DIRECTX_INCLUDE_DIR ${DIRECTX_EXTRA_CHECK}) if(DIRECTX_FOUND) set(DIRECTX_LIBRARIES "${DIRECTX_DXGUID_LIBRARY}" - "${DIRECTX_DXERR_LIBRARY}" "${DIRECTX_DINPUT_LIBRARY}") set(DIRECTX_INCLUDE_DIRS "${DIRECTX_INCLUDE_DIR}") @@ -234,6 +291,27 @@ if(DIRECTX_FOUND) mark_as_advanced(DIRECTX_ROOT_DIR) endif() +macro(find_directx_library) + find_library(${ARGN} + PATHS + ${DXSDK_DIRS} + HINTS + ${DXLIB_HINTS} + "${DIRECTX_ROOT_DIR}" + PATH_SUFFIXES + ${_dx_lib_suffixes}) +endmacro() +macro(find_directx_include) + find_path(${ARGN} + PATHS + ${DXSDK_DIRS} + HINTS + ${DIRECTX_INCLUDE_DIR} + "${DIRECTX_ROOT_DIR}" + PATH_SUFFIXES + include) +endmacro() + mark_as_advanced(DIRECTX_DINPUT_LIBRARY DIRECTX_DXGUID_LIBRARY DIRECTX_DXERR_LIBRARY diff --git a/FindGLEW.cmake b/FindGLEW.cmake new file mode 100644 index 0000000..684f6f1 --- /dev/null +++ b/FindGLEW.cmake @@ -0,0 +1,132 @@ +#.rst: +# FindGLEW +# -------- +# +# Find the OpenGL Extension Wrangler Library (GLEW) +# +# IMPORTED Targets +# ^^^^^^^^^^^^^^^^ +# +# This module defines the :prop_tgt:`IMPORTED` target ``GLEW::GLEW``, +# if GLEW has been found. +# +# Result Variables +# ^^^^^^^^^^^^^^^^ +# +# This module defines the following variables: +# +# :: +# +# GLEW_INCLUDE_DIRS - include directories for GLEW +# GLEW_LIBRARIES - libraries to link against GLEW +# GLEW_FOUND - true if GLEW has been found and can be used + +#============================================================================= +# Copyright 2012 Benjamin Eikel +# Copyright 2016 Ryan Pavlik +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# 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. +#============================================================================= + +find_path(GLEW_INCLUDE_DIR GL/glew.h) +if(WIN32) + # TODO how to make this exclude arm? + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(GLEW_ARCH Win32) + else() + set(GLEW_ARCH x64) + endif() + set(GLEW_EXTRA_SUFFIXES lib/Release/${GLEW_ARCH} bin/Release/${GLEW_ARCH}) +endif() + +if(WIN32 AND GLEW_INCLUDE_DIR) + get_filename_component(GLEW_LIB_ROOT_CANDIDATE "${GLEW_INCLUDE_DIR}/.." ABSOLUTE) +endif() + +find_library(GLEW_LIBRARY + NAMES GLEW glew32 glew glew32s + PATH_SUFFIXES lib64 ${GLEW_EXTRA_SUFFIXES} + HINTS "${GLEW_LIB_ROOT_CANDIDATE}") + +if(WIN32 AND GLEW_LIBRARY AND NOT GLEW_LIBRARY MATCHES ".*s.lib") + get_filename_component(GLEW_LIB_DIR "${GLEW_LIBRARY}" DIRECTORY) + get_filename_component(GLEW_BIN_ROOT_CANDIDATE1 "${GLEW_LIB_DIR}/.." ABSOLUTE) + get_filename_component(GLEW_BIN_ROOT_CANDIDATE2 "${GLEW_LIB_DIR}/../../.." ABSOLUTE) + find_file(GLEW_RUNTIME_LIBRARY + NAMES glew32.dll + PATH_SUFFIXES bin ${GLEW_EXTRA_SUFFIXES} + HINTS + "${GLEW_BIN_ROOT_CANDIDATE1}" + "${GLEW_BIN_ROOT_CANDIDATE2}") +endif() + +set(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR}) +set(GLEW_LIBRARIES ${GLEW_LIBRARY}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GLEW + REQUIRED_VARS GLEW_INCLUDE_DIR GLEW_LIBRARY) + +if(GLEW_FOUND AND NOT TARGET GLEW::GLEW) + if(WIN32 AND GLEW_LIBRARY MATCHES ".*s.lib") + # Windows, known static library. + add_library(GLEW::GLEW STATIC IMPORTED) + set_target_properties(GLEW::GLEW PROPERTIES + IMPORTED_LOCATION "${GLEW_LIBRARY}" + PROPERTY INTERFACE_COMPILE_DEFINITIONS GLEW_STATIC) + + elseif(WIN32 AND GLEW_RUNTIME_LIBRARY) + # Windows, known dynamic library and we have both pieces + # TODO might be different for mingw + add_library(GLEW::GLEW SHARED IMPORTED) + set_target_properties(GLEW::GLEW PROPERTIES + IMPORTED_LOCATION "${GLEW_RUNTIME_LIBRARY}" + IMPORTED_IMPLIB "${GLEW_LIBRARY}") + else() + + # Anything else - previous behavior. + add_library(GLEW::GLEW UNKNOWN IMPORTED) + set_target_properties(GLEW::GLEW PROPERTIES + IMPORTED_LOCATION "${GLEW_LIBRARY}") + endif() + + set_target_properties(GLEW::GLEW PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${GLEW_INCLUDE_DIRS}") + +endif() + +mark_as_advanced(GLEW_INCLUDE_DIR GLEW_LIBRARY GLEW_RUNTIME_LIBRARY) diff --git a/FindHIDAPI.cmake b/FindHIDAPI.cmake index e53502a..646f900 100644 --- a/FindHIDAPI.cmake +++ b/FindHIDAPI.cmake @@ -24,10 +24,12 @@ # http://www.boost.org/LICENSE_1_0.txt) find_library(HIDAPI_LIBRARY - NAMES hidapi) + NAMES hidapi hidapi-libusb) find_path(HIDAPI_INCLUDE_DIR - NAMES hidapi.h) + NAMES hidapi.h + PATH_SUFFIXES + hidapi) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(HIDAPI diff --git a/FindInterSense.cmake b/FindInterSense.cmake new file mode 100644 index 0000000..855c9a1 --- /dev/null +++ b/FindInterSense.cmake @@ -0,0 +1,108 @@ +# - try to find InterSense library +# +# Cache Variables: (probably not for direct use in your scripts) +# INTERSENSE_INCLUDE_DIR +# INTERSENSE_ISENSEC_DIR - location of the isense.c "import library" substitute. +# INTERSENSE_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# INTERSENSE_FOUND +# INTERSENSE_INCLUDE_DIRS +# INTERSENSE_LIBRARIES +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Author: +# 2013 Eric Marsh +# http://wemarsh.com/ +# Kognitiv Neuroinformatik, Universität Bremen +# +# (building on Ryan Pavlik's templates) +# +# 2013 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# 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(INTERSENSE_ROOT_DIR + "${INTERSENSE_ROOT_DIR}" + CACHE + PATH + "Directory to search for the Intersense SDK") + +if(APPLE) + set(_ARCH UniversalLib) +else() + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(_IS_ARCH x86_64) + else() + set(_IS_ARCH x86_32) + endif() +endif() + +set(_IS_INSTALLDIRS) +if(APPLE) + set(_IS_SDKDIR MacOSX) +elseif(WIN32) + set(_IS_SDKDIR Windows) + # Default locations, as well as registry places it records install locations, + # if you installed from a (actual or downloaded) product "CD" + foreach(_IS_PROD "IS-900 Software" "InertiaCube Software") + get_filename_component(_IS_REGPATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\InterSense\\${_IS_PROD};Path]" ABSOLUTE) + if(_IS_REGPATH AND (NOT "${_IS_REGPATH}" STREQUAL "/registry")) + list(APPEND _IS_INSTALLDIRS "${_IS_REGPATH}/SDK") + endif() + list(APPEND _IS_INSTALLDIRS "C:/InterSense/${_IS_PROD}/SDK") + endforeach() +else() # Assume Linux, since that's the only other platform supported by this library + set(_IS_SDKDIR Linux) +endif() + +find_path(INTERSENSE_INCLUDE_DIR + NAMES isense.h + PATHS "${INTERSENSE_ROOT_DIR}" "${INTERSENSE_ROOT_DIR}/SDK" ${_IS_INSTALLDIRS}) + +find_path(INTERSENSE_ISENSEC_DIR + NAMES isense.c + PATHS "${INTERSENSE_ROOT_DIR}" "${INTERSENSE_ROOT_DIR}/SDK" ${_IS_INSTALLDIRS} + PATH_SUFFIXES + "Windows/Sample/Visual C++ 2005" + "Windows/Sample/Visual C++ 2005 (single tracker)" + Linux/Sample + MacOSX/Sample) + +include(FindPackageHandleStandardArgs) + +# This is a weird one - no import library is supplied, and instead, at least on Windows, they use +# an isense.c file to call into the DLL. Not sure if MinGW can link right against the dll in this case. +if(WIN32) + find_package_handle_standard_args(InterSense + DEFAULT_MSG + INTERSENSE_INCLUDE_DIR + INTERSENSE_ISENSEC_DIR) + if(INTERSENSE_FOUND) + set(INTERSENSE_LIBRARIES "") + set(INTERSENSE_INCLUDE_DIRS "${INTERSENSE_INCLUDE_DIR}" "${INTERSENSE_ISENSEC_DIR}") + endif() +else() # Only MSVC on Windows theoretically needs import libraries, so... + find_library(INTERSENSE_LIBRARY + NAMES isense + PATHS "${INTERSENSE_ROOT_DIR}" "${INTERSENSE_ROOT_DIR}/SDK" ${_IS_INSTALLDIRS} + PATH_SUFFIXES "${_IS_SDKDIR}/${_IS_ARCH}") + + find_package_handle_standard_args(InterSense + DEFAULT_MSG + INTERSENSE_LIBRARY + INTERSENSE_INCLUDE_DIR) + + if(INTERSENSE_FOUND) + set(INTERSENSE_LIBRARIES "${INTERSENSE_LIBRARY}" ${CMAKE_DL_LIBS}) + set(INTERSENSE_INCLUDE_DIRS "${INTERSENSE_INCLUDE_DIR}") + endif() +endif() + +mark_as_advanced(INTERSENSE_INCLUDE_DIR INTERSENSE_ISENSEC_DIR INTERSENSE_LIBRARY) diff --git a/FindJsonCpp.cmake b/FindJsonCpp.cmake new file mode 100644 index 0000000..28fca2f --- /dev/null +++ b/FindJsonCpp.cmake @@ -0,0 +1,392 @@ +# - Find jsoncpp - Overarching find module +# This is a over-arching find module to find older jsoncpp versions and those sadly built +# without JSONCPP_WITH_CMAKE_PACKAGE=ON, as well as those built with the cmake config file. +# It also wraps the different versions of the module. +# +# On CMake 3.0 and newer: +# JsonCpp::JsonCpp - Imported target (possibly an interface/alias) to use: +# if anything is populated, this is. If both shared and static are found, then +# this will be the static version on DLL platforms and shared on non-DLL platforms. +# JsonCpp::JsonCppShared - Imported target (possibly an interface/alias) for a +# shared library version. +# JsonCpp::JsonCppStatic - Imported target (possibly an interface/alias) for a +# static library version. +# +# On all CMake versions: (Note that on CMake 2.8.10 and earlier, you may need to use JSONCPP_INCLUDE_DIRS) +# JSONCPP_LIBRARY - wraps JsonCpp::JsonCpp or equiv. +# JSONCPP_LIBRARY_IS_SHARED - if we know for sure JSONCPP_LIBRARY is shared, this is true-ish. We try to "un-set" it if we don't know one way or another. +# JSONCPP_LIBRARY_SHARED - wraps JsonCpp::JsonCppShared or equiv. +# JSONCPP_LIBRARY_STATIC - wraps JsonCpp::JsonCppStatic or equiv. +# JSONCPP_INCLUDE_DIRS - Include directories - should (generally?) not needed if you require CMake 2.8.11+ since it handles target include directories. +# +# JSONCPP_FOUND - True if JsonCpp was found. +# +# Original Author: +# 2016 Ryan Pavlik +# Incorporates work from the module contributed to VRPN under the same license: +# 2011 Philippe Crassous (ENSAM ParisTech / Institut Image) p.crassous _at_ free.fr +# +# Copyright Philippe Crassous 2011. +# Copyright Sensics, Inc. 2016. +# 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(__jsoncpp_have_namespaced_targets OFF) +set(__jsoncpp_have_interface_support OFF) +if(NOT ("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 3.0)) + set(__jsoncpp_have_namespaced_targets ON) + set(__jsoncpp_have_interface_support ON) +elseif(("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" EQUAL 2.8) AND "${CMAKE_PATCH_VERSION}" GREATER 10) + set(__jsoncpp_have_interface_support ON) +endif() + +# sets __jsoncpp_have_jsoncpplib based on whether or not we have a real imported jsoncpp_lib target. +macro(_jsoncpp_check_for_real_jsoncpplib) + set(__jsoncpp_have_jsoncpplib FALSE) + if(TARGET jsoncpp_lib) + get_property(__jsoncpp_lib_type TARGET jsoncpp_lib PROPERTY TYPE) + # We make interface libraries. If an actual config module made it, it would be an imported library. + if(NOT __jsoncpp_lib_type STREQUAL "INTERFACE_LIBRARY") + set(__jsoncpp_have_jsoncpplib TRUE) + endif() + endif() + #message(STATUS "__jsoncpp_have_jsoncpplib ${__jsoncpp_have_jsoncpplib}") +endmacro() + +include(FindPackageHandleStandardArgs) +# Ensure that if this is TRUE later, it's because we set it. +set(JSONCPP_FOUND FALSE) +set(__jsoncpp_have_jsoncpplib FALSE) + +# See if we find a CMake config file - there is no harm in calling this more than once, +# and we need to call it at least once every CMake invocation to create the original +# imported targets, since those don't stick around like cache variables. +find_package(jsoncpp QUIET NO_MODULE) + +if(jsoncpp_FOUND) + # Build a string to help us figure out when to invalidate our cache variables. + # start with where we found jsoncpp + set(__jsoncpp_info_string "[${jsoncpp_DIR}]") + + # part of the string to indicate if we found a real jsoncpp_lib (and what kind) + _jsoncpp_check_for_real_jsoncpplib() + + macro(_jsoncpp_apply_map_config target) + if(MSVC) + # Can't do this - different runtimes, incompatible ABI, etc. + set(_jsoncpp_debug_fallback) + else() + set(_jsoncpp_debug_fallback DEBUG) + #osvr_stash_map_config(DEBUG DEBUG RELWITHDEBINFO RELEASE MINSIZEREL NONE) + endif() + # Appending, just in case using project or upstream fixes this. + set_property(TARGET ${target} APPEND PROPERTY MAP_IMPORTED_CONFIG_RELEASE RELEASE RELWITHDEBINFO MINSIZEREL NONE ${_jsoncpp_debug_fallback}) + set_property(TARGET ${target} APPEND PROPERTY MAP_IMPORTED_CONFIG_RELWITHDEBINFO RELWITHDEBINFO RELEASE MINSIZEREL NONE ${_jsoncpp_debug_fallback}) + set_property(TARGET ${target} APPEND PROPERTY MAP_IMPORTED_CONFIG_MINSIZEREL MINSIZEREL RELEASE RELWITHDEBINFO NONE ${_jsoncpp_debug_fallback}) + set_property(TARGET ${target} APPEND PROPERTY MAP_IMPORTED_CONFIG_NONE RELEASE RELWITHDEBINFO MINSIZEREL ${_jsoncpp_debug_fallback}) + if(NOT MSVC) + set_property(TARGET ${target} APPEND PROPERTY MAP_IMPORTED_CONFIG_DEBUG DEBUG RELWITHDEBINFO RELEASE MINSIZEREL NONE) + endif() + endmacro() + if(__jsoncpp_have_jsoncpplib) + list(APPEND __jsoncpp_info_string "[${__jsoncpp_lib_type}]") + _jsoncpp_apply_map_config(jsoncpp_lib) + else() + list(APPEND __jsoncpp_info_string "[]") + endif() + # part of the string to indicate if we found jsoncpp_lib_static + if(TARGET jsoncpp_lib_static) + list(APPEND __jsoncpp_info_string "[T]") + _jsoncpp_apply_map_config(jsoncpp_lib_static) + else() + list(APPEND __jsoncpp_info_string "[]") + endif() +endif() + + +# If we found something, and it's not the exact same as what we've found before... +# NOTE: The contents of this "if" block update only (internal) cache variables! +# (since this will only get run the first CMake pass that finds jsoncpp or that finds a different/updated install) +if(jsoncpp_FOUND AND NOT __jsoncpp_info_string STREQUAL "${JSONCPP_CACHED_JSONCPP_DIR_DETAILS}") + #message("Updating jsoncpp cache variables! ${__jsoncpp_info_string}") + set(JSONCPP_CACHED_JSONCPP_DIR_DETAILS "${__jsoncpp_info_string}" CACHE INTERNAL "" FORCE) + unset(JSONCPP_IMPORTED_LIBRARY_SHARED) + unset(JSONCPP_IMPORTED_LIBRARY_STATIC) + unset(JSONCPP_IMPORTED_LIBRARY) + unset(JSONCPP_IMPORTED_INCLUDE_DIRS) + unset(JSONCPP_IMPORTED_LIBRARY_IS_SHARED) + + # if(__jsoncpp_have_jsoncpplib) is equivalent to if(TARGET jsoncpp_lib) except it excludes our + # "invented" jsoncpp_lib interface targets, made for convenience purposes after this block. + + if(__jsoncpp_have_jsoncpplib AND TARGET jsoncpp_lib_static) + + # A veritable cache of riches - we have both shared and static! + set(JSONCPP_IMPORTED_LIBRARY_SHARED jsoncpp_lib CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY_STATIC jsoncpp_lib_static CACHE INTERNAL "" FORCE) + if(WIN32 OR CYGWIN OR MINGW) + # DLL platforms: static library should be default + set(JSONCPP_IMPORTED_LIBRARY ${JSONCPP_IMPORTED_LIBRARY_STATIC} CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY_IS_SHARED FALSE CACHE INTERNAL "" FORCE) + else() + # Other platforms - might require PIC to be linked into shared libraries, so safest to prefer shared. + set(JSONCPP_IMPORTED_LIBRARY ${JSONCPP_IMPORTED_LIBRARY_SHARED} CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY_IS_SHARED TRUE CACHE INTERNAL "" FORCE) + endif() + + elseif(TARGET jsoncpp_lib_static) + # Well, only one variant, but we know for sure that it's static. + set(JSONCPP_IMPORTED_LIBRARY_STATIC jsoncpp_lib_static CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY jsoncpp_lib_static CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY_IS_SHARED FALSE CACHE INTERNAL "" FORCE) + + elseif(__jsoncpp_have_jsoncpplib AND __jsoncpp_lib_type STREQUAL "STATIC_LIBRARY") + # We were able to figure out the mystery library is static! + set(JSONCPP_IMPORTED_LIBRARY_STATIC jsoncpp_lib CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY jsoncpp_lib CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY_IS_SHARED FALSE CACHE INTERNAL "" FORCE) + + elseif(__jsoncpp_have_jsoncpplib AND __jsoncpp_lib_type STREQUAL "SHARED_LIBRARY") + # We were able to figure out the mystery library is shared! + set(JSONCPP_IMPORTED_LIBRARY_SHARED jsoncpp_lib CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY jsoncpp_lib CACHE INTERNAL "" FORCE) + set(JSONCPP_IMPORTED_LIBRARY_IS_SHARED TRUE CACHE INTERNAL "" FORCE) + + elseif(__jsoncpp_have_jsoncpplib) + # One variant, and we have no idea if this is just an old version or if + # this is shared based on the target name alone. Hmm. + set(JSONCPP_IMPORTED_LIBRARY jsoncpp_lib CACHE INTERNAL "" FORCE) + endif() + + # Now, we need include directories. Can't just limit this to old CMakes, since + # new CMakes might be used to build projects designed to support older ones. + if(__jsoncpp_have_jsoncpplib) + get_property(__jsoncpp_interface_include_dirs TARGET jsoncpp_lib PROPERTY INTERFACE_INCLUDE_DIRECTORIES) + if(__jsoncpp_interface_include_dirs) + set(JSONCPP_IMPORTED_INCLUDE_DIRS "${__jsoncpp_interface_include_dirs}" CACHE INTERNAL "" FORCE) + endif() + endif() + if(TARGET jsoncpp_lib_static AND NOT JSONCPP_IMPORTED_INCLUDE_DIRS) + get_property(__jsoncpp_interface_include_dirs TARGET jsoncpp_lib_static PROPERTY INTERFACE_INCLUDE_DIRECTORIES) + if(__jsoncpp_interface_include_dirs) + set(JSONCPP_IMPORTED_INCLUDE_DIRS "${__jsoncpp_interface_include_dirs}" CACHE INTERNAL "" FORCE) + endif() + endif() +endif() + +# As a convenience... +if(TARGET jsoncpp_lib_static AND NOT TARGET jsoncpp_lib) + add_library(jsoncpp_lib INTERFACE) + target_link_libraries(jsoncpp_lib INTERFACE jsoncpp_lib_static) +endif() + +if(JSONCPP_IMPORTED_LIBRARY) + if(NOT JSONCPP_IMPORTED_INCLUDE_DIRS) + # OK, so we couldn't get it from the target... maybe we can figure it out from jsoncpp_DIR. + + # take off the jsoncpp component + get_filename_component(__jsoncpp_import_root "${jsoncpp_DIR}/.." ABSOLUTE) + set(__jsoncpp_hints "${__jsoncpp_import_root}") + # take off the cmake component + get_filename_component(__jsoncpp_import_root "${__jsoncpp_import_root}/.." ABSOLUTE) + list(APPEND __jsoncpp_hints "${__jsoncpp_import_root}") + # take off the lib component + get_filename_component(__jsoncpp_import_root "${__jsoncpp_import_root}/.." ABSOLUTE) + list(APPEND __jsoncpp_hints "${__jsoncpp_import_root}") + # take off one more component in case of multiarch lib + get_filename_component(__jsoncpp_import_root "${__jsoncpp_import_root}/.." ABSOLUTE) + list(APPEND __jsoncpp_hints "${__jsoncpp_import_root}") + + # Now, search. + find_path(JsonCpp_INCLUDE_DIR + NAMES + json/json.h + PATH_SUFFIXES include jsoncpp include/jsoncpp + HINTS ${__jsoncpp_hints}) + if(JsonCpp_INCLUDE_DIR) + mark_as_advanced(JsonCpp_INCLUDE_DIR) + # Note - this does not set it in the cache, in case we find it better at some point in the future! + set(JSONCPP_IMPORTED_INCLUDE_DIRS ${JsonCpp_INCLUDE_DIR}) + endif() + endif() + + find_package_handle_standard_args(JsonCpp + DEFAULT_MSG + jsoncpp_DIR + JSONCPP_IMPORTED_LIBRARY + JSONCPP_IMPORTED_INCLUDE_DIRS) +endif() + +if(JSONCPP_FOUND) + # Create any missing namespaced targets from the config module. + if(__jsoncpp_have_namespaced_targets) + if(JSONCPP_IMPORTED_LIBRARY AND NOT TARGET JsonCpp::JsonCpp) + add_library(JsonCpp::JsonCpp INTERFACE IMPORTED) + set_target_properties(JsonCpp::JsonCpp PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${JSONCPP_IMPORTED_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${JSONCPP_IMPORTED_LIBRARY}") + endif() + + if(JSONCPP_IMPORTED_LIBRARY_SHARED AND NOT TARGET JsonCpp::JsonCppShared) + add_library(JsonCpp::JsonCppShared INTERFACE IMPORTED) + set_target_properties(JsonCpp::JsonCppShared PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${JSONCPP_IMPORTED_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${JSONCPP_IMPORTED_LIBRARY_SHARED}") + endif() + + if(JSONCPP_IMPORTED_LIBRARY_STATIC AND NOT TARGET JsonCpp::JsonCppStatic) + add_library(JsonCpp::JsonCppStatic INTERFACE IMPORTED) + set_target_properties(JsonCpp::JsonCppStatic PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${JSONCPP_IMPORTED_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${JSONCPP_IMPORTED_LIBRARY_STATIC}") + endif() + + # Hide the stuff we didn't, and no longer, need. + if(NOT JsonCpp_LIBRARY) + unset(JsonCpp_LIBRARY CACHE) + endif() + if(NOT JsonCpp_INCLUDE_DIR) + unset(JsonCpp_INCLUDE_DIR CACHE) + endif() + endif() + + set(JSONCPP_LIBRARY ${JSONCPP_IMPORTED_LIBRARY}) + set(JSONCPP_INCLUDE_DIRS ${JSONCPP_IMPORTED_INCLUDE_DIRS}) + if(DEFINED JSONCPP_IMPORTED_LIBRARY_IS_SHARED) + set(JSONCPP_LIBRARY_IS_SHARED ${JSONCPP_IMPORTED_LIBRARY_IS_SHARED}) + else() + unset(JSONCPP_LIBRARY_IS_SHARED) + endif() + + if(JSONCPP_IMPORTED_LIBRARY_SHARED) + set(JSONCPP_LIBRARY_SHARED ${JSONCPP_IMPORTED_LIBRARY_SHARED}) + endif() + + if(JSONCPP_IMPORTED_LIBRARY_STATIC) + set(JSONCPP_LIBRARY_STATIC ${JSONCPP_IMPORTED_LIBRARY_STATIC}) + endif() +endif() + +# Still nothing after looking for the config file: must go "old-school" +if(NOT JSONCPP_FOUND) + # Invoke pkgconfig for hints + find_package(PkgConfig QUIET) + set(_JSONCPP_INCLUDE_HINTS) + set(_JSONCPP_LIB_HINTS) + if(PKG_CONFIG_FOUND) + pkg_search_module(_JSONCPP_PC QUIET jsoncpp) + if(_JSONCPP_PC_INCLUDE_DIRS) + set(_JSONCPP_INCLUDE_HINTS ${_JSONCPP_PC_INCLUDE_DIRS}) + endif() + if(_JSONCPP_PC_LIBRARY_DIRS) + set(_JSONCPP_LIB_HINTS ${_JSONCPP_PC_LIBRARY_DIRS}) + endif() + if(_JSONCPP_PC_LIBRARIES) + set(_JSONCPP_LIB_NAMES ${_JSONCPP_PC_LIBRARIES}) + endif() + endif() + + if(NOT _JSONCPP_LIB_NAMES) + # OK, if pkg-config wasn't able to give us a library name suggestion, then we may + # have to resort to some intense old logic. + set(_JSONCPP_LIB_NAMES jsoncpp) + set(_JSONCPP_PATHSUFFIXES) + + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + list(APPEND _JSONCPP_PATHSUFFIXES + linux-gcc) # bit of a generalization but close... + endif() + if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_NAME STREQUAL "Linux") + list(APPEND + _JSONCPP_LIB_NAMES + json_linux-gcc-${CMAKE_CXX_COMPILER_VERSION}_libmt + json_linux-gcc_libmt) + list(APPEND _JSONCPP_PATHSUFFIXES + linux-gcc-${CMAKE_CXX_COMPILER_VERSION}) + + elseif(MSVC) + if(MSVC_VERSION EQUAL 1200) + list(APPEND _JSONCPP_LIB_NAMES json_vc6_libmt) + list(APPEND _JSONCPP_PATHSUFFIXES msvc6) + elseif(MSVC_VERSION EQUAL 1300) + list(APPEND _JSONCPP_LIB_NAMES json_vc7_libmt) + list(APPEND _JSONCPP_PATHSUFFIXES msvc7) + elseif(MSVC_VERSION EQUAL 1310) + list(APPEND _JSONCPP_LIB_NAMES json_vc71_libmt) + list(APPEND _JSONCPP_PATHSUFFIXES msvc71) + elseif(MSVC_VERSION EQUAL 1400) + list(APPEND _JSONCPP_LIB_NAMES json_vc8_libmt) + list(APPEND _JSONCPP_PATHSUFFIXES msvc80) + elseif(MSVC_VERSION EQUAL 1500) + list(APPEND _JSONCPP_LIB_NAMES json_vc9_libmt) + list(APPEND _JSONCPP_PATHSUFFIXES msvc90) + elseif(MSVC_VERSION EQUAL 1600) + list(APPEND _JSONCPP_LIB_NAMES json_vc10_libmt) + list(APPEND _JSONCPP_PATHSUFFIXES msvc10 msvc100) + endif() + + elseif(MINGW) + list(APPEND _JSONCPP_LIB_NAMES + json_mingw_libmt) + list(APPEND _JSONCPP_PATHSUFFIXES mingw) + + else() + list(APPEND _JSONCPP_LIB_NAMES + json_suncc_libmt + json_vacpp_libmt) + endif() + endif() # end of old logic + + # Actually go looking. + find_path(JsonCpp_INCLUDE_DIR + NAMES + json/json.h + PATH_SUFFIXES jsoncpp + HINTS ${_JSONCPP_INCLUDE_HINTS}) + find_library(JsonCpp_LIBRARY + NAMES + ${_JSONCPP_LIB_NAMES} + PATHS libs + PATH_SUFFIXES ${_JSONCPP_PATHSUFFIXES} + HINTS ${_JSONCPP_LIB_HINTS}) + + find_package_handle_standard_args(JsonCpp + DEFAULT_MSG + JsonCpp_INCLUDE_DIR + JsonCpp_LIBRARY) + + if(JSONCPP_FOUND) + # We already know that the target doesn't exist, let's make it. + # TODO don't know why we get errors like: + # error: 'JsonCpp::JsonCpp-NOTFOUND', needed by 'bin/osvr_json_to_c', missing and no known rule to make it + # when we do the imported target commented out below. So, instead, we make an interface + # target with an alias. Hmm. + + #add_library(JsonCpp::JsonCpp UNKNOWN IMPORTED) + #set_target_properties(JsonCpp::JsonCpp PROPERTIES + # IMPORTED_LOCATION "${JsonCpp_LIBRARY}" + # INTERFACE_INCLUDE_DIRECTORIES "${JsonCpp_INCLUDE_DIR}" + # IMPORTED_LINK_INTERFACE_LANGUAGES "CXX") + + set(JSONCPP_LIBRARY "${JsonCpp_LIBRARY}") + set(JSONCPP_INCLUDE_DIRS "${JsonCpp_INCLUDE_DIR}") + unset(JSONCPP_LIBRARY_IS_SHARED) + + if(__jsoncpp_have_interface_support AND NOT TARGET jsoncpp_interface) + add_library(jsoncpp_interface INTERFACE) + set_target_properties(jsoncpp_interface PROPERTIES + INTERFACE_LINK_LIBRARIES "${JsonCpp_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${JsonCpp_INCLUDE_DIR}") + endif() + if(__jsoncpp_have_namespaced_targets) + if(NOT TARGET JsonCpp::JsonCpp) + add_library(JsonCpp::JsonCpp ALIAS jsoncpp_interface) + endif() + endif() + endif() +endif() + +if(JSONCPP_FOUND) + mark_as_advanced(jsoncpp_DIR JsonCpp_INCLUDE_DIR JsonCpp_LIBRARY) +endif() diff --git a/FindLibFreespace.cmake b/FindLibFreespace.cmake new file mode 100644 index 0000000..b83e837 --- /dev/null +++ b/FindLibFreespace.cmake @@ -0,0 +1,78 @@ +# - try to find Hillcrest Labs' libfreespace library +# +# Cache Variables: (probably not for direct use in your scripts) +# LIBFREESPACE_INCLUDE_DIR +# LIBFREESPACE_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# LIBFREESPACE_FOUND +# LIBFREESPACE_INCLUDE_DIRS +# LIBFREESPACE_LIBRARIES +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2014 Ryan Pavlik +# http://academic.cleardefinition.com +# +# 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) + +set(LIBFREESPACE_ROOT_DIR + "${LIBFREESPACE_ROOT_DIR}" + CACHE + PATH + "Directory to search for libfreespace") + +find_library(LIBFREESPACE_LIBRARY + NAMES + freespace + libfreespace + PATHS + "${LIBFREESPACE_ROOT_DIR}" + PATH_SUFFIXES + lib) + +get_filename_component(_libdir "${LIBFREESPACE_LIBRARY}" PATH) + +find_path(LIBFREESPACE_INCLUDE_DIR + NAMES + freespace/freespace.h + HINTS + "${_libdir}" + "${_libdir}/.." + PATHS + "${LIBFREESPACE_ROOT_DIR}" + PATH_SUFFIXES + include/) + + +include(FindPackageHandleStandardArgs) +if(WIN32) + find_package(WinHID QUIET) + find_package_handle_standard_args(LibFreespace + DEFAULT_MSG + LIBFREESPACE_LIBRARY + LIBFREESPACE_INCLUDE_DIR + WINHID_LIBRARIES) +else() + find_package_handle_standard_args(LibFreespace + DEFAULT_MSG + LIBFREESPACE_LIBRARY + LIBFREESPACE_INCLUDE_DIR) +endif() + +if(LIBFREESPACE_FOUND) + set(LIBFREESPACE_LIBRARIES "${LIBFREESPACE_LIBRARY}") + if(WIN32) + list(APPEND LIBFREESPACE_LIBRARIES ${WINHID_LIBRARIES}) + endif() + set(LIBFREESPACE_INCLUDE_DIRS "${LIBFREESPACE_INCLUDE_DIR}") + mark_as_advanced(LIBFREESPACE_ROOT_DIR) +endif() + +mark_as_advanced(LIBFREESPACE_INCLUDE_DIR + LIBFREESPACE_LIBRARY) diff --git a/FindLibusb1.cmake b/FindLibusb1.cmake index eb3f35a..b161c81 100644 --- a/FindLibusb1.cmake +++ b/FindLibusb1.cmake @@ -35,11 +35,11 @@ if(WIN32) program_files_fallback_glob(_dirs "LibUSB-Win32") if(CMAKE_SIZEOF_VOID_P EQUAL 8) if(MSVC) - set(_lib_suffixes lib/msvc_x64) + set(_lib_suffixes lib/msvc_x64 MS64/static) endif() else() if(MSVC) - set(_lib_suffixes lib/msvc) + set(_lib_suffixes lib/msvc MS32/static) elseif(COMPILER_IS_GNUCXX) set(_lib_suffixes lib/gcc) endif() @@ -62,15 +62,20 @@ find_path(LIBUSB1_INCLUDE_DIR HINTS "${LIBUSB1_ROOT_DIR}" PATH_SUFFIXES - include) + include/libusb-1.0 + include + libusb-1.0) find_library(LIBUSB1_LIBRARY NAMES + libusb-1.0 usb-1.0 PATHS ${PC_LIBUSB1_LIBRARY_DIRS} ${PC_LIBUSB1_LIBDIR} ${_dirs} + HINTS + "${LIBUSB1_ROOT_DIR}" PATH_SUFFIXES ${_lib_suffixes}) diff --git a/FindOVR.cmake b/FindOVR.cmake new file mode 100644 index 0000000..fa1473f --- /dev/null +++ b/FindOVR.cmake @@ -0,0 +1,219 @@ +# - try to find Oculus VR's SDK for Oculus Rift support +# +# Cache Variables: (probably not for direct use in your scripts) +# OVR_INCLUDE_DIR +# OVR_SOURCE_DIR +# OVR_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# OVR_FOUND +# OVR_INCLUDE_DIRS +# OVR_LIBRARIES +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2014 Kevin M. Godby +# +# 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(OVR_ROOT_DIR + "${OVR_ROOT_DIR}" + CACHE + PATH + "Directory to search for Oculus SDK") + +# The OVR library is built in a directory tree that varies based on platform, +# architecture, and compiler. +# +# The libraries live in one of the following locations: +# +# Lib/Win32/VS2012/libovrd.lib +# Lib/Win32/VS2012/libovr.lib +# Lib/Win32/VS2013/libovrd.lib +# Lib/Win32/VS2013/libovr.lib +# Lib/Win32/VS2010/libovrd.lib +# Lib/Win32/VS2010/libovr.lib +# Lib/x64/VS2012/libovr64d.lib +# Lib/x64/VS2012/libovr64.lib +# Lib/x64/VS2013/libovr64d.lib +# Lib/x64/VS2013/libovr64.lib +# Lib/x64/VS2010/libovr64d.lib +# Lib/x64/VS2010/libovr64.lib +# Lib/Linux/Release/x86_64/libovr.a +# Lib/Linux/Debug/x86_64/libovr.a +# Lib/Linux/Release/i386/libovr.a +# Lib/Linux/Debug/i386/libovr.a +# Lib/Mac/Release/libovr.a +# Lib/Mac/Debug/libovr.a + +set(OVR_LIBRARY_PATH_SUFFIX "Lib") + +# Test compiler +if(MSVC10) # Microsoft Visual Studio 2010 + set(_ovr_library_compiler "VS2010") +elseif(MSVC11) # Microsoft Visual Studio 2012 + set(_ovr_library_compiler "VS2012") +elseif(MSVC12) # Microsoft Visual Studio 2013 + set(_ovr_library_compiler "VS2013") +endif() + + +# Test 32/64 bits +if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + set(_ovr_library_arch "x86_64") + if (WIN32) + set(_ovr_library_arch "x64") + set(_ovr_libname_bitsuffix "64") + endif(WIN32) +else() + set(_ovr_library_arch "i386") + if (WIN32) + set(_ovr_library_arch "Win32") + set(_ovr_libname_bitsuffix "") + endif(WIN32) +endif() + +# Test platform +if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + set(OVR_LIBRARY_PATH_SUFFIX_START "Lib/Linux") # needs build type and arch +elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(OVR_LIBRARY_PATH_SUFFIX_START "Lib/Mac") # needs build type +elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows") + set(OVR_LIBRARY_PATH_SUFFIX "Lib/${_ovr_library_arch}/${_ovr_library_compiler}") +endif() + +find_library(OVR_LIBRARY_RELEASE + NAMES + ovr${_ovr_libname_bitsuffix} + libovr${_ovr_libname_bitsuffix} + PATHS + "${OVR_ROOT_DIR}" + "${OVR_ROOT_DIR}/LibOVR" + c:/tools/oculus-sdk.install/OculusSDK/LibOVR + PATH_SUFFIXES + ${OVR_LIBRARY_PATH_SUFFIX} + ${OVR_LIBRARY_PATH_SUFFIX_START}/Release + ${OVR_LIBRARY_PATH_SUFFIX_START}/Release/${_ovr_library_arch}) + +find_library(OVR_LIBRARY_DEBUG + NAMES + ovr${_ovr_libname_bitsuffix}d + libovr${_ovr_libname_bitsuffix}d + PATHS + "${OVR_ROOT_DIR}" + "${OVR_ROOT_DIR}/LibOVR" + c:/tools/oculus-sdk.install/OculusSDK/LibOVR + PATH_SUFFIXES + ${OVR_LIBRARY_PATH_SUFFIX} + ${OVR_LIBRARY_PATH_SUFFIX_START}/Debug + ${OVR_LIBRARY_PATH_SUFFIX_START}/Debug/${_ovr_library_arch}) + +include(SelectLibraryConfigurations) +select_library_configurations(OVR) + +if(OVR_LIBRARY_RELEASE) + get_filename_component(_libdir "${OVR_LIBRARY_RELEASE}" PATH) +endif() + +find_path(OVR_INCLUDE_DIR + NAMES + OVR.h + HINTS + "${_libdir}" + "${_libdir}/.." + "${_libdir}/../.." + "${_libdir}/../../.." + PATHS + "${OVR_ROOT_DIR}" + PATH_SUFFIXES + include + Include + ) + +find_path(OVR_SOURCE_DIR + NAMES + OVR_CAPI.h + HINTS + "${_libdir}" + "${_libdir}/.." + "${_libdir}/../.." + "${_libdir}/../../.." + PATHS + "${OVR_ROOT_DIR}" + PATH_SUFFIXES + Src + ) + +# Dependencies + +set(_ovr_dependency_libraries "") +set(_ovr_dependency_includes "") + +if(NOT OPENGL_FOUND) + find_package(OpenGL) + list(APPEND _ovr_dependency_libraries ${OPENGL_LIBRARIES}) + list(APPEND _ovr_dependency_includes ${OPENGL_INCLUDE_DIR}) + list(APPEND _ovr_dependencies OPENGL_FOUND) +endif() + +if(NOT THREADS_FOUND) + find_package(Threads) + list(APPEND _ovr_dependency_libraries ${CMAKE_THREAD_LIBS_INIT}) + list(APPEND _ovr_dependencies THREADS_FOUND) +endif() + +# Linux-only dependencies +if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + if(NOT X11_FOUND) + find_package(X11) + list(APPEND _ovr_dependency_libraries ${X11_LIBRARIES}) + list(APPEND _ovr_dependency_includes ${X11_INCLUDE_DIR}) + list(APPEND _ovr_dependencies X11_FOUND) + endif() + + if(NOT XRANDR_FOUND) + find_package(Xrandr) + list(APPEND _ovr_dependency_libraries ${XRANDR_LIBRARIES}) + list(APPEND _ovr_dependency_includes ${XRANDR_INCLUDE_DIR}) + list(APPEND _ovr_dependencies XRANDR_FOUND) + endif() + + if(NOT UDEV_FOUND) + find_package(udev) + list(APPEND _ovr_dependency_libraries ${UDEV_LIBRARIES}) + list(APPEND _ovr_dependency_includes ${UDEV_INCLUDE_DIR}) + list(APPEND _ovr_dependencies UDEV_FOUND) + endif() +endif() + +if(WIN32) + #find_library(OVR_WINMM_LIBRARY winmm) + #find_library(OVR_WS2_LIBRARY ws2_32) + list(APPEND _ovr_dependency_libraries winmm ws2_32)#${OVR_WINMM_LIBRARY} ${OVR_WS2_LIBRARY}) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(OVR + DEFAULT_MSG + OVR_LIBRARY + OVR_INCLUDE_DIR + OVR_SOURCE_DIR + ${_ovr_dependencies} + ) + +if(OVR_FOUND) + set(OVR_LIBRARIES ${OVR_LIBRARY} ${_ovr_dependency_libraries}) + set(OVR_INCLUDE_DIRS ${OVR_INCLUDE_DIR} ${OVR_SOURCE_DIR} ${_ovr_dependency_includes}) + mark_as_advanced(OVR_ROOT_DIR) +endif() + +mark_as_advanced(OVR_INCLUDE_DIR + OVR_SOURCE_DIR + OVR_LIBRARY + OVR_WINMM_LIBRARY + OVR_WS2_LIBRARY) + diff --git a/FindOpenCV.cmake b/FindOpenCV1.cmake similarity index 100% rename from FindOpenCV.cmake rename to FindOpenCV1.cmake diff --git a/FindOpenHaptics.cmake b/FindOpenHaptics.cmake index ea7b0f2..0e4958c 100644 --- a/FindOpenHaptics.cmake +++ b/FindOpenHaptics.cmake @@ -236,9 +236,9 @@ find_library(HDAPI_HDU_LIBRARY_DEBUG select_library_configurations(HDAPI_HDU) if(OPENHAPTICS_NESTED_TARGETS OR NOT HDAPI_HDU_LIBRARY) - if(HDAPI_HDU_SOURCE_DIR AND NOT EXISTS "${HDAPI_HDU_SOURCE_DIR}/hdu.cpp") - unset(HDAPI_HDU_SOURCE_DIR) - endif() + if(HDAPI_HDU_SOURCE_DIR AND NOT EXISTS "${HDAPI_HDU_SOURCE_DIR}/hdu.cpp") + unset(HDAPI_HDU_SOURCE_DIR) + endif() find_path(HDAPI_HDU_SOURCE_DIR NAMES hdu.cpp @@ -334,9 +334,9 @@ find_library(HLAPI_HLU_LIBRARY_DEBUG select_library_configurations(HLAPI_HLU) if(OPENHAPTICS_NESTED_TARGETS OR NOT HLAPI_HLU_LIBRARY) - if(HLAPI_HLU_SOURCE_DIR AND NOT EXISTS "${HLAPI_HLU_SOURCE_DIR}/hlu.cpp") - unset(HLAPI_HLU_SOURCE_DIR) - endif() + if(HLAPI_HLU_SOURCE_DIR AND NOT EXISTS "${HLAPI_HLU_SOURCE_DIR}/hlu.cpp") + unset(HLAPI_HLU_SOURCE_DIR) + endif() find_path(HLAPI_HLU_SOURCE_DIR NAMES hlu.cpp @@ -428,7 +428,7 @@ if(OPENHAPTICS_FOUND) # Recurse into the nested targets subdirectory if needed if(_nest_targets) get_filename_component(_moddir "${CMAKE_CURRENT_LIST_FILE}" PATH) - add_subdirectory("${_moddir}/nested_targets/OpenHaptics") + add_subdirectory("${_moddir}/nested_targets/OpenHaptics" "OpenHapticsNestedTargets") endif() set(OPENHAPTICS_LIBRARIES diff --git a/FindSDL2.cmake b/FindSDL2.cmake new file mode 100644 index 0000000..f69c68a --- /dev/null +++ b/FindSDL2.cmake @@ -0,0 +1,249 @@ +# - Find SDL2 +# Find the SDL2 headers and libraries +# +# SDL2::SDL2 - Imported target to use for building a library +# SDL2::SDL2main - Imported interface target to use if you want SDL and SDLmain. +# SDL2_FOUND - True if SDL2 was found. +# SDL2_DYNAMIC - If we found a DLL version of SDL (meaning you might want to copy a DLL from SDL2::SDL2) +# +# Original Author: +# 2015 Ryan Pavlik +# +# Copyright Sensics, Inc. 2015. +# 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 up architectures (for windows) and prefixes (for mingw builds) +if(WIN32) + if(MINGW) + include(MinGWSearchPathExtras OPTIONAL) + if(MINGWSEARCH_TARGET_TRIPLE) + set(SDL2_PREFIX ${MINGWSEARCH_TARGET_TRIPLE}) + endif() + endif() + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(SDL2_LIB_PATH_SUFFIX lib/x64) + if(NOT MSVC AND NOT SDL2_PREFIX) + set(SDL2_PREFIX x86_64-w64-mingw32) + endif() + else() + set(SDL2_LIB_PATH_SUFFIX lib/x86) + if(NOT MSVC AND NOT SDL2_PREFIX) + set(SDL2_PREFIX i686-w64-mingw32) + endif() + endif() +endif() + +if(SDL2_PREFIX) + set(SDL2_ORIGPREFIXPATH ${CMAKE_PREFIX_PATH}) + if(SDL2_ROOT_DIR) + list(APPEND CMAKE_PREFIX_PATH "${SDL2_ROOT_DIR}") + endif() + if(CMAKE_PREFIX_PATH) + foreach(_prefix ${CMAKE_PREFIX_PATH}) + list(APPEND CMAKE_PREFIX_PATH "${_prefix}/${SDL2_PREFIX}") + endforeach() + endif() + if(MINGWSEARCH_PREFIXES) + list(APPEND CMAKE_PREFIX_PATH ${MINGWSEARCH_PREFIXES}) + endif() +endif() + +# Invoke pkgconfig for hints +find_package(PkgConfig QUIET) +set(SDL2_INCLUDE_HINTS) +set(SDL2_LIB_HINTS) +if(PKG_CONFIG_FOUND) + pkg_search_module(SDL2PC QUIET sdl2) + if(SDL2PC_INCLUDE_DIRS) + set(SDL2_INCLUDE_HINTS ${SDL2PC_INCLUDE_DIRS}) + endif() + if(SDL2PC_LIBRARY_DIRS) + set(SDL2_LIB_HINTS ${SDL2PC_LIBRARY_DIRS}) + endif() +endif() + +include(FindPackageHandleStandardArgs) + +find_library(SDL2_LIBRARY + NAMES + SDL2 + HINTS + ${SDL2_LIB_HINTS} + PATHS + ${SDL2_ROOT_DIR} + ENV SDL2DIR + PATH_SUFFIXES lib SDL2 ${SDL2_LIB_PATH_SUFFIX}) + +set(_sdl2_framework FALSE) +# Some special-casing if we've found/been given a framework. +# Handles whether we're given the library inside the framework or the framework itself. +if(APPLE AND "${SDL2_LIBRARY}" MATCHES "(/[^/]+)*.framework(/.*)?$") + set(_sdl2_framework TRUE) + set(SDL2_FRAMEWORK "${SDL2_LIBRARY}") + # Move up in the directory tree as required to get the framework directory. + while("${SDL2_FRAMEWORK}" MATCHES "(/[^/]+)*.framework(/.*)$" AND NOT "${SDL2_FRAMEWORK}" MATCHES "(/[^/]+)*.framework$") + get_filename_component(SDL2_FRAMEWORK "${SDL2_FRAMEWORK}" DIRECTORY) + endwhile() + if("${SDL2_FRAMEWORK}" MATCHES "(/[^/]+)*.framework$") + set(SDL2_FRAMEWORK_NAME ${CMAKE_MATCH_1}) + # If we found a framework, do a search for the header ahead of time that will be more likely to get the framework header. + find_path(SDL2_INCLUDE_DIR + NAMES + SDL_haptic.h # this file was introduced with SDL2 + HINTS + "${SDL2_FRAMEWORK}/Headers/") + else() + # For some reason we couldn't get the framework directory itself. + # Shouldn't happen, but might if something is weird. + unset(SDL2_FRAMEWORK) + endif() +endif() + +find_path(SDL2_INCLUDE_DIR + NAMES + SDL_haptic.h # this file was introduced with SDL2 + HINTS + ${SDL2_INCLUDE_HINTS} + PATHS + ${SDL2_ROOT_DIR} + ENV SDL2DIR + PATH_SUFFIXES include include/sdl2 include/SDL2 SDL2) + +if(WIN32 AND SDL2_LIBRARY) + find_file(SDL2_RUNTIME_LIBRARY + NAMES + SDL2.dll + libSDL2.dll + HINTS + ${SDL2_LIB_HINTS} + PATHS + ${SDL2_ROOT_DIR} + ENV SDL2DIR + PATH_SUFFIXES bin lib ${SDL2_LIB_PATH_SUFFIX}) +endif() + + +if(WIN32 OR ANDROID OR IOS OR (APPLE AND NOT _sdl2_framework)) + set(SDL2_EXTRA_REQUIRED SDL2_SDLMAIN_LIBRARY) + find_library(SDL2_SDLMAIN_LIBRARY + NAMES + SDL2main + PATHS + ${SDL2_ROOT_DIR} + ENV SDL2DIR + PATH_SUFFIXES lib ${SDL2_LIB_PATH_SUFFIX}) +endif() + +if(MINGW AND NOT SDL2PC_FOUND) + find_library(SDL2_MINGW_LIBRARY mingw32) + find_library(SDL2_MWINDOWS_LIBRARY mwindows) +endif() + +if(SDL2_PREFIX) + # Restore things the way they used to be. + set(CMAKE_PREFIX_PATH ${SDL2_ORIGPREFIXPATH}) +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(SDL2 + DEFAULT_MSG + SDL2_LIBRARY + SDL2_INCLUDE_DIR + ${SDL2_EXTRA_REQUIRED}) + +if(SDL2_FOUND) + if(NOT TARGET SDL2::SDL2) + # Create SDL2::SDL2 + if(WIN32 AND SDL2_RUNTIME_LIBRARY) + set(SDL2_DYNAMIC TRUE) + add_library(SDL2::SDL2 SHARED IMPORTED) + set_target_properties(SDL2::SDL2 + PROPERTIES + IMPORTED_IMPLIB "${SDL2_LIBRARY}" + IMPORTED_LOCATION "${SDL2_RUNTIME_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}" + ) + else() + add_library(SDL2::SDL2 UNKNOWN IMPORTED) + if(SDL2_FRAMEWORK AND SDL2_FRAMEWORK_NAME) + # Handle the case that SDL2 is a framework and we were able to decompose it above. + set_target_properties(SDL2::SDL2 PROPERTIES + IMPORTED_LOCATION "${SDL2_FRAMEWORK}/${SDL2_FRAMEWORK_NAME}") + elseif(_sdl2_framework AND SDL2_LIBRARY MATCHES "(/[^/]+)*.framework$") + # Handle the case that SDL2 is a framework and SDL_LIBRARY is just the framework itself. + + # This takes the basename of the framework, without the extension, + # and sets it (as a child of the framework) as the imported location for the target. + # This is the library symlink inside of the framework. + set_target_properties(SDL2::SDL2 PROPERTIES + IMPORTED_LOCATION "${SDL2_LIBRARY}/${CMAKE_MATCH_1}") + else() + # Handle non-frameworks (including non-Mac), as well as the case that we're given the library inside of the framework + set_target_properties(SDL2::SDL2 PROPERTIES + IMPORTED_LOCATION "${SDL2_LIBRARY}") + endif() + set_target_properties(SDL2::SDL2 + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}" + ) + endif() + + if(APPLE) + # Need Cocoa here, is always a framework + find_library(SDL2_COCOA_LIBRARY Cocoa) + list(APPEND SDL2_EXTRA_REQUIRED SDL2_COCOA_LIBRARY) + if(SDL2_COCOA_LIBRARY) + set_target_properties(SDL2::SDL2 PROPERTIES + IMPORTED_LINK_INTERFACE_LIBRARIES ${SDL2_COCOA_LIBRARY}) + endif() + endif() + + + # Compute what to do with SDL2main + set(SDL2MAIN_LIBRARIES SDL2::SDL2) + add_library(SDL2::SDL2main INTERFACE IMPORTED) + if(SDL2_SDLMAIN_LIBRARY) + add_library(SDL2::SDL2main_real STATIC IMPORTED) + set_target_properties(SDL2::SDL2main_real + PROPERTIES + IMPORTED_LOCATION "${SDL2_SDLMAIN_LIBRARY}") + set(SDL2MAIN_LIBRARIES SDL2::SDL2main_real ${SDL2MAIN_LIBRARIES}) + endif() + if(MINGW) + # MinGW requires some additional libraries to appear earlier in the link line. + if(SDL2PC_LIBRARIES) + # Use pkgconfig-suggested extra libraries if available. + list(REMOVE_ITEM SDL2PC_LIBRARIES SDL2main SDL2) + set(SDL2MAIN_LIBRARIES ${SDL2PC_LIBRARIES} ${SDL2MAIN_LIBRARIES}) + else() + # fall back to extra libraries specified in pkg-config in + # an official binary distro of SDL2 for MinGW I downloaded + if(SDL2_MINGW_LIBRARY) + set(SDL2MAIN_LIBRARIES ${SDL2_MINGW_LIBRARY} ${SDL2MAIN_LIBRARIES}) + endif() + if(SDL2_MWINDOWS_LIBRARY) + set(SDL2MAIN_LIBRARIES ${SDL2_MWINDOWS_LIBRARY} ${SDL2MAIN_LIBRARIES}) + endif() + endif() + set_target_properties(SDL2::SDL2main + PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "main=SDL_main") + endif() + set_target_properties(SDL2::SDL2main + PROPERTIES + INTERFACE_LINK_LIBRARIES "${SDL2MAIN_LIBRARIES}") + endif() + mark_as_advanced(SDL2_ROOT_DIR) +endif() + +mark_as_advanced(SDL2_LIBRARY + SDL2_RUNTIME_LIBRARY + SDL2_INCLUDE_DIR + SDL2_SDLMAIN_LIBRARY + SDL2_COCOA_LIBRARY + SDL2_MINGW_LIBRARY + SDL2_MWINDOWS_LIBRARY) diff --git a/FindVRJuggler.cmake b/FindVRJuggler.cmake index 490b959..c794d09 100644 --- a/FindVRJuggler.cmake +++ b/FindVRJuggler.cmake @@ -171,10 +171,10 @@ endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(VRJuggler - DEFAULT_MSG - VRJUGGLER_VERSION + REQUIRED_VARS VRJUGGLER_LIBRARIES - VRJUGGLER_FOUND) + VERSION_VAR + VRJUGGLER_VERSION) if(VRJUGGLER_FOUND) mark_as_advanced(VRJUGGLER_ROOT_DIR) diff --git a/FindVRJuggler30.cmake b/FindVRJuggler30.cmake index 097056d..4d28f01 100644 --- a/FindVRJuggler30.cmake +++ b/FindVRJuggler30.cmake @@ -209,10 +209,23 @@ if(VRJUGGLER30_FOUND) set(_vjbase) set(_vjbaseclean) - foreach(_lib ${VPR22_LIBRARY} ${VRJ30_LIBRARY} ${VRJOGL30_LIBRARY} ${JCCL14_LIBRARY} ${GADGETEER20_LIBRARY}) - get_filename_component(_libpath "${_lib}" PATH) - get_filename_component(_abspath "${_libpath}/.." ABSOLUTE) - list(APPEND _vjbase "${_abspath}") + foreach(_component VPR22 VRJ30 VRJOGL30 JCCL14 GADGETEER20) + + # Find the common parent directory of the include dir and the library dir + get_filename_component(_absincpath "${${_component}_INCLUDE_DIR}" PATH) + if(${_component}_INCLUDE_DIR) + get_filename_component(_curpath "${${_component}_LIBRARY_RELEASE}" PATH) + get_filename_component(_nextpath "${_curpath}/.." ABSOLUTE) + while(NOT _curpath STREQUAL _nextpath) + set(_curpath "${_nextpath}") + string(LENGTH "${_curpath}" _pathlen) + if("${_absincpath}" MATCHES "^${_curpath}.*") + list(APPEND _vjbase "${_curpath}") + break() + endif() + get_filename_component(_nextpath "${_curpath}/.." ABSOLUTE) + endwhile() + endif() endforeach() clean_directory_list(_vjbase) @@ -403,12 +416,6 @@ function(install_vrjuggler30_data_files prefix) _vj_sound_files "${base}/sounds/*.wav") install(FILES ${_vj_sound_files} DESTINATION "${DEST}/sounds/") - - # calibration.table - needed? - file(GLOB - _vj_config_files - "${base}/configFiles/*.jconf") - install(FILES "${base}/calibration.table" DESTINATION "${DEST}") endfunction() macro(_vrjuggler30_plugin_install _VAR) diff --git a/FindVRPN.cmake b/FindVRPN.cmake index 2981fcd..641b62b 100644 --- a/FindVRPN.cmake +++ b/FindVRPN.cmake @@ -41,15 +41,21 @@ if("${CMAKE_SIZEOF_VOID_P}" MATCHES "8") file(TO_CMAKE_PATH "$ENV{ProgramW6432}" _progfiles) else() set(_libsuffixes lib) - if(NOT "$ENV{ProgramFiles(x86)}" STREQUAL "") + set(_PF86 "ProgramFiles(x86)") + if(NOT "$ENV{${_PF86}}" STREQUAL "") # 32-bit dir: only set on win64 - file(TO_CMAKE_PATH "$ENV{ProgramFiles(x86)}" _progfiles) + file(TO_CMAKE_PATH "$ENV{${_PF86}}" _progfiles) else() # 32-bit dir on win32, useless to us on win64 file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _progfiles) endif() endif() +set(_vrpn_quiet) +if(VRPN_FIND_QUIETLY) + set(_vrpn_quiet QUIET) +endif() + ### # Configure VRPN ### @@ -63,7 +69,9 @@ find_path(VRPN_INCLUDE_DIR HINTS "${VRPN_ROOT_DIR}" PATHS - "${_progfiles}/VRPN") + "${_progfiles}/VRPN" + C:/usr/local + /usr/local) find_library(VRPN_LIBRARY NAMES @@ -73,7 +81,9 @@ find_library(VRPN_LIBRARY HINTS "${VRPN_ROOT_DIR}" PATHS - "${_progfiles}/VRPN") + "${_progfiles}/VRPN" + C:/usr/local + /usr/local) find_library(VRPN_SERVER_LIBRARY NAMES @@ -83,7 +93,9 @@ find_library(VRPN_SERVER_LIBRARY HINTS "${VRPN_ROOT_DIR}" PATHS - "${_progfiles}/VRPN") + "${_progfiles}/VRPN" + C:/usr/local + /usr/local) ### # Dependencies @@ -92,17 +104,25 @@ set(_deps_libs) set(_deps_includes) set(_deps_check) -find_package(quatlib) +find_package(quatlib ${_vrpn_quiet}) 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) + find_package(Threads ${_vrpn_quiet}) list(APPEND _deps_libs ${CMAKE_THREAD_LIBS_INIT}) list(APPEND _deps_check CMAKE_HAVE_THREADS_LIBRARY) endif() +if(WIN32) + find_package(Libusb1 QUIET) + if(LIBUSB1_FOUND) + list(APPEND _deps_libs ${LIBUSB1_LIBRARIES}) + list(APPEND _deps_includes ${LIBUSB1_INCLUDE_DIRS}) + endif() +endif() + # handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if # all listed variables are TRUE diff --git a/FindWayland.cmake b/FindWayland.cmake new file mode 100644 index 0000000..80aff5d --- /dev/null +++ b/FindWayland.cmake @@ -0,0 +1,45 @@ +# - Try to Find Wayland +# +# Copyright 2015 Vlad Zagorodniy +# 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) +# +# Will be defined: +# WAYLAND_FOUND +# WAYLAND_CLIENT_FOUND +# WAYLAND_SERVER_FOUND +# WAYLAND_CLIENT_INCLUDE_DIR +# WAYLAND_SERVER_INCLUDE_DIR +# WAYLAND_CLIENT_LIBRARIES +# WAYLAND_SERVER_LIBRARIES +# + +find_package(PkgConfig) +pkg_check_modules(PKG_WAYLAND_CLIENT REQUIRED wayland-client) +pkg_check_modules(PKG_WAYLAND_SERVER REQUIRED wayland-server) + +if (NOT PKG_WAYLAND_CLIENT_FOUND) + message(FATAL_ERROR "No wayland-client") +endif(NOT PKG_WAYLAND_CLIENT_FOUND) + +if (NOT PKG_WAYLAND_SERVER_FOUND) + message(FATAL_ERROR "No wayland-server") +endif(NOT PKG_WAYLAND_SERVER_FOUND) + +# find include paths +find_path(WAYLAND_CLIENT_INCLUDE_DIR wayland-client.h ${PKG_WAYLAND_CLIENT_INCLUDE_DIRS}) +find_path(WAYLAND_SERVER_INCLUDE_DIR wayland-server.h ${PKG_WAYLAND_SERVER_INCLUDE_DIRS}) + +# find libs +find_library(WAYLAND_CLIENT_LIBRARIES NAMES wayland-client PATHS ${PKG_WAYLAND_CLIENT_LIBRARY_DIRS}) +find_library(WAYLAND_SERVER_LIBRARIES NAMES wayland-server PATHS ${PKG_WAYLAND_SERVER_LIBRARY_DIRS}) + +# set _FOUND vars +set(WAYLAND_CLIENT_FOUND TRUE) +set(WAYLAND_SERVER_FOUND TRUE) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(WAYLAND DEFAULT_MSG WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES + WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES) +mark_as_advanced(WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES + WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES) diff --git a/FindWinHID.cmake b/FindWinHID.cmake index 2d91bb0..7dd0572 100644 --- a/FindWinHID.cmake +++ b/FindWinHID.cmake @@ -14,6 +14,8 @@ # FindPackageHandleStandardArgs (known included with CMake >=2.6.2) # PrefixListGlob # CleanDirectoryList +# MinGWSearchPathExtras +# FindWindowsSDK # # Original Author: # 2009-2010 Ryan Pavlik @@ -31,64 +33,128 @@ if(NOT WIN32) 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) -else() - set(_arch i386) -endif() - +set(_deps_check) +set(_need_crt_dir) if(MSVC) + + find_package(WindowsSDK) + set(WINSDK_LIBDIRS) + if(WINDOWSSDK_FOUND) + get_windowssdk_library_dirs_multiple(WINSDK_LIBDIRS ${WINDOWSSDK_PREFERRED_FIRST_DIRS}) + foreach(WINSDKDIR ${WINDOWSSDK_DIRS}) + get_windowssdk_library_dirs(${WINSDKDIR} WINSDK_CURRENT_LIBDIRS) + list(APPEND WINSDK_LIBDIRS ${WINSDK_CURRENT_LIBDIRS}) + endforeach() + endif() + + 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() 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 + PATHS "${WINHID_ROOT_DIR}" + ${WINSDK_LIBDIRS} ${_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. - get_filename_component(_libdir "${WINHID_LIBRARY}" PATH) - get_filename_component(_basedir "${_libdir}/../../.." ABSOLUTE) + # Might want to look close to the library first for the includes. + if(WINHID_LIBRARY) + get_filename_component(WINHID_LIBRARY_DIR "${WINHID_LIBRARY}" PATH) + if(WINDOWSSDK_FOUND) + get_windowssdk_from_component("${WINHID_LIBRARY}" _USED_WINSDK) + set(WINHID_LIBRARY_FROM_WINDOWSSDK ON) + get_windowssdk_include_dirs(${_USED_WINSDK} WINHID_INCLUDE_HINTS) + endif() + endif() - find_path(WINHID_CRT_INCLUDE_DIR # otherwise you get weird compile errors + find_library(WINHID_SETUPAPI_LIBRARY NAMES - stdio.h + setupapi HINTS - "${_basedir}" + "${WINHID_LIBRARY_DIR}" PATHS "${WINHID_ROOT_DIR}" + ${WINSDK_LIBDIRS} + ${_prefixed} PATH_SUFFIXES - inc/crt - NO_DEFAULT_PATH) + "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 + ) + + if(WINHID_LIBRARY AND NOT WINHID_LIBRARY_FROM_WINDOWSSDK) + set(_basedir "${WINHID_LIBRARY_DIR}") + set(_prevdir) + while(NOT IS_DIRECTORY "${_basedir}/lib" AND NOT (_basedir STREQUAL _prevdir)) + set(_prevdir "${_basedir}") + get_filename_component(_basedir "${_basedir}/.." ABSOLUTE) + endwhile() + + set(WINHID_INCLUDE_HINTS "${_basedir}") + + if(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() + endif() find_path(WINHID_INCLUDE_DIR NAMES hidsdi.h HINTS - "${_basedir}" + ${WINHID_INCLUDE_HINTS} PATHS "${WINHID_ROOT_DIR}" PATH_SUFFIXES @@ -96,22 +162,61 @@ if(MSVC) inc/api inc/w2k inc/wxp - inc/wnet) + inc/wnet + include/shared) else() - find_library(WINHID_LIBRARY - NAMES - libhid - HINTS - "${WINHID_ROOT_DIR}" - /mingw - PATH_SUFFIXES - lib - lib/w32api) + # This is the non-MSVC path. + if(MINGW) + include(MinGWSearchPathExtras) + + find_library(WINHID_LIBRARY + NAMES + libhid + HINTS + "${WINHID_ROOT_DIR}" + ${MINGWSEARCH_LIBRARY_DIRS} + /mingw + PATH_SUFFIXES + lib + lib/w32api) + find_library(WINHID_SETUPAPI_LIBRARY + NAMES + libsetupapi + HINTS + "${WINHID_ROOT_DIR}" + ${MINGWSEARCH_LIBRARY_DIRS} + /mingw + PATH_SUFFIXES + lib + lib/w32api) + else() + find_library(WINHID_LIBRARY + NAMES + hid + libhid + HINTS + "${WINHID_ROOT_DIR}" + /mingw + PATH_SUFFIXES + lib + lib/w32api) + find_library(WINHID_SETUPAPI_LIBRARY + NAMES + setupapi + libsetupapi + HINTS + "${WINHID_ROOT_DIR}" + /mingw + PATH_SUFFIXES + lib + lib/w32api) + endif() find_path(WINHID_INCLUDE_DIR NAMES hidsdi.h PATHS "${WINHID_ROOT_DIR}" + ${MINGWSEARCH_INCLUDE_DIRS} /mingw PATH_SUFFIXES include/w32api/ddk @@ -123,34 +228,58 @@ include(FindPackageHandleStandardArgs) find_package_handle_standard_args(WinHID DEFAULT_MSG WINHID_LIBRARY - WINHID_INCLUDE_DIR) + WINHID_SETUPAPI_LIBRARY + WINHID_INCLUDE_DIR + ${_deps_check}) if(WINHID_FOUND) if(MSVC) - set(_winreq "Unknown") - if(WINHID_LIBRARY MATCHES "lib/w2k") + set(_winreq) + if(WINHID_LIBRARY MATCHES "[Ll]ib/w2k") set(_winreq "Windows 2000") - elseif(WINHID_LIBRARY MATCHES "lib/wxp") + elseif(WINHID_LIBRARY MATCHES "[Ll]ib/wxp") set(_winreq "Windows XP") - elseif(WINHID_LIBRARY MATCHES "lib/wnet") + elseif(WINHID_LIBRARY MATCHES "[Ll]ib/wnet") set(_winreq "Windows Server 2003") - elseif(WINHID_LIBRARY MATCHES "lib/wlh") + elseif(WINHID_LIBRARY MATCHES "[Ll]ib/wlh") set(_winreq "Windows Vista") - elseif(WINHID_LIBRARY MATCHES "lib/win7") + elseif(WINHID_LIBRARY MATCHES "[Ll]ib/win7") set(_winreq "Windows 7") + elseif(WINHID_LIBRARY MATCHES "[Ll]ib/win8") + set(_winreq "Windows 8") + set(_winreq_uncertain ON) + elseif(WINHID_LIBRARY MATCHES "[Ll]ib/winv6.3") + set(_winreq "Windows 8.1") + set(_winreq_uncertain ON) + elseif(WINHID_LIBRARY MATCHES "[Ll]ib/10.0") + set(_winreq "Windows 10") + set(_winreq_uncertain ON) 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}") + if(NOT _winreq) + message("Couldn't determine if the WINHID_LIBRARY would result in a minimum version compatibility requirement.") + elseif(_winreq_uncertain) + message(STATUS + "Found WINHID_LIBRARY in the Windows SDK for ${_winreq} , which may or may not affect minimum compatible Windows version.") + else() + message(STATUS + "Linking against WINHID_LIBRARY will enforce this minimum version: ${_winreq}") + endif() endif() set(WINHID_MIN_WINDOWS_VER "${_winreq}" CACHE INTERNAL "" FORCE) endif() endif() - set(WINHID_LIBRARIES "${WINHID_LIBRARY}") - set(WINHID_INCLUDE_DIRS - "${WINHID_CRT_INCLUDE_DIR}" - "${WINHID_INCLUDE_DIR}") + set(WINHID_LIBRARIES "${WINHID_LIBRARY}" "${WINHID_SETUPAPI_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() diff --git a/FindWindowsSDK.cmake b/FindWindowsSDK.cmake index 04992d1..6740dbb 100644 --- a/FindWindowsSDK.cmake +++ b/FindWindowsSDK.cmake @@ -1,5 +1,11 @@ # - Find the Windows SDK aka Platform SDK # +# Relevant Wikipedia article: http://en.wikipedia.org/wiki/Microsoft_Windows_SDK +# +# Pass "COMPONENTS tools" to ignore Visual Studio version checks: in case +# you just want the tool binaries to run, rather than the libraries and headers +# for compiling. +# # 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 @@ -15,6 +21,26 @@ # windowssdk_name_lookup( ) - 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. # +# windowssdk_build_lookup( ) - Find the build version number 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( ) - Given a library or include dir, +# find the Windows SDK root dir corresponding to it, or NOTFOUND if unrecognized. +# +# get_windowssdk_library_dirs( ) - Find the architecture-appropriate +# library directories corresponding to the SDK directory you pass in (or NOTFOUND if none) +# +# get_windowssdk_library_dirs_multiple( ...) - Find the architecture-appropriate +# library directories corresponding to the SDK directories you pass in, in order, skipping those not found. NOTFOUND if none at all. +# Good for passing WINDOWSSDK_DIRS or WINDOWSSDK_DIRS to if you really just want a file and don't care where from. +# +# get_windowssdk_include_dirs( ) - Find the +# include directories corresponding to the SDK directory you pass in (or NOTFOUND if none) +# +# get_windowssdk_include_dirs_multiple( ...) - Find the +# include directories corresponding to the SDK directories you pass in, in order, skipping those not found. NOTFOUND if none at all. +# Good for passing WINDOWSSDK_DIRS or WINDOWSSDK_DIRS to if you really just want a file and don't care where from. +# # Requires these CMake modules: # FindPackageHandleStandardArgs (known included with CMake >=2.6.2) # @@ -28,116 +54,416 @@ # (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 +set(_preferred_sdk_dirs) # pre-output +set(_win_sdk_dirs) # pre-output +set(_win_sdk_versanddirs) # pre-output +set(_win_sdk_buildsanddirs) # pre-output +set(_winsdk_vistaonly) # search parameters +set(_winsdk_kits) # search parameters + + +set(_WINDOWSSDK_ANNOUNCE OFF) +if(NOT WINDOWSSDK_FOUND AND (NOT WindowsSDK_FIND_QUIETLY)) + set(_WINDOWSSDK_ANNOUNCE ON) +endif() +macro(_winsdk_announce) + if(_WINSDK_ANNOUNCE) + message(STATUS ${ARGN}) + endif() +endmacro() + +set(_winsdk_win10vers + 10.0.17133.0 # Redstone 4 aka Win10 1803 "April 1018 Update" + 10.0.16299.0 # Redstone 3 aka Win10 1709 "Fall Creators Update" + 10.0.15063.0 # Redstone 2 aka Win10 1703 "Creators Update" + 10.0.14393.0 # Redstone aka Win10 1607 "Anniversary Update" + 10.0.10586.0 # TH2 aka Win10 1511 + 10.0.10240.0 # Win10 RTM + 10.0.10150.0 # just ucrt + 10.0.10056.0 +) + +if(WindowsSDK_FIND_COMPONENTS MATCHES "tools") + set(_WINDOWSSDK_IGNOREMSVC ON) + _winsdk_announce("Checking for tools from Windows/Platform SDKs...") +else() + set(_WINDOWSSDK_IGNOREMSVC OFF) + _winsdk_announce("Checking for Windows/Platform SDKs...") +endif() + +# Appends to the three main pre-output lists used only if the path exists +# and is not already in the list. +function(_winsdk_conditional_append _vername _build _path) + if(("${_path}" MATCHES "registry") OR (NOT EXISTS "${_path}")) + # Path invalid - do not add + return() + endif() + list(FIND _win_sdk_dirs "${_path}" _win_sdk_idx) + if(_win_sdk_idx GREATER -1) + # Path already in list - do not add + return() + endif() + _winsdk_announce( " - ${_vername}, Build ${_build} @ ${_path}") + # Not yet in the list, so we'll add it + list(APPEND _win_sdk_dirs "${_path}") + set(_win_sdk_dirs "${_win_sdk_dirs}" CACHE INTERNAL "" FORCE) + list(APPEND + _win_sdk_versanddirs + "${_vername}" + "${_path}") + set(_win_sdk_versanddirs "${_win_sdk_versanddirs}" CACHE INTERNAL "" FORCE) + list(APPEND + _win_sdk_buildsanddirs + "${_build}" + "${_path}") + set(_win_sdk_buildsanddirs "${_win_sdk_buildsanddirs}" CACHE INTERNAL "" FORCE) +endfunction() + +# Appends to the "preferred SDK" lists only if the path exists +function(_winsdk_conditional_append_preferred _info _path) + if(("${_path}" MATCHES "registry") OR (NOT EXISTS "${_path}")) + # Path invalid - do not add + return() + endif() + + get_filename_component(_path "${_path}" ABSOLUTE) + + list(FIND _win_sdk_preferred_sdk_dirs "${_path}" _win_sdk_idx) + if(_win_sdk_idx GREATER -1) + # Path already in list - do not add + return() + endif() + _winsdk_announce( " - Found \"preferred\" SDK ${_info} @ ${_path}") + # Not yet in the list, so we'll add it + list(APPEND _win_sdk_preferred_sdk_dirs "${_path}") + set(_win_sdk_preferred_sdk_dirs "${_win_sdk_dirs}" CACHE INTERNAL "" FORCE) + + # Just in case we somehow missed it: + _winsdk_conditional_append("${_info}" "" "${_path}") +endfunction() + +# Given a version like v7.0A, looks for an SDK in the registry under "Microsoft SDKs". +# If the given version might be in both HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows +# and HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots aka "Windows Kits", +# use this macro first, since these registry keys usually have more information. +# +# Pass a "default" build number as an extra argument in case we can't find it. +function(_winsdk_check_microsoft_sdks_registry _winsdkver) + set(SDKKEY "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\${_winsdkver}") + get_filename_component(_sdkdir + "[${SDKKEY};InstallationFolder]" + ABSOLUTE) + + set(_sdkname "Windows SDK ${_winsdkver}") + + # Default build number passed as extra argument + set(_build ${ARGN}) + # See if the registry holds a Microsoft-mutilated, err, designated, product name + # (just using get_filename_component to execute the registry lookup) + get_filename_component(_sdkproductname + "[${SDKKEY};ProductName]" + NAME) + if(NOT "${_sdkproductname}" MATCHES "registry") + # Got a product name + set(_sdkname "${_sdkname} (${_sdkproductname})") + endif() + + # try for a version to augment our name + # (just using get_filename_component to execute the registry lookup) + get_filename_component(_sdkver + "[${SDKKEY};ProductVersion]" + NAME) + if(NOT "${_sdkver}" MATCHES "registry" AND NOT MATCHES) + # Got a version + if(NOT "${_sdkver}" MATCHES "\\.\\.") + # and it's not an invalid one with two dots in it: + # use to override the default build + set(_build ${_sdkver}) + if(NOT "${_sdkname}" MATCHES "${_sdkver}") + # Got a version that's not already in the name, let's use it to improve our name. + set(_sdkname "${_sdkname} (${_sdkver})") + endif() + endif() + endif() + _winsdk_conditional_append("${_sdkname}" "${_build}" "${_sdkdir}") +endfunction() + +# Given a name for identification purposes, the build number, and a key (technically a "value name") +# corresponding to a Windows SDK packaged as a "Windows Kit", look for it +# in HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots +# Note that the key or "value name" tends to be something weird like KitsRoot81 - +# no easy way to predict, just have to observe them in the wild. +# Doesn't hurt to also try _winsdk_check_microsoft_sdks_registry for these: +# sometimes you get keys in both parts of the registry (in the wow64 portion especially), +# and the non-"Windows Kits" location is often more descriptive. +function(_winsdk_check_windows_kits_registry _winkit_name _winkit_build _winkit_key) + get_filename_component(_sdkdir + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;${_winkit_key}]" + ABSOLUTE) + _winsdk_conditional_append("${_winkit_name}" "${_winkit_build}" "${_sdkdir}") +endfunction() + +# Given a name for identification purposes and the build number +# corresponding to a Windows 10 SDK packaged as a "Windows Kit", look for it +# in HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots +# Doesn't hurt to also try _winsdk_check_microsoft_sdks_registry for these: +# sometimes you get keys in both parts of the registry (in the wow64 portion especially), +# and the non-"Windows Kits" location is often more descriptive. +function(_winsdk_check_win10_kits _winkit_build) + get_filename_component(_sdkdir + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" + ABSOLUTE) + if(("${_sdkdir}" MATCHES "registry") OR (NOT EXISTS "${_sdkdir}")) + return() # not found + endif() + if(EXISTS "${_sdkdir}/Include/${_winkit_build}/um") + _winsdk_conditional_append("Windows Kits 10 (Build ${_winkit_build})" "${_winkit_build}" "${_sdkdir}") + endif() +endfunction() + +# Given a name for indentification purposes, the build number, and the associated package GUID, +# look in the registry under both HKLM and HKCU in \\SOFTWARE\\Microsoft\\MicrosoftSDK\\InstalledSDKs\\ +# for that guid and the SDK it points to. +function(_winsdk_check_platformsdk_registry _platformsdkname _build _platformsdkguid) + foreach(_winsdk_hive HKEY_LOCAL_MACHINE HKEY_CURRENT_USER) + get_filename_component(_sdkdir + "[${_winsdk_hive}\\SOFTWARE\\Microsoft\\MicrosoftSDK\\InstalledSDKs\\${_platformsdkguid};Install Dir]" + ABSOLUTE) + _winsdk_conditional_append("${_platformsdkname} (${_build})" "${_build}" "${_sdkdir}") + endforeach() +endfunction() + +### +# Detect toolchain information: to know whether it's OK to use Vista+ only SDKs +### +set(_winsdk_vistaonly_ok OFF) +if(MSVC AND NOT _WINDOWSSDK_IGNOREMSVC) + # VC 10 and older has broad target support + if(MSVC_VERSION LESS 1700) + # VC 11 by default targets Vista and later only, so we can add a few more SDKs that (might?) only work on vista+ + elseif("${CMAKE_VS_PLATFORM_TOOLSET}" MATCHES "_xp") + # This is the XP-compatible v110+ toolset + elseif("${CMAKE_VS_PLATFORM_TOOLSET}" STREQUAL "v100" OR "${CMAKE_VS_PLATFORM_TOOLSET}" STREQUAL "v90") + # This is the VS2010/VS2008 toolset + else() + # OK, we're VC11 or newer and not using a backlevel or XP-compatible toolset. + # These versions have no XP (and possibly Vista pre-SP1) support + set(_winsdk_vistaonly_ok ON) + if(_WINDOWSSDK_ANNOUNCE AND NOT _WINDOWSSDK_VISTAONLY_PESTERED) + set(_WINDOWSSDK_VISTAONLY_PESTERED ON CACHE INTERNAL "" FORCE) + 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() + endif() +endif() +if(_WINDOWSSDK_IGNOREMSVC) + set(_winsdk_vistaonly_ok ON) +endif() + +### +# MSVC version checks - keeps messy conditionals in one place +# (messy because of _WINDOWSSDK_IGNOREMSVC) +### +set(_winsdk_msvc_greater_1200 OFF) +if(_WINDOWSSDK_IGNOREMSVC OR (MSVC AND (MSVC_VERSION GREATER 1200))) + set(_winsdk_msvc_greater_1200 ON) +endif() +# Newer than VS .NET/VS Toolkit 2003 +set(_winsdk_msvc_greater_1310 OFF) +if(_WINDOWSSDK_IGNOREMSVC OR (MSVC AND (MSVC_VERSION GREATER 1310))) + set(_winsdk_msvc_greater_1310 ON) +endif() + +# VS2005/2008 +set(_winsdk_msvc_less_1600 OFF) +if(_WINDOWSSDK_IGNOREMSVC OR (MSVC AND (MSVC_VERSION LESS 1600))) + set(_winsdk_msvc_less_1600 ON) +endif() + +# VS2013+ +set(_winsdk_msvc_not_less_1800 OFF) +if(_WINDOWSSDK_IGNOREMSVC OR (MSVC AND (NOT MSVC_VERSION LESS 1800))) + set(_winsdk_msvc_not_less_1800 ON) +endif() + +### +# START body of find module +### +if(_winsdk_msvc_greater_1310) # Newer than VS .NET/VS Toolkit 2003 + ### + # Look for "preferred" SDKs + ### # 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}") + _winsdk_conditional_append_preferred("WindowsSDKDir environment variable" "$ENV{WindowsSDKDir}") endif() - if(MSVC_VERSION LESS 1600) + if(_winsdk_msvc_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() + _winsdk_conditional_append_preferred("Per-user current Windows SDK" "${_sdkdir}") # 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() + _winsdk_conditional_append_preferred("System-wide current Windows SDK" "${_sdkdir}") endif() - foreach(_winsdkver v8.0A v7.1 v7.0A v6.1 v6.0A 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() + ### + # Begin the massive list of SDK searching! + ### + if(_winsdk_vistaonly_ok AND _winsdk_msvc_not_less_1800) + # These require at least Visual Studio 2013 (VC12) + + _winsdk_check_microsoft_sdks_registry(v10.0A) + + # Windows Software Development Kit (SDK) for Windows 10 + # Several different versions living in the same directory - if nothing else we can assume RTM (10240) + _winsdk_check_microsoft_sdks_registry(v10.0 10.0.10240.0) + foreach(_win10build ${_winsdk_win10vers}) + _winsdk_check_win10_kits(${_win10build}) + endforeach() + endif() # vista-only and 2013+ + + # Included in Visual Studio 2013 + # Includes the v120_xp toolset + _winsdk_check_microsoft_sdks_registry(v8.1A 8.1.51636) + + if(_winsdk_vistaonly_ok AND _winsdk_msvc_not_less_1800) + # Windows Software Development Kit (SDK) for Windows 8.1 + # http://msdn.microsoft.com/en-gb/windows/desktop/bg162891 + _winsdk_check_microsoft_sdks_registry(v8.1 8.1.25984.0) + _winsdk_check_windows_kits_registry("Windows Kits 8.1" 8.1.25984.0 KitsRoot81) + endif() # vista-only and 2013+ + + if(_winsdk_vistaonly_ok) + # Included in Visual Studio 2012 + _winsdk_check_microsoft_sdks_registry(v8.0A 8.0.50727) + + # 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 + _winsdk_check_microsoft_sdks_registry(v8.0 6.2.9200.16384) + _winsdk_check_windows_kits_registry("Windows Kits 8.0" 6.2.9200.16384 KitsRoot) + endif() # vista-only + + # Included with VS 2012 Update 1 or later + # Introduces v110_xp toolset + _winsdk_check_microsoft_sdks_registry(v7.1A 7.1.51106) + if(_winsdk_vistaonly_ok) + # Microsoft Windows SDK for Windows 7 and .NET Framework 4 + # http://www.microsoft.com/downloads/en/details.aspx?FamilyID=6b6c21d2-2006-4afa-9702-529fa782d63b + _winsdk_check_microsoft_sdks_registry(v7.1 7.1.7600.0.30514) + endif() # vista-only + + # Included with VS 2010 + _winsdk_check_microsoft_sdks_registry(v7.0A 6.1.7600.16385) + + # 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 + _winsdk_check_microsoft_sdks_registry(v7.0 6.1.7600.16385) + + # 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 + _winsdk_check_microsoft_sdks_registry(v6.1 6.1.6000.16384.10) + + # Included in VS 2008 + _winsdk_check_microsoft_sdks_registry(v6.0A 6.1.6723.1) + + # 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 + _winsdk_check_microsoft_sdks_registry(v6.0 6.0.6000.16384) +endif() + +# Let's not forget the Platform SDKs, which sometimes are useful! +if(_winsdk_msvc_greater_1200) + _winsdk_check_platformsdk_registry("Microsoft Platform SDK for Windows Server 2003 R2" "5.2.3790.2075.51" "D2FF9F89-8AA2-4373-8A31-C838BF4DBBE1") + _winsdk_check_platformsdk_registry("Microsoft Platform SDK for Windows Server 2003 SP1" "5.2.3790.1830.15" "8F9E5EF3-A9A5-491B-A889-C58EFFECE8B3") 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) +### +# Finally, look for "preferred" SDKs +### +if(_winsdk_msvc_greater_1310) # Newer than VS .NET/VS Toolkit 2003 + + + # Environment variable for SDK dir + if(EXISTS "$ENV{WindowsSDKDir}" AND (NOT "$ENV{WindowsSDKDir}" STREQUAL "")) + _winsdk_conditional_append_preferred("WindowsSDKDir environment variable" "$ENV{WindowsSDKDir}") + endif() + + if(_winsdk_msvc_less_1600) + # Per-user current Windows SDK for VS2005/2008 get_filename_component(_sdkdir - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MicrosoftSDK\\InstalledSDKs\\${_platformsdkguid};Install Dir]" + "[HKEY_CURRENT_USER\\Software\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" ABSOLUTE) - if(EXISTS "${_sdkdir}") - list(APPEND _win_sdk_dirs "${_sdkdir}") - list(APPEND _win_sdk_versanddirs "${_platformsdkname}" "${_sdkdir}") - endif() + _winsdk_conditional_append_preferred("Per-user current Windows SDK" "${_sdkdir}") + # System-wide current Windows SDK for VS2005/2008 get_filename_component(_sdkdir - "[HKEY_CURRENT_USER\\Software\\Microsoft\\MicrosoftSDK\\InstalledSDKs\\${_platformsdkguid};Install Dir]" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" ABSOLUTE) - if(EXISTS "${_sdkdir}") - list(APPEND _win_sdk_dirs "${_sdkdir}") - list(APPEND _win_sdk_versanddirs "${_platformsdkname}" "${_sdkdir}") - endif() - endforeach() + _winsdk_conditional_append_preferred("System-wide current Windows SDK" "${_sdkdir}") + endif() 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) + math(EXPR _idx "${_diridx} - 1") + if(${_idx} GREATER -1) + list(GET _win_sdk_versanddirs ${_idx} _ret) + else() + set(_ret "NOTFOUND") + endif() + set(${_outvar} "${_ret}" PARENT_SCOPE) +endfunction() + +function(windowssdk_build_lookup _dir _outvar) + list(FIND _win_sdk_buildsanddirs "${_dir}" _diridx) + math(EXPR _idx "${_diridx} - 1") + if(${_idx} GREATER -1) + list(GET _win_sdk_buildsanddirs ${_idx} _ret) else() - set(_sdkname "NOTFOUND") + set(_ret "NOTFOUND") endif() - set(${_outvar} "${_sdkname}" PARENT_SCOPE) + set(${_outvar} "${_ret}" PARENT_SCOPE) endfunction() +# If we found something... 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}) + + # Fallback, in case no preference found. + 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() -if(_preferred_sdk_dirs) - list(GET _preferred_sdk_dirs 0 WINDOWSSDK_PREFERRED_DIR) - windowssdk_name_lookup("${WINDOWSSDK_LATEST_DIR}" + +# If we found indications of a user preference... +if(_win_sdk_preferred_sdk_dirs) + list(GET _win_sdk_preferred_sdk_dirs 0 WINDOWSSDK_PREFERRED_DIR) + windowssdk_name_lookup("${WINDOWSSDK_PREFERRED_DIR}" WINDOWSSDK_PREFERRED_NAME) set(WINDOWSSDK_PREFERRED_FIRST_DIRS - ${_preferred_sdk_dirs} + ${_win_sdk_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) @@ -146,18 +472,158 @@ find_package_handle_standard_args(WindowsSDK 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() + # Internal: Architecture-appropriate library directory names. + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "ARM") + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + # Only supported in Win10 SDK and up. + set(_winsdk_arch8 arm64) # what the WDK for Win8+ calls this architecture + else() + 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 + endif() + 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(_dirs) + set(_suffixes + "lib${_winsdk_archbare}" # SDKs like 7.1A + "lib/${_winsdk_arch}" # just because some SDKs have x86 dir and root dir + "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}" + "lib/wlh/um/${_winsdk_arch8}" # Win Vista ("Long Horn") min requirement + "lib/win7/${_winsdk_arch}" + "lib/win7/um/${_winsdk_arch8}" # Win 7 min requirement + ) + foreach(_ver + wlh # Win Vista ("Long Horn") min requirement + win7 # Win 7 min requirement + win8 # Win 8 min requirement + winv6.3 # Win 8.1 min requirement + ) + + list(APPEND _suffixes + "lib/${_ver}/${_winsdk_arch}" + "lib/${_ver}/um/${_winsdk_arch8}" + "lib/${_ver}/km/${_winsdk_arch8}" + ) + endforeach() + + # Look for WDF libraries in Win10+ SDK + foreach(_mode umdf kmdf) + file(GLOB _wdfdirs RELATIVE "${_winsdk_dir}" "${_winsdk_dir}/lib/wdf/${_mode}/${_winsdk_arch8}/*") + if(_wdfdirs) + list(APPEND _suffixes ${_wdfdirs}) + endif() + endforeach() + + # Look in each Win10+ SDK version for the components + foreach(_win10ver ${_winsdk_win10vers}) + foreach(_component um km ucrt mmos) + list(APPEND _suffixes "lib/${_win10ver}/${_component}/${_winsdk_arch8}") + endforeach() + endforeach() + + foreach(_suffix ${_suffixes}) + # Check to see if a library actually exists here. + file(GLOB _libs "${_winsdk_dir}/${_suffix}/*.lib") + if(_libs) + list(APPEND _dirs "${_winsdk_dir}/${_suffix}") + endif() + endforeach() + if("${_dirs}" STREQUAL "") + set(_dirs NOTFOUND) + else() + list(REMOVE_DUPLICATES _dirs) + endif() + set(${_var} ${_dirs} PARENT_SCOPE) + endfunction() + function(get_windowssdk_include_dirs _winsdk_dir _var) + set(_dirs) + + set(_subdirs shared um winrt km wdf mmos ucrt) + set(_suffixes Include) + + foreach(_dir ${_subdirs}) + list(APPEND _suffixes "Include/${_dir}") + endforeach() + + foreach(_ver ${_winsdk_win10vers}) + foreach(_dir ${_subdirs}) + list(APPEND _suffixes "Include/${_ver}/${_dir}") + endforeach() + endforeach() + + foreach(_suffix ${_suffixes}) + # Check to see if a header file actually exists here. + file(GLOB _headers "${_winsdk_dir}/${_suffix}/*.h") + if(_headers) + list(APPEND _dirs "${_winsdk_dir}/${_suffix}") + endif() + endforeach() + if("${_dirs}" STREQUAL "") + set(_dirs NOTFOUND) + else() + list(REMOVE_DUPLICATES _dirs) + endif() + set(${_var} ${_dirs} PARENT_SCOPE) + endfunction() + function(get_windowssdk_library_dirs_multiple _var) + set(_dirs) + foreach(_sdkdir ${ARGN}) + get_windowssdk_library_dirs("${_sdkdir}" _current_sdk_libdirs) + if(_current_sdk_libdirs) + list(APPEND _dirs ${_current_sdk_libdirs}) + endif() + endforeach() + if("${_dirs}" STREQUAL "") + set(_dirs NOTFOUND) + else() + list(REMOVE_DUPLICATES _dirs) + endif() + set(${_var} ${_dirs} PARENT_SCOPE) + endfunction() + function(get_windowssdk_include_dirs_multiple _var) + set(_dirs) + foreach(_sdkdir ${ARGN}) + get_windowssdk_include_dirs("${_sdkdir}" _current_sdk_incdirs) + if(_current_sdk_libdirs) + list(APPEND _dirs ${_current_sdk_incdirs}) + endif() + endforeach() + if("${_dirs}" STREQUAL "") + set(_dirs NOTFOUND) + else() + list(REMOVE_DUPLICATES _dirs) + endif() + set(${_var} ${_dirs} PARENT_SCOPE) + endfunction() endif() diff --git a/FindXrandr.cmake b/FindXrandr.cmake new file mode 100644 index 0000000..965c42d --- /dev/null +++ b/FindXrandr.cmake @@ -0,0 +1,78 @@ +# - try to find the Xrandr library +# +# Cache Variables: (probably not for direct use in your scripts) +# XRANDR_INCLUDE_DIR +# XRANDR_SOURCE_DIR +# XRANDR_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# XRANDR_FOUND +# XRANDR_INCLUDE_DIRS +# XRANDR_LIBRARIES +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2014 Kevin M. Godby +# +# 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(XRANDR_ROOT_DIR + "${XRANDR_ROOT_DIR}" + CACHE + PATH + "Directory to search for Xrandr") + +find_package(PkgConfig QUIET) +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_LIBXRANDR xrandr) +endif() + +find_library(XRANDR_LIBRARY + NAMES + Xrandr + PATHS + ${PC_LIBXRANDR_LIBRARY_DIRS} + ${PC_LIBXRANDR_LIBDIR} + HINTS + "${XRANDR_ROOT_DIR}" + PATH_SUFFIXES + lib + ) + +get_filename_component(_libdir "${XRANDR_LIBRARY}" PATH) + +find_path(XRANDR_INCLUDE_DIR + NAMES + Xrandr.h + PATHS + ${PC_LIBXRANDR_INCLUDE_DIRS} + ${PC_LIBXRANDR_INCLUDEDIR} + HINTS + "${_libdir}" + "${_libdir}/.." + "${XRANDR_ROOT_DIR}" + PATH_SUFFIXES + X11 + X11/extensions + ) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(XRANDR + DEFAULT_MSG + XRANDR_LIBRARY + XRANDR_INCLUDE_DIR + ) + +if(XRANDR_FOUND) + list(APPEND XRANDR_LIBRARIES ${XRANDR_LIBRARY}) + list(APPEND XRANDR_INCLUDE_DIRS ${XRANDR_INCLUDE_DIR}) + mark_as_advanced(XRANDR_ROOT_DIR) +endif() + +mark_as_advanced(XRANDR_INCLUDE_DIR + XRANDR_LIBRARY) + diff --git a/Findcppcheck.cmake b/Findcppcheck.cmake index 518d33b..3f13a6b 100644 --- a/Findcppcheck.cmake +++ b/Findcppcheck.cmake @@ -5,6 +5,7 @@ # # Non-cache variables you might use in your CMakeLists.txt: # CPPCHECK_FOUND +# CPPCHECK_VERSION # CPPCHECK_POSSIBLEERROR_ARG # CPPCHECK_UNUSEDFUNC_ARG # CPPCHECK_STYLE_ARG @@ -107,7 +108,7 @@ if(CPPCHECK_EXECUTABLE) if("${CPPCHECK_STYLE_ARG}" STREQUAL "--enable=style") _cppcheck_set_arg_var(CPPCHECK_UNUSEDFUNC_ARG - "--enable=unusedFunctions") + "--enable=unusedFunction") _cppcheck_set_arg_var(CPPCHECK_INFORMATION_ARG "--enable=information") _cppcheck_set_arg_var(CPPCHECK_MISSINGINCLUDE_ARG "--enable=missingInclude") @@ -149,6 +150,11 @@ endif() set(CPPCHECK_ALL "${CPPCHECK_EXECUTABLE} ${CPPCHECK_POSSIBLEERROR_ARG} ${CPPCHECK_UNUSEDFUNC_ARG} ${CPPCHECK_STYLE_ARG} ${CPPCHECK_QUIET_ARG} ${CPPCHECK_INCLUDEPATH_ARG} some/include/path") +execute_process(COMMAND "${CPPCHECK_EXECUTABLE}" --version + OUTPUT_VARIABLE CPPCHECK_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) +string(REGEX REPLACE ".* ([0-9]\\.([0-9]\\.[0-9])?)" "\\1" + CPPCHECK_VERSION "${CPPCHECK_VERSION}") + include(FindPackageHandleStandardArgs) find_package_handle_standard_args(cppcheck DEFAULT_MSG diff --git a/Findquatlib.cmake b/Findquatlib.cmake index 578d6d2..efca27f 100644 --- a/Findquatlib.cmake +++ b/Findquatlib.cmake @@ -40,9 +40,10 @@ else() file(TO_CMAKE_PATH "$ENV{ProgramW6432}" _progfiles) else() set(_libsuffixes lib) - if(NOT "$ENV{ProgramFiles(x86)}" STREQUAL "") + set(_PF86 "ProgramFiles(x86)") + if(NOT "$ENV{${_PF86}}" STREQUAL "") # 32-bit dir: only set on win64 - file(TO_CMAKE_PATH "$ENV{ProgramFiles(x86)}" _progfiles) + file(TO_CMAKE_PATH "$ENV{${_PF86}}" _progfiles) else() # 32-bit dir on win32, useless to us on win64 file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _progfiles) @@ -59,7 +60,9 @@ else() include PATHS "${_progfiles}/VRPN" - "${_progfiles}/quatlib") + "${_progfiles}/quatlib" + C:/usr/local + /usr/local) # Look for the library. find_library(QUATLIB_LIBRARY @@ -72,7 +75,9 @@ else() ${_libsuffixes} PATHS "${_progfiles}/VRPN" - "${_progfiles}/quatlib") + "${_progfiles}/quatlib" + C:/usr/local + /usr/local) endif() # handle the QUIETLY and REQUIRED arguments and set QUATLIB_FOUND to TRUE if diff --git a/Findudev.cmake b/Findudev.cmake new file mode 100644 index 0000000..ce454d5 --- /dev/null +++ b/Findudev.cmake @@ -0,0 +1,77 @@ +# - try to find the udev library +# +# Cache Variables: (probably not for direct use in your scripts) +# UDEV_INCLUDE_DIR +# UDEV_SOURCE_DIR +# UDEV_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# UDEV_FOUND +# UDEV_INCLUDE_DIRS +# UDEV_LIBRARIES +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2014 Kevin M. Godby +# +# 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(UDEV_ROOT_DIR + "${UDEV_ROOT_DIR}" + CACHE + PATH + "Directory to search for udev") + +find_package(PkgConfig QUIET) +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_LIBUDEV libudev) +endif() + +find_library(UDEV_LIBRARY + NAMES + udev + PATHS + ${PC_LIBUDEV_LIBRARY_DIRS} + ${PC_LIBUDEV_LIBDIR} + HINTS + "${UDEV_ROOT_DIR}" + PATH_SUFFIXES + lib + ) + +get_filename_component(_libdir "${UDEV_LIBRARY}" PATH) + +find_path(UDEV_INCLUDE_DIR + NAMES + libudev.h + PATHS + ${PC_LIBUDEV_INCLUDE_DIRS} + ${PC_LIBUDEV_INCLUDEDIR} + HINTS + "${_libdir}" + "${_libdir}/.." + "${UDEV_ROOT_DIR}" + PATH_SUFFIXES + include + ) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(UDEV + DEFAULT_MSG + UDEV_LIBRARY + UDEV_INCLUDE_DIR + ) + +if(UDEV_FOUND) + list(APPEND UDEV_LIBRARIES ${UDEV_LIBRARY}) + list(APPEND UDEV_INCLUDE_DIRS ${UDEV_INCLUDE_DIR}) + mark_as_advanced(UDEV_ROOT_DIR) +endif() + +mark_as_advanced(UDEV_INCLUDE_DIR + UDEV_LIBRARY) + diff --git a/GenerateCompatibilityVersionFile.cmake b/GenerateCompatibilityVersionFile.cmake new file mode 100644 index 0000000..7ac28ed --- /dev/null +++ b/GenerateCompatibilityVersionFile.cmake @@ -0,0 +1,83 @@ +#.rst: +# .. command:: generate_compatibility_version_file +# +# Create a version file for a project:: +# +# generate_compatibility_version_file( +# [VERSION ] +# COMPATIBILITY +# [C_ABI] +# [CXX_LAYOUT] +# [CXX_ABI]) + +#============================================================================= +# Copyright 2015 Sensics, Inc. +# Copyright 2012 Alexander Neundorf +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + + +include(CMakeParseArguments) +include(CMakePackageConfigHelpers) + +set(GCVF_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL "" FORCE) + +function(generate_compatibility_version_file _filename) + + set(options C_ABI CXX_LAYOUT CXX_ABI) + set(oneValueArgs VERSION COMPATIBILITY ) + set(multiValueArgs ) + cmake_parse_arguments(GCVF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(GCVF_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unknown keywords given to generate_compatibility_version_file(): ${GCVF_UNPARSED_ARGUMENTS}") + endif() + set(versionTemplateFile "${CMAKE_ROOT}/Modules/BasicConfigVersion-${GCVF_COMPATIBILITY}.cmake.in") + if(NOT EXISTS "${versionTemplateFile}") + message(FATAL_ERROR "Bad COMPATIBILITY value used for generate_compatibility_version_file(): \"${GCVF_COMPATIBILITY}\"") + endif() + + if(GCVF_CXX_ABI) + set(GCVF_CXX_LAYOUT TRUE) + endif() + if(GCVF_CXX_LAYOUT) + set(GCVF_C_ABI TRUE) + endif() + + if("${GCVF_VERSION}" STREQUAL "") + if("${PROJECT_VERSION}" STREQUAL "") + message(FATAL_ERROR "No VERSION specified for generate_compatibility_version_file()") + else() + set(GCVF_VERSION ${PROJECT_VERSION}) + endif() + endif() + + set(GCVF_WIN_CXXLAYOUT) + if(MSVC) + set(GCVF_WIN_CXXLAYOUT "MSVC") + elseif(MINGW) + set(GCVF_WIN_CXXLAYOUT "MinGW") + elseif(WIN32) + set(GCVF_WIN_CXXLAYOUT "other") + endif() + + set(PREV_FILE "${_filename}.cmakeversion") + write_basic_package_version_file("${PREV_FILE}" VERSION ${GCVF_VERSION} COMPATIBILITY ${GCVF_COMPATIBILITY}) + set(GCVF_BASIC TRUE) + foreach(level BASIC C_ABI CXX_LAYOUT CXX_ABI) + if(GCVF_${level}) + file(READ "${PREV_FILE}" GCVF_PREVIOUS_FILE) + set(PREV_FILE "${_filename}.${level}") + configure_file("${GCVF_DIR}/CompatibilityVersionFile-${level}.cmake.in" "${PREV_FILE}" @ONLY) + endif() + endforeach() + configure_file("${PREV_FILE}" "${_filename}" COPYONLY) +endfunction() \ No newline at end of file diff --git a/GetCPUDetails.cmake b/GetCPUDetails.cmake index 9aa5ef1..b29013c 100644 --- a/GetCPUDetails.cmake +++ b/GetCPUDetails.cmake @@ -1,5 +1,6 @@ # - Set a number of variables to indicate things about the current CPU and OS # +# CPU_COUNT # CPU_INTEL # CPU_EXE_64BIT # CPU_EXE_32BIT @@ -36,6 +37,31 @@ function(get_cpu_details) NO) mark_as_advanced(CPUDETAILS_VERBOSE) + ### See http://www.kitware.com/blog/home/post/63 + if(NOT DEFINED CPU_COUNT) + # Unknown: + set(CPU_COUNT 1) + # Linux: + set(cpuinfo_file "/proc/cpuinfo") + if(EXISTS "${cpuinfo_file}") + file(STRINGS "${cpuinfo_file}" procs REGEX "^processor.: [0-9]+$") + list(LENGTH procs CPU_COUNT) + endif() + # Mac: + if(APPLE) + find_program(cmd_sys_pro "system_profiler") + if(cmd_sys_pro) + execute_process(COMMAND ${cmd_sys_pro} OUTPUT_VARIABLE info) + string(REGEX REPLACE "^.*Total Number Of Cores: ([0-9]+).*$" "\\1" + CPU_COUNT "${info}") + endif() + endif() + # Windows: + if(WIN32) + set(CPU_COUNT "$ENV{NUMBER_OF_PROCESSORS}") + endif() + endif() + ### # CPU_INTEL @@ -144,6 +170,7 @@ function(get_cpu_details) "Intel x86 or x86_64 architecture machine?") foreach(_var + CPU_COUNT CPU_EXE_64BIT CPU_EXE_32BIT CPU_HAS_SSE @@ -157,6 +184,7 @@ function(get_cpu_details) if(CPUDETAILS_VERBOSE) foreach(_var + CPU_COUNT CPU_INTEL CPU_EXE_64BIT CPU_EXE_32BIT diff --git a/GetDefineString.cmake b/GetDefineString.cmake new file mode 100644 index 0000000..832fea8 --- /dev/null +++ b/GetDefineString.cmake @@ -0,0 +1,58 @@ +# - 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 [INCLUDES ] RESULT +# [FLAGS ] +# [INCLUDE_DIRS ] +# [DEFINES] <-Ddefinitions>) +# Original Author: +# 2014 Ryan Pavlik +# +# 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 diff --git a/GetDefineString.cpp.in b/GetDefineString.cpp.in new file mode 100644 index 0000000..99cbbbc --- /dev/null +++ b/GetDefineString.cpp.in @@ -0,0 +1,10 @@ +@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 diff --git a/GetGitRevisionDescription.cmake b/GetGitRevisionDescription.cmake index 1bf0230..8ab03bc 100644 --- a/GetGitRevisionDescription.cmake +++ b/GetGitRevisionDescription.cmake @@ -18,6 +18,12 @@ # and adjusting the output so that it tests false if there was no exact # matching tag. # +# git_local_changes() +# +# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes. +# Uses the return code of "git diff-index --quiet HEAD --". +# Does not regard untracked files. +# # Requires CMake 2.6 or newer (uses the 'function' command) # # Original Author: @@ -40,7 +46,7 @@ set(__get_git_revision_description YES) get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH) function(get_git_head_revision _refspecvar _hashvar) - set(GIT_PARENT_DIR "${CMAKE_SOURCE_DIR}") + 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}") @@ -53,6 +59,13 @@ function(get_git_head_revision _refspecvar _hashvar) 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}") @@ -103,7 +116,7 @@ function(git_describe _var) ${hash} ${ARGN} WORKING_DIRECTORY - "${CMAKE_SOURCE_DIR}" + "${CMAKE_CURRENT_SOURCE_DIR}" RESULT_VARIABLE res OUTPUT_VARIABLE @@ -121,3 +134,35 @@ function(git_get_exact_tag _var) git_describe(out --exact-match ${ARGN}) set(${_var} "${out}" PARENT_SCOPE) endfunction() + +function(git_local_changes _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() + + execute_process(COMMAND + "${GIT_EXECUTABLE}" + diff-index --quiet HEAD -- + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}" + RESULT_VARIABLE + res + OUTPUT_VARIABLE + out + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(res EQUAL 0) + set(${_var} "CLEAN" PARENT_SCOPE) + else() + set(${_var} "DIRTY" PARENT_SCOPE) + endif() +endfunction() diff --git a/GetGitRevisionDescription.cmake.in b/GetGitRevisionDescription.cmake.in index 888ce13..6d8b708 100644 --- a/GetGitRevisionDescription.cmake.in +++ b/GetGitRevisionDescription.cmake.in @@ -1,4 +1,4 @@ -# +# # Internal file for GetGitRevisionDescription.cmake # # Requires CMake 2.6 or newer (uses the 'function' command) @@ -23,9 +23,12 @@ if(HEAD_CONTENTS MATCHES "ref") 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}") + else() + configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY) + file(READ "@GIT_DATA@/packed-refs" PACKED_REFS) + if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}") + set(HEAD_HASH "${CMAKE_MATCH_1}") + endif() endif() else() # detached HEAD diff --git a/GetMSVCVersion.cmake b/GetMSVCVersion.cmake new file mode 100644 index 0000000..48d7b7c --- /dev/null +++ b/GetMSVCVersion.cmake @@ -0,0 +1,127 @@ +#.rst: +# GetMSVCVersion +# -------------- +# +# +# +# get_msvc_major_version() +# get_msvc_minor_version() +# get_msvc_combined_major_minor_version() +# get_msvc_major_minor_version( ) +# get_msvc_unique_decimal_version() +# +# This family of functions is designed to be used to convert +# MSVC_VERSION from the compiler version number to the Visual Studio +# decimal version number (2012 is 11.0, 2015 is 14.0). All take a name +# of a variable in to return their results in. +# +# Consider Visual Studio 2013, which reports 1800 in MSVC_VERSION (and +# the _MSC_VER preprocessor macro). It is also known as VS 12 or 12.0. +# (Minor versions are rarely used, except in the case of 7.1 aka +# VS.NET 2003) The functions would return this output for 2013: +# +# get_msvc_major_version: 12 +# get_msvc_minor_version: 0 +# get_msvc_combined_major_minor_version: 120 +# get_msvc_major_minor_version: 12 in , 0 in +# get_msvc_unique_decimal_version: 12 (this returns with a decimal and +# minor when needed to be precise, e.g. 7.1) +# +# The variable is not modified if not building with MSVC. + +#============================================================================= +# Copyright 2015 Ryan Pavlik +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# 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. +#============================================================================= + +# This function serves as the main implementation, with the others just +# tweaking the result. +function(get_msvc_combined_major_minor_version _var) + if(NOT MSVC) + return() + endif() + math(EXPR _vs_ver "${MSVC_VERSION} / 10 - 60") + + # VS 2015 changed the pattern because they skipped VS 13 + if(_vs_ver GREATER 120) + math(EXPR _vs_ver "${_vs_ver} + 10") + endif() + set(${_var} ${_vs_ver} PARENT_SCOPE) +endfunction() + +# This function is also used as backend to some implementation, though +# its contents are simpler, no real business logic to speak of. +function(get_msvc_major_minor_version _major_var _minor_var) + if(NOT MSVC) + return() + endif() + get_msvc_combined_major_minor_version(_vs_ver) + + math(EXPR _vs_minor "${_vs_ver} % 10") + math(EXPR _vs_major "(${_vs_ver} - ${_vs_minor}) / 10") + set(${_major_var} ${_vs_major} PARENT_SCOPE) + set(${_minor_var} ${_vs_minor} PARENT_SCOPE) +endfunction() + +function(get_msvc_major_version _var) + if(NOT MSVC) + return() + endif() + get_msvc_major_minor_version(_vs_ver _dummy) + set(${_var} ${_vs_ver} PARENT_SCOPE) +endfunction() + +function(get_msvc_minor_version _var) + if(NOT MSVC) + return() + endif() + get_msvc_major_minor_version(_dummy _vs_ver) + set(${_var} ${_vs_ver} PARENT_SCOPE) +endfunction() + +function(get_msvc_unique_decimal_version _var) + if(NOT MSVC) + return() + endif() + get_msvc_major_minor_version(_vs_major _vs_minor) + set(_vs_ver ${_vs_major}) + if(_vs_minor GREATER 0) + set(_vs_ver "${_vs_ver}.${_vs_minor}") + endif() + set(${_var} ${_vs_ver} PARENT_SCOPE) +endfunction() diff --git a/InstallDebugSymbols.cmake b/InstallDebugSymbols.cmake new file mode 100644 index 0000000..25cd6ba --- /dev/null +++ b/InstallDebugSymbols.cmake @@ -0,0 +1,85 @@ +# Defines a function to install the symbols for a target +# +# install_debug_symbols(TARGETS [...] [DESTINATION ] +# [CONFIGURATIONS [...]] [PASSTHRU [...]]) +# +# DESTINATION is only optional if CMAKE_INSTALL_BINDIR and CMAKE_INSTALL_LIBDIR are set, +# then it will use CMAKE_INSTALL_BINDIR for executables (and DLLs) and CMAKE_INSTALL_LIBDIR +# for libraries (static libraries only on DLL platforms). +# +# CONFIGURATIONS are the config names for which symbols (PDB files) are expected - +# the default of RelWithDebInfo Debug is correct unless you've dramatically changed +# the set of configs. +# +# Anything after PASSTHRU is passed directly to the install( command after the arguments +# that the function generates. +# +# Currently a no-op if using CMake pre-3.2 (can't use generator expressions before then +# to get symbol location) or if not using MSVC (MSVC keeps its symbols separate in PDB files +# necessitating this function in the first place). +# +# Original Author: +# 2015, 2017 Ryan Pavlik +# http://ryanpavlik.com +# +# Copyright Sensics, Inc. 2015, 2017. +# 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 CMAKE_VERSION VERSION_LESS 3.2) + include(CMakeParseArguments) + # debug symbols for MSVC: supported on CMake 3.2 and up where there's a + # generator expression for a target's PDB file + function(install_debug_symbols) + set(options) + set(oneValueArgs DESTINATION) + set(multiValueArgs TARGETS CONFIGURATIONS PASSTHRU) + cmake_parse_arguments(INSTALLSYMS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(NOT INSTALLSYMS_DESTINATION AND NOT CMAKE_INSTALL_BINDIR AND NOT CMAKE_INSTALL_LIBDIR) + message(SEND_ERROR "install_debug_symbols call missing required DESTINATION argument") + return() + endif() + if(NOT INSTALLSYMS_TARGETS) + message(SEND_ERROR "install_debug_symbols call missing required TARGETS argument") + return() + endif() + if(NOT INSTALLSYMS_CONFIGURATIONS) + set(INSTALLSYMS_CONFIGURATIONS RelWithDebInfo Debug) + endif() + + # Wrap each config in a generator expression + set(HAS_SYMBOLS_CONDITION) + foreach(_config ${INSTALLSYMS_CONFIGURATIONS}) + list(APPEND HAS_SYMBOLS_CONDITION "$") + endif() + # make list comma separated + string(REPLACE ";" "," HAS_SYMBOLS_CONDITION "${HAS_SYMBOLS_CONDITION}") + # Wrap in an "OR" generator expression + set(HAS_SYMBOLS_CONDITION "$") + + set(EXTRA_INSTALL_ARGS ${INSTALLSYMS_PASSTHRU} ${INSTALLSYMS_UNPARSED_ARGUMENTS}) + if(INSTALLSYMS_DESTINATION) + set(DEST ${INSTALLSYMS_DESTINATION}) + endif() + foreach(_target ${INSTALLSYMS_TARGETS}) + if(NOT INSTALLSYMS_DESTINATION) + get_target_property(_target_type ${_target} TYPE) + if("${_target_type}" STREQUAL "EXECUTABLE" OR "${_target_type}" STREQUAL "SHARED_LIBRARY") + # exe or dll: put it alongside the runtime component + set(DEST ${CMAKE_INSTALL_BINDIR}) + else() + set(DEST ${CMAKE_INSTALL_LIBDIR}) + endif() + endif() + install(FILES $<${HAS_SYMBOLS_CONDITION}:$> + DESTINATION ${DEST} + ${EXTRA_INSTALL_ARGS}) + endforeach() + endfunction() +else() + function(install_debug_symbols) + # do nothing if too old of CMake or not MSVC. + endfunction() +endif() diff --git a/MapImportedReleaseVariants.cmake b/MapImportedReleaseVariants.cmake new file mode 100644 index 0000000..cd4ce93 --- /dev/null +++ b/MapImportedReleaseVariants.cmake @@ -0,0 +1,21 @@ +# Sets CMAKE_MAP_IMPORTED_CONFIG_* so that if there isn't a perfect match between +# the current project's build type and the imported build, but they're both some +# kind of "Release" variant, things will just work. +# +# Original Author: +# 2015 Ryan Pavlik +# http://academic.cleardefinition.com +# +# Copyright Sensics, Inc. 2015. +# 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) + +# RelWithDebInfo falls back to Release, then MinSizeRel +set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO RelWithDebInfo Release MinSizeRel NoConfig) + +# MinSizeRel falls back to Release, then RelWithDebInfo +set(CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL MinSizeRel Release RelWithDebInfo NoConfig) + +# Release falls back to RelWithDebInfo, then MinSizeRel +set(CMAKE_MAP_IMPORTED_CONFIG_RELEASE Release RelWithDebInfo MinSizeRel NoConfig) diff --git a/MinGWSearchPathExtras.cmake b/MinGWSearchPathExtras.cmake new file mode 100644 index 0000000..cd9fe69 --- /dev/null +++ b/MinGWSearchPathExtras.cmake @@ -0,0 +1,94 @@ +# - Additional help finding search paths on MinGW distributions, including MSYS2. +# +# Much of this is really more in the purview of CMake or the packages of CMake for +# those distributions, but if I can centralize/simplify the pain here, it's worth doing. +# +# Variables: (all are internal cache variables) +# MINGWSEARCH_INCLUDE_DIRS - use under PATHS in your find_path() commands +# MINGWSEARCH_LIBRARY_DIRS - use under PATHS in your find_library() commands +# MINGWSEARCH_PREFIXES - suitable for temporary use in CMAKE_FIND_ROOT_PATH or CMAKE_PREFIX_PATH. +# MINGWSEARCH_TARGET_TRIPLE - something like x86_64-w64-mingw32 or i686-w64-mingw32, use as you see fit. +# +# Original Author: +# 2016 Ryan Pavlik +# +# Copyright Sensics, Inc. 2016. +# 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(MINGW AND NOT MINGWSEARCH_COMPLETED) + ### + # Helper function + ### + function(_mingwsearch_conditional_add _var _path) + #message(STATUS "conditional add to ${_var}: ${_path}") + if(("${_path}" MATCHES "registry") OR (NOT IS_DIRECTORY "${_path}")) + # Path invalid - do not add + return() + endif() + list(FIND ${_var} "${_path}" _idx) + if(_idx GREATER -1) + # Path already in list - do not add + return() + endif() + # Not yet in the list, so we'll add it + list(APPEND ${_var} "${_path}") + set(${_var} ${${_var}} PARENT_SCOPE) + endfunction() + + # Clear the working variables. + set(MINGWSEARCH_INCLUDE_DIRS_WORK) + set(MINGWSEARCH_LIBRARY_DIRS_WORK) + set(MINGWSEARCH_PREFIXES_WORK) + set(_mingw_target_triple) + + # Try to find the string like x86_64-w64-mingw32 by parsing the implicit link directories... + # TODO this is a hack that either should be resolved in CMake or in MSYS2's package of CMake. + foreach(_link_dir ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}) + _mingwsearch_conditional_add(MINGWSEARCH_LIBRARY_DIRS_WORK "${_link_dir}") + if("${_link_dir}" MATCHES "/([^/]*-mingw32)/lib") + set(_mingw_target_triple ${CMAKE_MATCH_1}) + get_filename_component(_mingw_internal_basedir "${_link_dir}" PATH) + # Try adding the parallel include dir + if(IS_DIRECTORY "${_mingw_internal_basedir}/include") + _mingwsearch_conditional_add(MINGWSEARCH_INCLUDE_DIRS_WORK "${_mingw_internal_basedir}/include") + _mingwsearch_conditional_add(MINGWSEARCH_PREFIXES_WORK "${_mingw_internal_basedir}") + endif() + if(NOT CMAKE_CROSSCOMPILING) + # Try going up a level, since the directory with the target is usually a sibling to the main prefix. + get_filename_component(_mingw_main_basedir_candidate "${_mingw_internal_basedir}/.." ABSOLUTE) + if(IS_DIRECTORY "${_mingw_main_basedir_candidate}/include" AND NOT ("${_mingw_main_basedir_candidate}" STREQUAL "${_mingw_internal_basedir}")) + # If we could go up a level, add that include dir too. + _mingwsearch_conditional_add(MINGWSEARCH_INCLUDE_DIRS_WORK "${_mingw_main_basedir_candidate}/include") + _mingwsearch_conditional_add(MINGWSEARCH_PREFIXES_WORK "${_mingw_main_basedir_candidate}") + endif() + endif() + endif() + endforeach() + + ### + # Output results. + ### + if(MINGWSEARCH_INCLUDE_DIRS_WORK) + set(MINGWSEARCH_INCLUDE_DIRS "${MINGWSEARCH_INCLUDE_DIRS_WORK}" CACHE INTERNAL "" FORCE) + #message(STATUS "MINGWSEARCH_INCLUDE_DIRS ${MINGWSEARCH_INCLUDE_DIRS}") + endif() + + if(MINGWSEARCH_LIBRARY_DIRS_WORK) + set(MINGWSEARCH_LIBRARY_DIRS "${MINGWSEARCH_LIBRARY_DIRS_WORK}" CACHE INTERNAL "" FORCE) + #message(STATUS "MINGWSEARCH_LIBRARY_DIRS ${MINGWSEARCH_LIBRARY_DIRS}") + endif() + + if(MINGWSEARCH_PREFIXES_WORK) + set(MINGWSEARCH_PREFIXES "${MINGWSEARCH_PREFIXES_WORK}" CACHE INTERNAL "" FORCE) + #message(STATUS "MINGWSEARCH_PREFIXES ${MINGWSEARCH_PREFIXES}") + endif() + + if(_mingw_target_triple) + set(MINGWSEARCH_TARGET_TRIPLE ${_mingw_target_triple} CACHE INTERNAL "" FORCE) + #message(STATUS "MINGWSEARCH_TARGET_TRIPLE ${MINGWSEARCH_TARGET_TRIPLE}") + endif() + + set(MINGWSEARCH_COMPLETED TRUE CACHE INTERNAL "" FORCE) +endif() diff --git a/PlatformDefinitions.cmake b/PlatformDefinitions.cmake new file mode 100644 index 0000000..17f71e6 --- /dev/null +++ b/PlatformDefinitions.cmake @@ -0,0 +1,45 @@ +# Defines a series of preprocessor variables based on the current platform. +# +# Usage: define_platform_macros(PREFIX) +# +# where PREFIX is the macro prefix (i.e., if PREFIX is XYZZY then the macros +# will be named XYZZY_LINUX, XYZZY_WINDOWS, etc.). +# +# Author: +# Kevin M. Godby +# +# 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(_define_platform_macros_impl prefix platform_string variable_name) + if (${CMAKE_SYSTEM_NAME} MATCHES "${platform_string}") + string(TOUPPER "${prefix}_${variable_name}" _varname) + set(${_varname} TRUE PARENT_SCOPE) + endif() +endfunction() + +macro(define_platform_macros _prefix) + _define_platform_macros_impl(${_prefix} "AIX" AIX) + _define_platform_macros_impl(${_prefix} "Android" ANDROID) + _define_platform_macros_impl(${_prefix} "BS/DOS" BSDOS) + _define_platform_macros_impl(${_prefix} "FreeBSD" FREEBSD) + _define_platform_macros_impl(${_prefix} "HP-UX" HPUX) + _define_platform_macros_impl(${_prefix} "IRIX" IRIX) + _define_platform_macros_impl(${_prefix} "Linux" LINUX) + _define_platform_macros_impl(${_prefix} "GNU/kFreeBSD" KFREEBSD) + _define_platform_macros_impl(${_prefix} "NetBSD" NETBSD) + _define_platform_macros_impl(${_prefix} "OpenBSD" OPENBSD) + _define_platform_macros_impl(${_prefix} "OFS1" OFS1) + _define_platform_macros_impl(${_prefix} "SCO_SV" SCO_SV) + _define_platform_macros_impl(${_prefix} "UnixWare" UNIXWARE) + _define_platform_macros_impl(${_prefix} "Xenix" XENIX) + _define_platform_macros_impl(${_prefix} "SunOS" SUNOS) + _define_platform_macros_impl(${_prefix} "Tru64" TRU64) + _define_platform_macros_impl(${_prefix} "ULTRIX" ULTRIX) + _define_platform_macros_impl(${_prefix} "CYGWIN" CYGWIN) + _define_platform_macros_impl(${_prefix} "Darwin" MACOSX) + _define_platform_macros_impl(${_prefix} "Windows" WINDOWS) +endmacro() + diff --git a/ProgramFilesGlob.cmake b/ProgramFilesGlob.cmake index 98eb924..9d7a9cc 100644 --- a/ProgramFilesGlob.cmake +++ b/ProgramFilesGlob.cmake @@ -22,7 +22,7 @@ if(__program_files_glob) endif() set(__program_files_glob YES) -function(program_files_glob var pattern) +macro(_program_files_glob_var_prep) # 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)}. @@ -32,11 +32,15 @@ function(program_files_glob var pattern) 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) + set(_PF86 "ProgramFiles(x86)") + file(TO_CMAKE_PATH "$ENV{${_PF86}}" _PROG_FILES_X86) # 64-bit dir: only set on win64 file(TO_CMAKE_PATH "$ENV{ProgramW6432}" _PROG_FILES_W6432) +endmacro() +function(program_files_glob var pattern) + _program_files_glob_var_prep() if(CMAKE_SIZEOF_VOID_P MATCHES "8") # 64-bit build on win64 set(_PROGFILESDIRS "${_PROG_FILES_W6432}") @@ -56,20 +60,7 @@ function(program_files_glob var pattern) 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) - + _program_files_glob_var_prep() if(CMAKE_SIZEOF_VOID_P MATCHES "8") # 64-bit build on win64 # look in the "32 bit" (c:\program files (x86)\) directory as a diff --git a/README.markdown b/README.markdown index 30f0b2b..81ec9b2 100644 --- a/README.markdown +++ b/README.markdown @@ -1,13 +1,11 @@ -VRAC CMake Modules -================== +Ryan's CMake Modules +==================== -Ryan Pavlik +Ryan A. Pavlik, Ph.D. - + -Iowa State University HCI Graduate Program/VRAC - Introduction ------------ @@ -20,26 +18,35 @@ CMake itself. Each module is generally documented, and depending on how busy I was when I created it, the documentation can be fairly complete. +By now, it also includes contributions both from open-source projects I work on, +as well as friendly strangers on the Internet contributing their modules. I am +very grateful for improvements/fixes/pull requests! + How to Integrate ---------------- -These modules are probably best placed wholesale into a "cmake" subdirectory +These modules are probably best placed wholesale into a `cmake` subdirectory of your project source. -If you use Git, try installing [git-subtree][1], -so you can easily use this repository for subtree merges, updating simply. +If you use Git, try installing [git-subtree][1] (included by default on +Git for Windows and perhaps for your Linux distro, especially post-1.9.1), so +you can easily use this repository for subtree merges, updating simply. For the initial checkout: cd projectdir - git subtree add --squash --prefix=cmake git://github.com/rpavlik/cmake-modules.git master + git subtree add --squash --prefix=cmake https://github.com/rpavlik/cmake-modules.git master For updates: cd projectdir - git subtree pull --squash --prefix=cmake git://github.com/rpavlik/cmake-modules.git master + git subtree pull --squash --prefix=cmake https://github.com/rpavlik/cmake-modules.git master + +If you originally installed this by just copying the files, you'll sadly have +to delete the directory, commit that, then do the `git subtree add`. Annoying, +but I don't know a workaround. If you use some other version control, you can export a copy of this directory without the git metadata by calling: @@ -53,18 +60,19 @@ How to Use ---------- At the minimum, all you have to do is add a line like this near the top -of your root CMakeLists.txt file (but not before your project() call): +of your root CMakeLists.txt file (but not before your `project()` call): - list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") You might also want the extra automatic features/fixes included with the modules, for that, just add another line following the first one: include(UseBackportedModules) -Look at module-help.html/txt (generated by update-help.sh on a unix-like shell) +Look at `module-help.html`/`.txt` (generated by `update-help.sh` on a unix-like shell with a pre-3.0 version of CMake.) either in this directory or online at -for more information on individual modules. +for more information on individual modules. Since it requires an older CMake for generation, +the docs might get out of date, sorry - but you can always look at the files themselves. Licenses @@ -72,7 +80,9 @@ Licenses The modules that I wrote myself are all subject to this license: -> Copyright Iowa State University 2009-2012 +> Copyright Iowa State University 2009-2014, +> or Copyright Sensics, Inc. 2014-2015, +> or Copyright Ryan A. Pavlik 2009-2015 > > Distributed under the Boost Software License, Version 1.0. > @@ -81,7 +91,10 @@ The modules that I wrote myself are all subject to this license: Modules based on those included with CMake are under the OSI-approved BSD license, which is included in each of those modules. A few other modules -are modified from other sources - when in doubt, look at the .cmake. +are modified from other sources - when in doubt, look at the `.cmake`. + +If you'd like to contribute, that would be great! Just make sure to include +the license boilerplate in your module, and send a pull request. Important License Note! ----------------------- @@ -91,6 +104,4 @@ directory, you're in a separate project that is making use of these modules. That separate project can (and probably does) have its own license specifics. - - [1]: http://github.com/apenwarr/git-subtree "Git Subtree master" diff --git a/StashMapConfig.cmake b/StashMapConfig.cmake new file mode 100644 index 0000000..d052028 --- /dev/null +++ b/StashMapConfig.cmake @@ -0,0 +1,86 @@ +# Manipulate CMAKE_MAP_IMPORTED_CONFIG_ cautiously and reversibly. +# +# In all usage docs, is a configuration name in all caps (RELEASE, DEBUG, +# RELWITHDEBINFO, MINSIZEREL, and NONE are the ones made by default - NONE is how +# targets are exported from single-config generators where CMAKE_BUILD_TYPE isn't set.) +# +# stash_map_config( ) and unstash_map_config() +# +# Saves+changes and restores the value (or unset-ness) of CMAKE_MAP_IMPORTED_CONFIG_${config}. +# Re-entrant calls OK - this does actually "push" and "pop" +# +# stash_common_map_config() and unstash_common_map_config() +# +# Calls stash_map_config/unstash_map_config for each configuration with sensible +# defaults based on the platform. +# +# Original Author: +# 2015, 2017 Ryan Pavlik +# http://ryanpavlik.com +# +# Copyright Sensics, Inc. 2015, 2017. +# 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) + +macro(stash_map_config config) + string(TOUPPER "${config}" smc_config) + string(TOUPPER "${ARGN}" smc_new) + # Re-entrancy protection - push an entry onto a list + list(APPEND smc_IN_MAP_CONFIG_STASH_${smc_config} yes) + list(LENGTH smc_IN_MAP_CONFIG_STASH_${smc_config} smc_IN_MAP_CONFIG_STASH_LEN) + + # Actually perform the saving and replacement of CMAKE_MAP_IMPORTED_CONFIG_${config} + set(smc_var smc_OLD_CMAKE_MAP_IMPORTED_CONFIG_${smc_config}_${smc_IN_MAP_CONFIG_STASH_LEN}) + message(STATUS "Stashing to ${smc_var}") + if(DEFINED CMAKE_MAP_IMPORTED_CONFIG_${smc_config}) + set(${smc_var} ${CMAKE_MAP_IMPORTED_CONFIG_${smc_config}}) + else() + unset(${smc_var}) + endif() + set(CMAKE_MAP_IMPORTED_CONFIG_${smc_config} ${smc_new}) +endmacro() + +macro(unstash_map_config config) + string(TOUPPER "${config}" smc_config) + if(NOT DEFINED smc_IN_MAP_CONFIG_STASH_${smc_config}) + # Nobody actually called the matching stash... + return() + endif() + # Get stack size so we know which entries to restore. + list(LENGTH smc_IN_MAP_CONFIG_STASH_${smc_config} smc_IN_MAP_CONFIG_STASH_LEN) + # Other half of re-entrancy protection - pop an entry off a list + list(REMOVE_AT smc_IN_MAP_CONFIG_STASH_${smc_config} -1) + + # Restoration of CMAKE_MAP_IMPORTED_CONFIG_${config} + set(smc_var smc_OLD_CMAKE_MAP_IMPORTED_CONFIG_${smc_config}_${smc_IN_MAP_CONFIG_STASH_LEN}) + if(DEFINED ${smc_var}) + set(CMAKE_MAP_IMPORTED_CONFIG_${smc_config} ${${smc_var}}) + unset(${smc_var}) + else() + unset(CMAKE_MAP_IMPORTED_CONFIG_${smc_config}) + endif() +endmacro() + +macro(stash_common_map_config) + if(MSVC) + # Can't do this - different runtimes, incompatible ABI, etc. + set(smc_DEBUG_FALLBACK) + stash_map_config(DEBUG DEBUG) + else() + set(smc_DEBUG_FALLBACK DEBUG) + stash_map_config(DEBUG DEBUG RELWITHDEBINFO RELEASE MINSIZEREL NONE) + endif() + stash_map_config(RELEASE RELEASE RELWITHDEBINFO MINSIZEREL NONE ${smc_DEBUG_FALLBACK}) + stash_map_config(RELWITHDEBINFO RELWITHDEBINFO RELEASE MINSIZEREL NONE ${smc_DEBUG_FALLBACK}) + stash_map_config(MINSIZEREL MINSIZEREL RELEASE RELWITHDEBINFO NONE ${smc_DEBUG_FALLBACK}) + stash_map_config(NONE NONE RELEASE RELWITHDEBINFO MINSIZEREL ${smc_DEBUG_FALLBACK}) +endmacro() + +macro(unstash_common_map_config) + unstash_map_config(DEBUG) + unstash_map_config(RELEASE) + unstash_map_config(RELWITHDEBINFO) + unstash_map_config(MINSIZEREL) + unstash_map_config(NONE) +endmacro() diff --git a/UseFolders.cmake b/UseFolders.cmake new file mode 100644 index 0000000..4fd5dfb --- /dev/null +++ b/UseFolders.cmake @@ -0,0 +1,34 @@ +# - Contains a function to sensibly and easily enable the "USE_FOLDERS" global property +# without burning people using old MSVC Express Editions. +# +# use_folders([option_name]) - Creates an option (default name if you don't pass +# one: BUILD_WITH_PROJECT_FOLDERS) that controls the USE_FOLDERS global property. +# It has intelligently-set defaults that err on the side of caution (disabling) +# on old MSVC versions, since solutions generated with USE_FOLDERS set to ON +# cannot be used in some older MSVC Express Editions, so it's explicit opt-in there. +# +# Original Author: +# 2015 Ryan Pavlik +# http://academic.cleardefinition.com +# +# Copyright Sensics, Inc. 2015. +# 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(use_folders) + set(_option_name BUILD_WITH_PROJECT_FOLDERS) + if(ARGV0) + set(_option_name ${ARGV0}) + endif() + # Nitpicky TODO: This unnecessarily defaults to project folders off when using + # an older toolset in a newer IDE... + if(MSVC_IDE AND MSVC_VERSION LESS 1600) + # VS 2012 Express and newer has folder support... + option(${_option_name} "Enable project folders in the IDE. May only work in non-Express Editions!" OFF) + else() + option(${_option_name} "Enable project folders in the IDE." ON) + endif() + set_property(GLOBAL PROPERTY + USE_FOLDERS ${${_option_name}}) +endfunction() \ No newline at end of file diff --git a/cmake-2.8.10-modules/CMakePackageConfigHelpers.cmake b/cmake-2.8.10-modules/CMakePackageConfigHelpers.cmake deleted file mode 100644 index 2e5c528..0000000 --- a/cmake-2.8.10-modules/CMakePackageConfigHelpers.cmake +++ /dev/null @@ -1,254 +0,0 @@ -# - CONFIGURE_PACKAGE_CONFIG_FILE(), WRITE_BASIC_PACKAGE_VERSION_FILE() -# -# CONFIGURE_PACKAGE_CONFIG_FILE( INSTALL_DESTINATION -# [PATH_VARS ... ] -# [NO_SET_AND_CHECK_MACRO] -# [NO_CHECK_REQUIRED_COMPONENTS_MACRO]) -# -# CONFIGURE_PACKAGE_CONFIG_FILE() should be used instead of the plain -# configure_file() command when creating the Config.cmake or -config.cmake -# file for installing a project or library. It helps making the resulting package -# relocatable by avoiding hardcoded paths in the installed Config.cmake file. -# -# In a FooConfig.cmake file there may be code like this to make the -# install destinations know to the using project: -# set(FOO_INCLUDE_DIR "@CMAKE_INSTALL_FULL_INCLUDEDIR@" ) -# set(FOO_DATA_DIR "@CMAKE_INSTALL_PREFIX@/@RELATIVE_DATA_INSTALL_DIR@" ) -# set(FOO_ICONS_DIR "@CMAKE_INSTALL_PREFIX@/share/icons" ) -# ...logic to determine installedPrefix from the own location... -# set(FOO_CONFIG_DIR "${installedPrefix}/@CONFIG_INSTALL_DIR@" ) -# All 4 options shown above are not sufficient, since the first 3 hardcode -# the absolute directory locations, and the 4th case works only if the logic -# to determine the installedPrefix is correct, and if CONFIG_INSTALL_DIR contains -# a relative path, which in general cannot be guaranteed. -# This has the effect that the resulting FooConfig.cmake file would work poorly -# under Windows and OSX, where users are used to choose the install location -# of a binary package at install time, independent from how CMAKE_INSTALL_PREFIX -# was set at build/cmake time. -# -# Using CONFIGURE_PACKAGE_CONFIG_FILE() helps. If used correctly, it makes the -# resulting FooConfig.cmake file relocatable. -# Usage: -# 1. write a FooConfig.cmake.in file as you are used to -# 2. insert a line containing only the string "@PACKAGE_INIT@" -# 3. instead of set(FOO_DIR "@SOME_INSTALL_DIR@"), use set(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@") -# (this must be after the @PACKAGE_INIT@ line) -# 4. instead of using the normal configure_file(), use CONFIGURE_PACKAGE_CONFIG_FILE() -# -# The and arguments are the input and output file, the same way -# as in configure_file(). -# -# The given to INSTALL_DESTINATION must be the destination where the FooConfig.cmake -# file will be installed to. This can either be a relative or absolute path, both work. -# -# The variables to given as PATH_VARS are the variables which contain -# install destinations. For each of them the macro will create a helper variable -# PACKAGE_. These helper variables must be used -# in the FooConfig.cmake.in file for setting the installed location. They are calculated -# by CONFIGURE_PACKAGE_CONFIG_FILE() so that they are always relative to the -# installed location of the package. This works both for relative and also for absolute locations. -# For absolute locations it works only if the absolute location is a subdirectory -# of CMAKE_INSTALL_PREFIX. -# -# By default configure_package_config_file() also generates two helper macros, -# set_and_check() and check_required_components() into the FooConfig.cmake file. -# -# set_and_check() should be used instead of the normal set() -# command for setting directories and file locations. Additionally to setting the -# variable it also checks that the referenced file or directory actually exists -# and fails with a FATAL_ERROR otherwise. This makes sure that the created -# FooConfig.cmake file does not contain wrong references. -# When using the NO_SET_AND_CHECK_MACRO, this macro is not generated into the -# FooConfig.cmake file. -# -# check_required_components() should be called at the end of the -# FooConfig.cmake file if the package supports components. -# This macro checks whether all requested, non-optional components have been found, -# and if this is not the case, sets the Foo_FOUND variable to FALSE, so that the package -# is considered to be not found. -# It does that by testing the Foo__FOUND variables for all requested -# required components. -# When using the NO_CHECK_REQUIRED_COMPONENTS option, this macro is not generated -# into the FooConfig.cmake file. -# -# For an example see below the documentation for WRITE_BASIC_PACKAGE_VERSION_FILE(). -# -# -# WRITE_BASIC_PACKAGE_VERSION_FILE( filename VERSION major.minor.patch COMPATIBILITY (AnyNewerVersion|SameMajorVersion|ExactVersion) ) -# -# Writes a file for use as ConfigVersion.cmake file to . -# See the documentation of find_package() for details on this. -# filename is the output filename, it should be in the build tree. -# major.minor.patch is the version number of the project to be installed -# The COMPATIBILITY mode AnyNewerVersion means that the installed package version -# will be considered compatible if it is newer or exactly the same as the requested version. -# This mode should be used for packages which are fully backward compatible, -# also across major versions. -# If SameMajorVersion is used instead, then the behaviour differs from AnyNewerVersion -# in that the major version number must be the same as requested, e.g. version 2.0 will -# not be considered compatible if 1.0 is requested. -# This mode should be used for packages which guarantee backward compatibility within the -# same major version. -# If ExactVersion is used, then the package is only considered compatible if the requested -# version matches exactly its own version number (not considering the tweak version). -# For example, version 1.2.3 of a package is only considered compatible to requested version 1.2.3. -# This mode is for packages without compatibility guarantees. -# If your project has more elaborated version matching rules, you will need to write your -# own custom ConfigVersion.cmake file instead of using this macro. -# -# Internally, this macro executes configure_file() to create the resulting -# version file. Depending on the COMPATIBLITY, either the file -# BasicConfigVersion-SameMajorVersion.cmake.in or BasicConfigVersion-AnyNewerVersion.cmake.in -# is used. Please note that these two files are internal to CMake and you should -# not call configure_file() on them yourself, but they can be used as starting -# point to create more sophisticted custom ConfigVersion.cmake files. -# -# -# Example using both configure_package_config_file() and write_basic_package_version_file(): -# CMakeLists.txt: -# set(INCLUDE_INSTALL_DIR include/ ... CACHE ) -# set(LIB_INSTALL_DIR lib/ ... CACHE ) -# set(SYSCONFIG_INSTALL_DIR etc/foo/ ... CACHE ) -# ... -# include(CMakePackageConfigHelpers) -# configure_package_config_file(FooConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake -# INSTALL_DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake -# PATH_VARS INCLUDE_INSTALL_DIR SYSCONFIG_INSTALL_DIR) -# write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake -# VERSION 1.2.3 -# COMPATIBILITY SameMajorVersion ) -# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake -# DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake ) -# -# With a FooConfig.cmake.in: -# set(FOO_VERSION x.y.z) -# ... -# @PACKAGE_INIT@ -# ... -# set_and_check(FOO_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") -# set_and_check(FOO_SYSCONFIG_DIR "@PACKAGE_SYSCONFIG_INSTALL_DIR@") -# -# check_required_components(Foo) - - -#============================================================================= -# Copyright 2012 Alexander Neundorf -# -# Distributed under the OSI-approved BSD License (the "License"); -# see below. -# -# 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. -#============================================================================= -# -# 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. -#============================================================================= - -include(CMakeParseArguments) - -include(WriteBasicConfigVersionFile) - -macro(WRITE_BASIC_PACKAGE_VERSION_FILE) - write_basic_config_version_file(${ARGN}) -endmacro() - - -function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile) - set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO) - set(oneValueArgs INSTALL_DESTINATION ) - set(multiValueArgs PATH_VARS ) - - cmake_parse_arguments(CCF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - if(CCF_UNPARSED_ARGUMENTS) - message(FATAL_ERROR "Unknown keywords given to CONFIGURE_PACKAGE_CONFIG_FILE(): \"${CCF_UNPARSED_ARGUMENTS}\"") - endif() - - if(NOT CCF_INSTALL_DESTINATION) - message(FATAL_ERROR "No INSTALL_DESTINATION given to CONFIGURE_PACKAGE_CONFIG_FILE()") - endif() - - if(IS_ABSOLUTE "${CCF_INSTALL_DESTINATION}") - set(absInstallDir "${CCF_INSTALL_DESTINATION}") - else() - set(absInstallDir "${CMAKE_INSTALL_PREFIX}/${CCF_INSTALL_DESTINATION}") - endif() - file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${CMAKE_INSTALL_PREFIX}" ) - - foreach(var ${CCF_PATH_VARS}) - if(NOT DEFINED ${var}) - message(FATAL_ERROR "Variable ${var} does not exist") - else() - if(IS_ABSOLUTE "${${var}}") - string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${PACKAGE_PREFIX_DIR}" - PACKAGE_${var} "${${var}}") - else() - set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}") - endif() - endif() - endforeach() - - set(PACKAGE_INIT " -####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() ####### -get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/${PACKAGE_RELATIVE_PATH}\" ABSOLUTE) -") - - if(NOT CCF_NO_SET_AND_CHECK_MACRO) - set(PACKAGE_INIT "${PACKAGE_INIT} -macro(set_and_check _var _file) - set(\${_var} \"\${_file}\") - if(NOT EXISTS \"\${_file}\") - message(FATAL_ERROR \"File or directory \${_file} referenced by variable \${_var} does not exist !\") - endif() -endmacro() -") - endif() - - - if(NOT CCF_NO_CHECK_REQUIRED_COMPONENTS_MACRO) - set(PACKAGE_INIT "${PACKAGE_INIT} -macro(check_required_components _NAME) - foreach(comp \${\${_NAME}_FIND_COMPONENTS}) - if(NOT \${_NAME}_\${comp}_FOUND) - if(\${_NAME}_FIND_REQUIRED_\${comp}) - set(\${_NAME}_FOUND FALSE) - endif() - endif() - endforeach() -endmacro() -") - endif() - - set(PACKAGE_INIT "${PACKAGE_INIT} -####################################################################################") - - configure_file("${_inputFile}" "${_outputFile}" @ONLY) - -endfunction() diff --git a/cmake-2.8.12-modules/CMakePackageConfigHelpers.cmake b/cmake-2.8.12-modules/CMakePackageConfigHelpers.cmake new file mode 100644 index 0000000..6ad4aba --- /dev/null +++ b/cmake-2.8.12-modules/CMakePackageConfigHelpers.cmake @@ -0,0 +1,358 @@ +#.rst: +# CMakePackageConfigHelpers +# ------------------------- +# +# CONFIGURE_PACKAGE_CONFIG_FILE(), WRITE_BASIC_PACKAGE_VERSION_FILE() +# +# +# +# :: +# +# CONFIGURE_PACKAGE_CONFIG_FILE( INSTALL_DESTINATION +# [PATH_VARS ... ] +# [NO_SET_AND_CHECK_MACRO] +# [NO_CHECK_REQUIRED_COMPONENTS_MACRO] +# [NO_FIND_DEPENDENCY_MACRO]) +# +# +# +# CONFIGURE_PACKAGE_CONFIG_FILE() should be used instead of the plain +# configure_file() command when creating the Config.cmake or +# -config.cmake file for installing a project or library. It +# helps making the resulting package relocatable by avoiding hardcoded +# paths in the installed Config.cmake file. +# +# In a FooConfig.cmake file there may be code like this to make the +# install destinations know to the using project: +# +# :: +# +# set(FOO_INCLUDE_DIR "@CMAKE_INSTALL_FULL_INCLUDEDIR@" ) +# set(FOO_DATA_DIR "@CMAKE_INSTALL_PREFIX@/@RELATIVE_DATA_INSTALL_DIR@" ) +# set(FOO_ICONS_DIR "@CMAKE_INSTALL_PREFIX@/share/icons" ) +# ...logic to determine installedPrefix from the own location... +# set(FOO_CONFIG_DIR "${installedPrefix}/@CONFIG_INSTALL_DIR@" ) +# +# All 4 options shown above are not sufficient, since the first 3 +# hardcode the absolute directory locations, and the 4th case works only +# if the logic to determine the installedPrefix is correct, and if +# CONFIG_INSTALL_DIR contains a relative path, which in general cannot +# be guaranteed. This has the effect that the resulting FooConfig.cmake +# file would work poorly under Windows and OSX, where users are used to +# choose the install location of a binary package at install time, +# independent from how CMAKE_INSTALL_PREFIX was set at build/cmake time. +# +# Using CONFIGURE_PACKAGE_CONFIG_FILE() helps. If used correctly, it +# makes the resulting FooConfig.cmake file relocatable. Usage: +# +# :: +# +# 1. write a FooConfig.cmake.in file as you are used to +# 2. insert a line containing only the string "@PACKAGE_INIT@" +# 3. instead of set(FOO_DIR "@SOME_INSTALL_DIR@"), use set(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@") +# (this must be after the @PACKAGE_INIT@ line) +# 4. instead of using the normal configure_file(), use CONFIGURE_PACKAGE_CONFIG_FILE() +# +# +# +# The and arguments are the input and output file, the +# same way as in configure_file(). +# +# The given to INSTALL_DESTINATION must be the destination where +# the FooConfig.cmake file will be installed to. This can either be a +# relative or absolute path, both work. +# +# The variables to given as PATH_VARS are the variables +# which contain install destinations. For each of them the macro will +# create a helper variable PACKAGE_. These helper variables +# must be used in the FooConfig.cmake.in file for setting the installed +# location. They are calculated by CONFIGURE_PACKAGE_CONFIG_FILE() so +# that they are always relative to the installed location of the +# package. This works both for relative and also for absolute +# locations. For absolute locations it works only if the absolute +# location is a subdirectory of CMAKE_INSTALL_PREFIX. +# +# By default configure_package_config_file() also generates two helper +# macros, set_and_check() and check_required_components() into the +# FooConfig.cmake file. +# +# set_and_check() should be used instead of the normal set() command for +# setting directories and file locations. Additionally to setting the +# variable it also checks that the referenced file or directory actually +# exists and fails with a FATAL_ERROR otherwise. This makes sure that +# the created FooConfig.cmake file does not contain wrong references. +# When using the NO_SET_AND_CHECK_MACRO, this macro is not generated +# into the FooConfig.cmake file. +# +# check_required_components() should be called at the end +# of the FooConfig.cmake file if the package supports components. This +# macro checks whether all requested, non-optional components have been +# found, and if this is not the case, sets the Foo_FOUND variable to +# FALSE, so that the package is considered to be not found. It does +# that by testing the Foo__FOUND variables for all requested +# required components. When using the NO_CHECK_REQUIRED_COMPONENTS +# option, this macro is not generated into the FooConfig.cmake file. +# +# For an example see below the documentation for +# WRITE_BASIC_PACKAGE_VERSION_FILE(). +# +# +# +# :: +# +# WRITE_BASIC_PACKAGE_VERSION_FILE( filename VERSION major.minor.patch COMPATIBILITY (AnyNewerVersion|SameMajorVersion|ExactVersion) ) +# +# +# +# Writes a file for use as ConfigVersion.cmake file to +# . See the documentation of find_package() for details on +# this. +# +# :: +# +# filename is the output filename, it should be in the build tree. +# major.minor.patch is the version number of the project to be installed +# +# The COMPATIBILITY mode AnyNewerVersion means that the installed +# package version will be considered compatible if it is newer or +# exactly the same as the requested version. This mode should be used +# for packages which are fully backward compatible, also across major +# versions. If SameMajorVersion is used instead, then the behaviour +# differs from AnyNewerVersion in that the major version number must be +# the same as requested, e.g. version 2.0 will not be considered +# compatible if 1.0 is requested. This mode should be used for packages +# which guarantee backward compatibility within the same major version. +# If ExactVersion is used, then the package is only considered +# compatible if the requested version matches exactly its own version +# number (not considering the tweak version). For example, version +# 1.2.3 of a package is only considered compatible to requested version +# 1.2.3. This mode is for packages without compatibility guarantees. +# If your project has more elaborated version matching rules, you will +# need to write your own custom ConfigVersion.cmake file instead of +# using this macro. +# +# Internally, this macro executes configure_file() to create the +# resulting version file. Depending on the COMPATIBLITY, either the +# file BasicConfigVersion-SameMajorVersion.cmake.in or +# BasicConfigVersion-AnyNewerVersion.cmake.in is used. Please note that +# these two files are internal to CMake and you should not call +# configure_file() on them yourself, but they can be used as starting +# point to create more sophisticted custom ConfigVersion.cmake files. +# +# +# +# Example using both configure_package_config_file() and +# write_basic_package_version_file(): CMakeLists.txt: +# +# :: +# +# set(INCLUDE_INSTALL_DIR include/ ... CACHE ) +# set(LIB_INSTALL_DIR lib/ ... CACHE ) +# set(SYSCONFIG_INSTALL_DIR etc/foo/ ... CACHE ) +# ... +# include(CMakePackageConfigHelpers) +# configure_package_config_file(FooConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake +# INSTALL_DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake +# PATH_VARS INCLUDE_INSTALL_DIR SYSCONFIG_INSTALL_DIR) +# write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake +# VERSION 1.2.3 +# COMPATIBILITY SameMajorVersion ) +# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake +# DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake ) +# +# +# +# With a FooConfig.cmake.in: +# +# :: +# +# set(FOO_VERSION x.y.z) +# ... +# @PACKAGE_INIT@ +# ... +# set_and_check(FOO_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") +# set_and_check(FOO_SYSCONFIG_DIR "@PACKAGE_SYSCONFIG_INSTALL_DIR@") +# +# +# +# :: +# +# check_required_components(Foo) + + +#============================================================================= +# Copyright 2012 Alexander Neundorf +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# 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. +#============================================================================= + +include(CMakeParseArguments) + +include(WriteBasicConfigVersionFile) + +macro(WRITE_BASIC_PACKAGE_VERSION_FILE) + write_basic_config_version_file(${ARGN}) +endmacro() + + +function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile) + set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO NO_FIND_DEPENDENCY_MACRO) + set(oneValueArgs INSTALL_DESTINATION ) + set(multiValueArgs PATH_VARS ) + + cmake_parse_arguments(CCF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(CCF_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unknown keywords given to CONFIGURE_PACKAGE_CONFIG_FILE(): \"${CCF_UNPARSED_ARGUMENTS}\"") + endif() + + if(NOT CCF_INSTALL_DESTINATION) + message(FATAL_ERROR "No INSTALL_DESTINATION given to CONFIGURE_PACKAGE_CONFIG_FILE()") + endif() + + if(IS_ABSOLUTE "${CCF_INSTALL_DESTINATION}") + set(absInstallDir "${CCF_INSTALL_DESTINATION}") + else() + set(absInstallDir "${CMAKE_INSTALL_PREFIX}/${CCF_INSTALL_DESTINATION}") + endif() + + file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${CMAKE_INSTALL_PREFIX}" ) + + foreach(var ${CCF_PATH_VARS}) + if(NOT DEFINED ${var}) + message(FATAL_ERROR "Variable ${var} does not exist") + else() + if(IS_ABSOLUTE "${${var}}") + string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${PACKAGE_PREFIX_DIR}" + PACKAGE_${var} "${${var}}") + else() + set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}") + endif() + endif() + endforeach() + + get_filename_component(inputFileName "${_inputFile}" NAME) + + set(PACKAGE_INIT " +####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() ####### +####### Any changes to this file will be overwritten by the next CMake run #### +####### The input file was ${inputFileName} ######## + +get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/${PACKAGE_RELATIVE_PATH}\" ABSOLUTE) +") + + if("${absInstallDir}" MATCHES "^(/usr)?/lib(64)?/.+") + # Handle "/usr move" symlinks created by some Linux distros. + set(PACKAGE_INIT "${PACKAGE_INIT} +# Use original install prefix when loaded through a \"/usr move\" +# cross-prefix symbolic link such as /lib -> /usr/lib. +get_filename_component(_realCurr \"\${CMAKE_CURRENT_LIST_DIR}\" REALPATH) +get_filename_component(_realOrig \"${absInstallDir}\" REALPATH) +if(_realCurr STREQUAL _realOrig) + set(PACKAGE_PREFIX_DIR \"${CMAKE_INSTALL_PREFIX}\") +endif() +unset(_realOrig) +unset(_realCurr) +") + endif() + + if(NOT CCF_NO_SET_AND_CHECK_MACRO) + set(PACKAGE_INIT "${PACKAGE_INIT} +macro(set_and_check _var _file) + set(\${_var} \"\${_file}\") + if(NOT EXISTS \"\${_file}\") + message(FATAL_ERROR \"File or directory \${_file} referenced by variable \${_var} does not exist !\") + endif() +endmacro() +") + endif() + + + if(NOT CCF_NO_CHECK_REQUIRED_COMPONENTS_MACRO) + set(PACKAGE_INIT "${PACKAGE_INIT} +macro(check_required_components _NAME) + foreach(comp \${\${_NAME}_FIND_COMPONENTS}) + if(NOT \${_NAME}_\${comp}_FOUND) + if(\${_NAME}_FIND_REQUIRED_\${comp}) + set(\${_NAME}_FOUND FALSE) + endif() + endif() + endforeach() +endmacro() +") + endif() + + if(NOT CCF_NO_FIND_DEPENDENCY_MACRO) + set(PACKAGE_INIT "${PACKAGE_INIT} +macro(find_dependency dep) + if (NOT \${dep}_FOUND) + if (\${ARGV1}) + set(version \${ARGV1}) + endif() + set(exact_arg) + if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION_EXACT) + set(exact_arg EXACT) + endif() + set(quiet_arg) + if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) + set(quiet_arg QUIET) + endif() + set(required_arg) + if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) + set(required_arg REQUIRED) + endif() + + find_package(\${dep} \${version} \${exact_arg} \${quiet_arg} \${required_arg}) + if (NOT \${dep}_FOUND) + set(\${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE \"\${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency \${dep} could not be found.\") + set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND False) + return() + endif() + set(required_arg) + set(quiet_arg) + set(exact_arg) + endif() +endmacro() +") + endif() + + set(PACKAGE_INIT "${PACKAGE_INIT} +####################################################################################") + + configure_file("${_inputFile}" "${_outputFile}" @ONLY) + +endfunction() diff --git a/cmake-2.8.12-modules/CMakeParseArguments.cmake b/cmake-2.8.12-modules/CMakeParseArguments.cmake new file mode 100644 index 0000000..3c80022 --- /dev/null +++ b/cmake-2.8.12-modules/CMakeParseArguments.cmake @@ -0,0 +1,187 @@ +#.rst: +# CMakeParseArguments +# ------------------- +# +# +# +# CMAKE_PARSE_ARGUMENTS( +# args...) +# +# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions +# for parsing the arguments given to that macro or function. It +# processes the arguments and defines a set of variables which hold the +# values of the respective options. +# +# The argument contains all options for the respective macro, +# i.e. keywords which can be used when calling the macro without any +# value following, like e.g. the OPTIONAL keyword of the install() +# command. +# +# The argument contains all keywords for this macro +# which are followed by one value, like e.g. DESTINATION keyword of the +# install() command. +# +# The argument contains all keywords for this +# macro which can be followed by more than one value, like e.g. the +# TARGETS or FILES keywords of the install() command. +# +# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the +# keywords listed in , and +# a variable composed of the given +# followed by "_" and the name of the respective keyword. These +# variables will then hold the respective value from the argument list. +# For the keywords this will be TRUE or FALSE. +# +# All remaining arguments are collected in a variable +# _UNPARSED_ARGUMENTS, this can be checked afterwards to see +# whether your macro was called with unrecognized parameters. +# +# As an example here a my_install() macro, which takes similar arguments +# as the real install() command: +# +# :: +# +# function(MY_INSTALL) +# set(options OPTIONAL FAST) +# set(oneValueArgs DESTINATION RENAME) +# set(multiValueArgs TARGETS CONFIGURATIONS) +# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) +# ... +# +# +# +# Assume my_install() has been called like this: +# +# :: +# +# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub) +# +# +# +# After the cmake_parse_arguments() call the macro will have set the +# following variables: +# +# :: +# +# MY_INSTALL_OPTIONAL = TRUE +# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install() +# MY_INSTALL_DESTINATION = "bin" +# MY_INSTALL_RENAME = "" (was not used) +# MY_INSTALL_TARGETS = "foo;bar" +# MY_INSTALL_CONFIGURATIONS = "" (was not used) +# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL" +# +# +# +# You can then continue and process these variables. +# +# Keywords terminate lists of values, e.g. if directly after a +# one_value_keyword another recognized keyword follows, this is +# interpreted as the beginning of the new option. E.g. +# my_install(TARGETS foo DESTINATION OPTIONAL) would result in +# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION +# would be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor. + +#============================================================================= +# Copyright 2010 Alexander Neundorf +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# 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(__CMAKE_PARSE_ARGUMENTS_INCLUDED) + return() +endif() +set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE) + + +function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames) + # first set all result variables to empty/FALSE + foreach(arg_name ${_singleArgNames} ${_multiArgNames}) + set(${prefix}_${arg_name}) + endforeach() + + foreach(option ${_optionNames}) + set(${prefix}_${option} FALSE) + endforeach() + + set(${prefix}_UNPARSED_ARGUMENTS) + + set(insideValues FALSE) + set(currentArgName) + + # now iterate over all arguments and fill the result variables + foreach(currentArg ${ARGN}) + list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword + list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword + list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword + + if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1) + if(insideValues) + if("${insideValues}" STREQUAL "SINGLE") + set(${prefix}_${currentArgName} ${currentArg}) + set(insideValues FALSE) + elseif("${insideValues}" STREQUAL "MULTI") + list(APPEND ${prefix}_${currentArgName} ${currentArg}) + endif() + else() + list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg}) + endif() + else() + if(NOT ${optionIndex} EQUAL -1) + set(${prefix}_${currentArg} TRUE) + set(insideValues FALSE) + elseif(NOT ${singleArgIndex} EQUAL -1) + set(currentArgName ${currentArg}) + set(${prefix}_${currentArgName}) + set(insideValues "SINGLE") + elseif(NOT ${multiArgIndex} EQUAL -1) + set(currentArgName ${currentArg}) + set(${prefix}_${currentArgName}) + set(insideValues "MULTI") + endif() + endif() + + endforeach() + + # propagate the result variables to the caller: + foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames}) + set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE) + endforeach() + set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE) + +endfunction() diff --git a/cmake-2.8.3-modules/FixWinInstallPrefix.cmake b/cmake-2.8.3-modules/FixWinInstallPrefix.cmake index 8169ddd..ceb180b 100644 --- a/cmake-2.8.3-modules/FixWinInstallPrefix.cmake +++ b/cmake-2.8.3-modules/FixWinInstallPrefix.cmake @@ -1,6 +1,6 @@ # - Automatically fix CMAKE_INSTALL_PREFIX to be bit-appropriate on Win # -# This is a workaround for CMake bug #9992 in at least <=2.8.0 - see +# This is a workaround for CMake bug #9992 in <2.8.3 - see # http://public.kitware.com/Bug/view.php?id=9992 # # It runs automatically when included on a Windows build (passes if(WIN32)) - @@ -27,7 +27,8 @@ if(WIN32) 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) + set(_PF86 "ProgramFiles(x86)") + file(TO_CMAKE_PATH "$ENV{${_PF86}}" _PROG_FILES_X86) # 64-bit dir: only set on win64 file(TO_CMAKE_PATH "$ENV{ProgramW6432}" _PROG_FILES_W6432) diff --git a/cmake-3.2.0-modules/FindGit.cmake b/cmake-3.2.0-modules/FindGit.cmake new file mode 100644 index 0000000..207b424 --- /dev/null +++ b/cmake-3.2.0-modules/FindGit.cmake @@ -0,0 +1,106 @@ +#.rst: +# FindGit +# ------- +# +# +# +# The module defines the following variables: +# +# :: +# +# GIT_EXECUTABLE - path to git command line client +# GIT_FOUND - true if the command line client was found +# GIT_VERSION_STRING - the version of git found (since CMake 2.8.8) +# +# Example usage: +# +# :: +# +# find_package(Git) +# if(GIT_FOUND) +# message("git found: ${GIT_EXECUTABLE}") +# endif() + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2012 Rolf Eike Beer +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# 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. +#============================================================================= +# +# 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. +#============================================================================= + +# Look for 'git' or 'eg' (easy git) +# +set(git_names git eg) + +# Prefer .cmd variants on Windows unless running in a Makefile +# in the MSYS shell. +# +if(WIN32) + if(NOT CMAKE_GENERATOR MATCHES "MSYS") + set(git_names git.cmd git eg.cmd eg) + # GitHub search path for Windows + set(github_path "$ENV{LOCALAPPDATA}/Github/PortableGit*/bin") + file(GLOB github_path "${github_path}") + endif() +endif() + +find_program(GIT_EXECUTABLE + NAMES ${git_names} + PATHS ${github_path} + PATH_SUFFIXES Git/cmd Git/bin + DOC "git command line client" + ) +mark_as_advanced(GIT_EXECUTABLE) + +if(GIT_EXECUTABLE) + execute_process(COMMAND ${GIT_EXECUTABLE} --version + OUTPUT_VARIABLE git_version + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (git_version MATCHES "^git version [0-9]") + string(REPLACE "git version " "" GIT_VERSION_STRING "${git_version}") + endif() + unset(git_version) +endif() + +# Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if +# all listed variables are TRUE + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Git + REQUIRED_VARS GIT_EXECUTABLE + VERSION_VAR GIT_VERSION_STRING) diff --git a/cmake-3.3.0-modules/WriteCompilerDetectionHeader.cmake b/cmake-3.3.0-modules/WriteCompilerDetectionHeader.cmake new file mode 100644 index 0000000..b40d824 --- /dev/null +++ b/cmake-3.3.0-modules/WriteCompilerDetectionHeader.cmake @@ -0,0 +1,692 @@ +#.rst: +# WriteCompilerDetectionHeader +# ---------------------------- +# +# This module provides the function write_compiler_detection_header(). +# +# The ``WRITE_COMPILER_DETECTION_HEADER`` function can be used to generate +# a file suitable for preprocessor inclusion which contains macros to be +# used in source code:: +# +# write_compiler_detection_header( +# FILE +# PREFIX +# [OUTPUT_FILES_VAR OUTPUT_DIR ] +# COMPILERS [...] +# FEATURES [...] +# [VERSION ] +# [PROLOG ] +# [EPILOG ] +# ) +# +# The ``write_compiler_detection_header`` function generates the +# file ```` with macros which all have the prefix ````. +# +# By default, all content is written directly to the ````. The +# ``OUTPUT_FILES_VAR`` may be specified to cause the compiler-specific +# content to be written to separate files. The separate files are then +# available in the ```` and may be consumed by the caller +# for installation for example. The ``OUTPUT_DIR`` specifies a relative +# path from the main ```` to the compiler-specific files. For example: +# +# .. code-block:: cmake +# +# write_compiler_detection_header( +# FILE climbingstats_compiler_detection.h +# PREFIX ClimbingStats +# OUTPUT_FILES_VAR support_files +# OUTPUT_DIR compilers +# COMPILERS GNU Clang MSVC +# FEATURES cxx_variadic_templates +# ) +# install(FILES +# ${CMAKE_CURRENT_BINARY_DIR}/climbingstats_compiler_detection.h +# DESTINATION include +# ) +# install(FILES +# ${support_files} +# DESTINATION include/compilers +# ) +# +# +# ``VERSION`` may be used to specify the API version to be generated. +# Future versions of CMake may introduce alternative APIs. A given +# API is selected by any ```` value greater than or equal +# to the version of CMake that introduced the given API and less +# than the version of CMake that introduced its succeeding API. +# The value of the :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` +# variable is used if no explicit version is specified. +# (As of CMake version |release| there is only one API version.) +# +# ``PROLOG`` may be specified as text content to write at the start of the +# header. ``EPILOG`` may be specified as text content to write at the end +# of the header +# +# At least one ```` and one ```` must be listed. Compilers +# which are known to CMake, but not specified are detected and a preprocessor +# ``#error`` is generated for them. A preprocessor macro matching +# ``_COMPILER_IS_`` is generated for each compiler +# known to CMake to contain the value ``0`` or ``1``. +# +# Possible compiler identifiers are documented with the +# :variable:`CMAKE__COMPILER_ID` variable. +# Available features in this version of CMake are listed in the +# :prop_gbl:`CMAKE_C_KNOWN_FEATURES` and +# :prop_gbl:`CMAKE_CXX_KNOWN_FEATURES` global properties. +# +# See the :manual:`cmake-compile-features(7)` manual for information on +# compile features. +# +# Feature Test Macros +# =================== +# +# For each compiler, a preprocessor macro is generated matching +# ``_COMPILER_IS_`` which has the content either ``0`` +# or ``1``, depending on the compiler in use. Preprocessor macros for +# compiler version components are generated matching +# ``_COMPILER_VERSION_MAJOR`` ``_COMPILER_VERSION_MINOR`` +# and ``_COMPILER_VERSION_PATCH`` containing decimal values +# for the corresponding compiler version components, if defined. +# +# A preprocessor test is generated based on the compiler version +# denoting whether each feature is enabled. A preprocessor macro +# matching ``_COMPILER_``, where ```` is the +# upper-case ```` name, is generated to contain the value +# ``0`` or ``1`` depending on whether the compiler in use supports the +# feature: +# +# .. code-block:: cmake +# +# write_compiler_detection_header( +# FILE climbingstats_compiler_detection.h +# PREFIX ClimbingStats +# COMPILERS GNU Clang AppleClang MSVC +# FEATURES cxx_variadic_templates +# ) +# +# .. code-block:: c++ +# +# #if ClimbingStats_COMPILER_CXX_VARIADIC_TEMPLATES +# template +# void someInterface(T t...) { /* ... */ } +# #else +# // Compatibility versions +# template +# void someInterface(T1 t1) { /* ... */ } +# template +# void someInterface(T1 t1, T2 t2) { /* ... */ } +# template +# void someInterface(T1 t1, T2 t2, T3 t3) { /* ... */ } +# #endif +# +# Symbol Macros +# ============= +# +# Some additional symbol-defines are created for particular features for +# use as symbols which may be conditionally defined empty: +# +# .. code-block:: c++ +# +# class MyClass ClimbingStats_FINAL +# { +# ClimbingStats_CONSTEXPR int someInterface() { return 42; } +# }; +# +# The ``ClimbingStats_FINAL`` macro will expand to ``final`` if the +# compiler (and its flags) support the ``cxx_final`` feature, and the +# ``ClimbingStats_CONSTEXPR`` macro will expand to ``constexpr`` +# if ``cxx_constexpr`` is supported. +# +# The following features generate corresponding symbol defines: +# +# ========================== =================================== ================= +# Feature Define Symbol +# ========================== =================================== ================= +# ``c_restrict`` ``_RESTRICT`` ``restrict`` +# ``cxx_constexpr`` ``_CONSTEXPR`` ``constexpr`` +# ``cxx_deleted_functions`` ``_DELETED_FUNCTION`` ``= delete`` +# ``cxx_extern_templates`` ``_EXTERN_TEMPLATE`` ``extern`` +# ``cxx_final`` ``_FINAL`` ``final`` +# ``cxx_noexcept`` ``_NOEXCEPT`` ``noexcept`` +# ``cxx_noexcept`` ``_NOEXCEPT_EXPR(X)`` ``noexcept(X)`` +# ``cxx_override`` ``_OVERRIDE`` ``override`` +# ========================== =================================== ================= +# +# Compatibility Implementation Macros +# =================================== +# +# Some features are suitable for wrapping in a macro with a backward +# compatibility implementation if the compiler does not support the feature. +# +# When the ``cxx_static_assert`` feature is not provided by the compiler, +# a compatibility implementation is available via the +# ``_STATIC_ASSERT(COND)`` and +# ``_STATIC_ASSERT_MSG(COND, MSG)`` function-like macros. The macros +# expand to ``static_assert`` where that compiler feature is available, and +# to a compatibility implementation otherwise. In the first form, the +# condition is stringified in the message field of ``static_assert``. In +# the second form, the message ``MSG`` is passed to the message field of +# ``static_assert``, or ignored if using the backward compatibility +# implementation. +# +# The ``cxx_attribute_deprecated`` feature provides a macro definition +# ``_DEPRECATED``, which expands to either the standard +# ``[[deprecated]]`` attribute or a compiler-specific decorator such +# as ``__attribute__((__deprecated__))`` used by GNU compilers. +# +# The ``cxx_alignas`` feature provides a macro definition +# ``_ALIGNAS`` which expands to either the standard ``alignas`` +# decorator or a compiler-specific decorator such as +# ``__attribute__ ((__aligned__))`` used by GNU compilers. +# +# The ``cxx_alignof`` feature provides a macro definition +# ``_ALIGNOF`` which expands to either the standard ``alignof`` +# decorator or a compiler-specific decorator such as ``__alignof__`` +# used by GNU compilers. +# +# ============================= ================================ ===================== +# Feature Define Symbol +# ============================= ================================ ===================== +# ``cxx_alignas`` ``_ALIGNAS`` ``alignas`` +# ``cxx_alignof`` ``_ALIGNOF`` ``alignof`` +# ``cxx_nullptr`` ``_NULLPTR`` ``nullptr`` +# ``cxx_static_assert`` ``_STATIC_ASSERT`` ``static_assert`` +# ``cxx_static_assert`` ``_STATIC_ASSERT_MSG`` ``static_assert`` +# ``cxx_attribute_deprecated`` ``_DEPRECATED`` ``[[deprecated]]`` +# ``cxx_attribute_deprecated`` ``_DEPRECATED_MSG`` ``[[deprecated]]`` +# ``cxx_thread_local`` ``_THREAD_LOCAL`` ``thread_local`` +# ============================= ================================ ===================== +# +# A use-case which arises with such deprecation macros is the deprecation +# of an entire library. In that case, all public API in the library may +# be decorated with the ``_DEPRECATED`` macro. This results in +# very noisy build output when building the library itself, so the macro +# may be may be defined to empty in that case when building the deprecated +# library: +# +# .. code-block:: cmake +# +# add_library(compat_support ${srcs}) +# target_compile_definitions(compat_support +# PRIVATE +# CompatSupport_DEPRECATED= +# ) + +#============================================================================= +# Copyright 2014 Stephen Kelly +# +# 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. +#============================================================================= +# +# 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. +#============================================================================= + + +include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CMakeCompilerIdDetection.cmake) + +function(_load_compiler_variables CompilerId lang) + include("${CMAKE_ROOT}/Modules/Compiler/${CompilerId}-${lang}-FeatureTests.cmake" OPTIONAL) + set(_cmake_oldestSupported_${CompilerId} ${_cmake_oldestSupported} PARENT_SCOPE) + foreach(feature ${ARGN}) + set(_cmake_feature_test_${CompilerId}_${feature} ${_cmake_feature_test_${feature}} PARENT_SCOPE) + endforeach() + include("${CMAKE_ROOT}/Modules/Compiler/${CompilerId}-${lang}-DetermineCompiler.cmake" OPTIONAL + RESULT_VARIABLE determinedCompiler) + if (NOT determinedCompiler) + include("${CMAKE_ROOT}/Modules/Compiler/${CompilerId}-DetermineCompiler.cmake" OPTIONAL) + endif() + set(_compiler_id_version_compute_${CompilerId} ${_compiler_id_version_compute} PARENT_SCOPE) +endfunction() + +function(write_compiler_detection_header + file_keyword file_arg + prefix_keyword prefix_arg + ) + if (NOT "x${file_keyword}" STREQUAL "xFILE") + message(FATAL_ERROR "write_compiler_detection_header: FILE parameter missing.") + endif() + if (NOT "x${prefix_keyword}" STREQUAL "xPREFIX") + message(FATAL_ERROR "write_compiler_detection_header: PREFIX parameter missing.") + endif() + set(options) + set(oneValueArgs VERSION EPILOG PROLOG OUTPUT_FILES_VAR OUTPUT_DIR) + set(multiValueArgs COMPILERS FEATURES) + cmake_parse_arguments(_WCD "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if (NOT _WCD_COMPILERS) + message(FATAL_ERROR "Invalid arguments. write_compiler_detection_header requires at least one compiler.") + endif() + if (NOT _WCD_FEATURES) + message(FATAL_ERROR "Invalid arguments. write_compiler_detection_header requires at least one feature.") + endif() + + if(_WCD_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unparsed arguments: ${_WCD_UNPARSED_ARGUMENTS}") + endif() + + if (prefix_arg STREQUAL "") + message(FATAL_ERROR "A prefix must be specified") + endif() + string(MAKE_C_IDENTIFIER ${prefix_arg} cleaned_prefix) + if (NOT prefix_arg STREQUAL cleaned_prefix) + message(FATAL_ERROR "The prefix must be a valid C identifier.") + endif() + + if(NOT _WCD_VERSION) + set(_WCD_VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION}) + endif() + set(_min_version 3.1.0) # Version which introduced this function + if (_WCD_VERSION VERSION_LESS _min_version) + set(err "VERSION compatibility for write_compiler_detection_header is set to ${_WCD_VERSION}, which is too low.") + set(err "${err} It must be set to at least ${_min_version}. ") + set(err "${err} Either set the VERSION parameter to the write_compiler_detection_header function, or update") + set(err "${err} your minimum required CMake version with the cmake_minimum_required command.") + message(FATAL_ERROR "${err}") + endif() + + if(_WCD_OUTPUT_FILES_VAR) + if(NOT _WCD_OUTPUT_DIR) + message(FATAL_ERROR "If OUTPUT_FILES_VAR is specified, then OUTPUT_DIR must also be specified.") + endif() + endif() + if(_WCD_OUTPUT_DIR) + if(NOT _WCD_OUTPUT_FILES_VAR) + message(FATAL_ERROR "If OUTPUT_DIR is specified, then OUTPUT_FILES_VAR must also be specified.") + endif() + get_filename_component(main_file_dir ${file_arg} DIRECTORY) + if (NOT IS_ABSOLUTE ${main_file_dir}) + set(main_file_dir "${CMAKE_CURRENT_BINARY_DIR}/${main_file_dir}") + endif() + if (NOT IS_ABSOLUTE ${_WCD_OUTPUT_DIR}) + set(_WCD_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${_WCD_OUTPUT_DIR}") + endif() + get_filename_component(out_file_dir ${_WCD_OUTPUT_DIR} ABSOLUTE) + string(FIND ${out_file_dir} ${main_file_dir} idx) + if (NOT idx EQUAL 0) + message(FATAL_ERROR "The compiler-specific output directory must be within the same directory as the main file.") + endif() + + if (main_file_dir STREQUAL out_file_dir) + unset(_WCD_OUTPUT_DIR) + else() + string(REPLACE "${main_file_dir}/" "" _WCD_OUTPUT_DIR "${out_file_dir}/") + endif() + endif() + + set(compilers + GNU + Clang + AppleClang + MSVC + SunPro + ) + + set(_hex_compilers ADSP Borland Embarcadero SunPro) + + foreach(_comp ${_WCD_COMPILERS}) + list(FIND compilers ${_comp} idx) + if (idx EQUAL -1) + message(FATAL_ERROR "Unsupported compiler ${_comp}.") + endif() + if (NOT _need_hex_conversion) + list(FIND _hex_compilers ${_comp} idx) + if (NOT idx EQUAL -1) + set(_need_hex_conversion TRUE) + endif() + endif() + endforeach() + + set(file_content " +// This is a generated file. Do not edit! + +#ifndef ${prefix_arg}_COMPILER_DETECTION_H +#define ${prefix_arg}_COMPILER_DETECTION_H +") + + if (_WCD_PROLOG) + set(file_content "${file_content}\n${_WCD_PROLOG}\n") + endif() + + if (_need_hex_conversion) + set(file_content "${file_content} +#define ${prefix_arg}_DEC(X) (X) +#define ${prefix_arg}_HEX(X) ( \\ + ((X)>>28 & 0xF) * 10000000 + \\ + ((X)>>24 & 0xF) * 1000000 + \\ + ((X)>>20 & 0xF) * 100000 + \\ + ((X)>>16 & 0xF) * 10000 + \\ + ((X)>>12 & 0xF) * 1000 + \\ + ((X)>>8 & 0xF) * 100 + \\ + ((X)>>4 & 0xF) * 10 + \\ + ((X) & 0xF) \\ + )\n") + endif() + + foreach(feature ${_WCD_FEATURES}) + if (feature MATCHES "^cxx_") + list(APPEND _langs CXX) + list(APPEND CXX_features ${feature}) + elseif (feature MATCHES "^c_") + list(APPEND _langs C) + list(APPEND C_features ${feature}) + else() + message(FATAL_ERROR "Unsupported feature ${feature}.") + endif() + endforeach() + list(REMOVE_DUPLICATES _langs) + + if(_WCD_OUTPUT_FILES_VAR) + get_filename_component(main_file_name ${file_arg} NAME) + set(compiler_file_content_ +"#ifndef ${prefix_arg}_COMPILER_DETECTION_H +# error This file may only be included from ${main_file_name} +#endif\n") + endif() + + foreach(_lang ${_langs}) + set(target_compilers) + foreach(compiler ${_WCD_COMPILERS}) + _load_compiler_variables(${compiler} ${_lang} ${${_lang}_features}) + if(_cmake_oldestSupported_${compiler}) + list(APPEND target_compilers ${compiler}) + endif() + endforeach() + + get_property(known_features GLOBAL PROPERTY CMAKE_${_lang}_KNOWN_FEATURES) + foreach(feature ${${_lang}_features}) + list(FIND known_features ${feature} idx) + if (idx EQUAL -1) + message(FATAL_ERROR "Unsupported feature ${feature}.") + endif() + endforeach() + + if(_lang STREQUAL CXX) + set(file_content "${file_content}\n#ifdef __cplusplus\n") + else() + set(file_content "${file_content}\n#ifndef __cplusplus\n") + endif() + + compiler_id_detection(ID_CONTENT ${_lang} PREFIX ${prefix_arg}_ + ID_DEFINE + ) + + set(file_content "${file_content}${ID_CONTENT}\n") + + set(pp_if "if") + foreach(compiler ${target_compilers}) + set(file_content "${file_content}\n# ${pp_if} ${prefix_arg}_COMPILER_IS_${compiler}\n") + + if(_WCD_OUTPUT_FILES_VAR) + set(compile_file_name "${_WCD_OUTPUT_DIR}${prefix_arg}_COMPILER_INFO_${compiler}_${_lang}.h") + set(file_content "${file_content}\n# include \"${compile_file_name}\"\n") + endif() + + if(_WCD_OUTPUT_FILES_VAR) + set(compiler_file_content compiler_file_content_${compiler}_${_lang}) + else() + set(compiler_file_content file_content) + endif() + + set(${compiler_file_content} "${${compiler_file_content}} +# if !(${_cmake_oldestSupported_${compiler}}) +# error Unsupported compiler version +# endif\n") + + set(PREFIX ${prefix_arg}_) + if (_need_hex_conversion) + set(MACRO_DEC ${prefix_arg}_DEC) + set(MACRO_HEX ${prefix_arg}_HEX) + else() + set(MACRO_DEC) + set(MACRO_HEX) + endif() + string(CONFIGURE "${_compiler_id_version_compute_${compiler}}" VERSION_BLOCK @ONLY) + set(${compiler_file_content} "${${compiler_file_content}}${VERSION_BLOCK}\n") + set(PREFIX) + set(MACRO_DEC) + set(MACRO_HEX) + + set(pp_if "elif") + foreach(feature ${${_lang}_features}) + string(TOUPPER ${feature} feature_upper) + set(feature_PP "COMPILER_${feature_upper}") + set(_define_item "\n# define ${prefix_arg}_${feature_PP} 0\n") + if (_cmake_feature_test_${compiler}_${feature} STREQUAL "1") + set(_define_item "\n# define ${prefix_arg}_${feature_PP} 1\n") + elseif (_cmake_feature_test_${compiler}_${feature}) + set(_define_item "\n# define ${prefix_arg}_${feature_PP} 0\n") + set(_define_item "\n# if ${_cmake_feature_test_${compiler}_${feature}}\n# define ${prefix_arg}_${feature_PP} 1\n# else${_define_item}# endif\n") + endif() + set(${compiler_file_content} "${${compiler_file_content}}${_define_item}") + endforeach() + endforeach() + if(pp_if STREQUAL "elif") + set(file_content "${file_content} +# else +# error Unsupported compiler +# endif\n") + endif() + foreach(feature ${${_lang}_features}) + string(TOUPPER ${feature} feature_upper) + set(feature_PP "COMPILER_${feature_upper}") + set(def_name ${prefix_arg}_${feature_PP}) + if (feature STREQUAL c_restrict) + set(def_value "${prefix_arg}_RESTRICT") + set(file_content "${file_content} +# if ${def_name} +# define ${def_value} restrict +# else +# define ${def_value} +# endif +\n") + endif() + if (feature STREQUAL cxx_constexpr) + set(def_value "${prefix_arg}_CONSTEXPR") + set(file_content "${file_content} +# if ${def_name} +# define ${def_value} constexpr +# else +# define ${def_value} +# endif +\n") + endif() + if (feature STREQUAL cxx_final) + set(def_value "${prefix_arg}_FINAL") + set(file_content "${file_content} +# if ${def_name} +# define ${def_value} final +# else +# define ${def_value} +# endif +\n") + endif() + if (feature STREQUAL cxx_override) + set(def_value "${prefix_arg}_OVERRIDE") + set(file_content "${file_content} +# if ${def_name} +# define ${def_value} override +# else +# define ${def_value} +# endif +\n") + endif() + if (feature STREQUAL cxx_static_assert) + set(def_value "${prefix_arg}_STATIC_ASSERT(X)") + set(def_value_msg "${prefix_arg}_STATIC_ASSERT_MSG(X, MSG)") + set(static_assert_struct "template struct ${prefix_arg}StaticAssert;\ntemplate<> struct ${prefix_arg}StaticAssert{};\n") + set(def_standard "# define ${def_value} static_assert(X, #X)\n# define ${def_value_msg} static_assert(X, MSG)") + set(def_alternative "${static_assert_struct}# define ${def_value} sizeof(${prefix_arg}StaticAssert)\n# define ${def_value_msg} sizeof(${prefix_arg}StaticAssert)") + set(file_content "${file_content}# if ${def_name}\n${def_standard}\n# else\n${def_alternative}\n# endif\n\n") + endif() + if (feature STREQUAL cxx_alignas) + set(def_value "${prefix_arg}_ALIGNAS(X)") + set(file_content "${file_content} +# if ${def_name} +# define ${def_value} alignas(X) +# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang || ${prefix_arg}_COMPILER_IS_AppleClang +# define ${def_value} __attribute__ ((__aligned__(X))) +# elif ${prefix_arg}_COMPILER_IS_MSVC +# define ${def_value} __declspec(align(X)) +# else +# define ${def_value} +# endif +\n") + endif() + if (feature STREQUAL cxx_alignof) + set(def_value "${prefix_arg}_ALIGNOF(X)") + set(file_content "${file_content} +# if ${def_name} +# define ${def_value} alignof(X) +# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang || ${prefix_arg}_COMPILER_IS_AppleClang +# define ${def_value} __alignof__(X) +# elif ${prefix_arg}_COMPILER_IS_MSVC +# define ${def_value} __alignof(X) +# endif +\n") + endif() + if (feature STREQUAL cxx_deleted_functions) + set(def_value "${prefix_arg}_DELETED_FUNCTION") + set(file_content "${file_content} +# if ${def_name} +# define ${def_value} = delete +# else +# define ${def_value} +# endif +\n") + endif() + if (feature STREQUAL cxx_extern_templates) + set(def_value "${prefix_arg}_EXTERN_TEMPLATE") + set(file_content "${file_content} +# if ${def_name} +# define ${def_value} extern +# else +# define ${def_value} +# endif +\n") + endif() + if (feature STREQUAL cxx_noexcept) + set(def_value "${prefix_arg}_NOEXCEPT") + set(file_content "${file_content} +# if ${def_name} +# define ${def_value} noexcept +# define ${def_value}_EXPR(X) noexcept(X) +# else +# define ${def_value} +# define ${def_value}_EXPR(X) +# endif +\n") + endif() + if (feature STREQUAL cxx_nullptr) + set(def_value "${prefix_arg}_NULLPTR") + set(file_content "${file_content} +# if ${def_name} +# define ${def_value} nullptr +# else +# define ${def_value} 0 +# endif +\n") + endif() + if (feature STREQUAL cxx_thread_local) + set(def_value "${prefix_arg}_THREAD_LOCAL") + set(file_content "${file_content} +# if ${def_name} +# define ${def_value} thread_local +# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang || ${prefix_arg}_COMPILER_IS_AppleClang +# define ${def_value} __thread +# elif ${prefix_arg}_COMPILER_IS_MSVC +# define ${def_value} __declspec(thread) +# else +// ${def_value} not defined for this configuration. +# endif +\n") + endif() + if (feature STREQUAL cxx_attribute_deprecated) + set(def_name ${prefix_arg}_${feature_PP}) + set(def_value "${prefix_arg}_DEPRECATED") + set(file_content "${file_content} +# ifndef ${def_value} +# if ${def_name} +# define ${def_value} [[deprecated]] +# define ${def_value}_MSG(MSG) [[deprecated(MSG)]] +# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang +# define ${def_value} __attribute__((__deprecated__)) +# define ${def_value}_MSG(MSG) __attribute__((__deprecated__(MSG))) +# elif ${prefix_arg}_COMPILER_IS_MSVC +# define ${def_value} __declspec(deprecated) +# define ${def_value}_MSG(MSG) __declspec(deprecated(MSG)) +# else +# define ${def_value} +# define ${def_value}_MSG(MSG) +# endif +# endif +\n") + endif() + endforeach() + + set(file_content "${file_content}#endif\n") + + endforeach() + + if(_WCD_OUTPUT_FILES_VAR) + foreach(compiler ${_WCD_COMPILERS}) + foreach(_lang ${_langs}) + if(compiler_file_content_${compiler}_${_lang}) + set(CMAKE_CONFIGURABLE_FILE_CONTENT "${compiler_file_content_}") + set(CMAKE_CONFIGURABLE_FILE_CONTENT "${CMAKE_CONFIGURABLE_FILE_CONTENT}${compiler_file_content_${compiler}_${_lang}}") + + set(compile_file_name "${_WCD_OUTPUT_DIR}${prefix_arg}_COMPILER_INFO_${compiler}_${_lang}.h") + set(full_path "${main_file_dir}/${compile_file_name}") + list(APPEND ${_WCD_OUTPUT_FILES_VAR} ${full_path}) + configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in" + "${full_path}" + @ONLY + ) + endif() + endforeach() + endforeach() + set(${_WCD_OUTPUT_FILES_VAR} ${${_WCD_OUTPUT_FILES_VAR}} PARENT_SCOPE) + endif() + + if (_WCD_EPILOG) + set(file_content "${file_content}\n${_WCD_EPILOG}\n") + endif() + set(file_content "${file_content}\n#endif") + + set(CMAKE_CONFIGURABLE_FILE_CONTENT ${file_content}) + configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in" + "${file_arg}" + @ONLY + ) +endfunction() diff --git a/cmake-2.9.0-modules/RequireOutOfSourceBuild.cmake b/cmake-4.0.0-modules/RequireOutOfSourceBuild.cmake similarity index 100% rename from cmake-2.9.0-modules/RequireOutOfSourceBuild.cmake rename to cmake-4.0.0-modules/RequireOutOfSourceBuild.cmake diff --git a/cmake-2.9.0-modules/autoinclude.cmake b/cmake-4.0.0-modules/autoinclude.cmake similarity index 100% rename from cmake-2.9.0-modules/autoinclude.cmake rename to cmake-4.0.0-modules/autoinclude.cmake diff --git a/cmake-2.9.0-modules/from-ITK-3.18.0/FindFFTW.cmake b/cmake-4.0.0-modules/from-ITK-3.18.0/FindFFTW.cmake similarity index 100% rename from cmake-2.9.0-modules/from-ITK-3.18.0/FindFFTW.cmake rename to cmake-4.0.0-modules/from-ITK-3.18.0/FindFFTW.cmake diff --git a/ghost-fake-stl/alloc.h b/ghost-fake-stl/alloc.h new file mode 100644 index 0000000..cc8883f --- /dev/null +++ b/ghost-fake-stl/alloc.h @@ -0,0 +1,14 @@ +/** @file + @brief Fake header to allow GHOST 4.09 use with MSVC 2005 + + @date 2012 + + @author + Ryan Pavlik + and + http://academic.cleardefinition.com/ + Iowa State University Virtual Reality Applications Center + Human-Computer Interaction Graduate Program +*/ + +#pragma once diff --git a/ghost-fake-stl/hash_map.h b/ghost-fake-stl/hash_map.h new file mode 100644 index 0000000..fcf3f0d --- /dev/null +++ b/ghost-fake-stl/hash_map.h @@ -0,0 +1,28 @@ +/** @file + @brief Fake header to allow GHOST 4.09 use with MSVC 2005 + + @date 2012 + + @author + Ryan Pavlik + and + http://academic.cleardefinition.com/ + Iowa State University Virtual Reality Applications Center + Human-Computer Interaction Graduate Program +*/ + +#pragma once + +#include +//using stdext::hash_map; + +template +class hash; +template +class equal_to; + +template +class hash_map; + +template +class hash_map, equal_to > : public stdext::hash_map {}; diff --git a/ghost-fake-stl/pair.h b/ghost-fake-stl/pair.h new file mode 100644 index 0000000..af793b5 --- /dev/null +++ b/ghost-fake-stl/pair.h @@ -0,0 +1,17 @@ +/** @file + @brief Fake header to allow GHOST 4.09 use with MSVC 2005 + + @date 2012 + + @author + Ryan Pavlik + and + http://academic.cleardefinition.com/ + Iowa State University Virtual Reality Applications Center + Human-Computer Interaction Graduate Program +*/ + +#pragma once + +#include +using std::pair; diff --git a/launcher-templates/genericlauncher.cmd.in b/launcher-templates/genericlauncher.cmd.in index 91e5b68..9a19bbc 100644 --- a/launcher-templates/genericlauncher.cmd.in +++ b/launcher-templates/genericlauncher.cmd.in @@ -1,14 +1,14 @@ -cd @USERFILE_WORKING_DIRECTORY@ -@USERFILE_ENV_COMMANDS@ - -IF NOT [x%1]==[x--debugger] GOTO SkipDebuggingMess - -ECHO Need to ditch the debugger! -SHIFT /1 -%1 %2 %3 %4 %5 %6 %7 %8 %9 -GOTO EOF - -:SkipDebuggingMess -%* - +cd @USERFILE_WORKING_DIRECTORY@ +@USERFILE_ENV_COMMANDS@ + +IF NOT [x%1]==[x--debugger] GOTO SkipDebuggingMess + +ECHO Need to ditch the debugger! +SHIFT /1 +%1 %2 %3 %4 %5 %6 %7 %8 %9 +GOTO EOF + +:SkipDebuggingMess +%* + :EOF \ No newline at end of file diff --git a/launcher-templates/launcher.env.cmd.in b/launcher-templates/launcher.env.cmd.in index d69ebca..72a24e6 100644 --- a/launcher-templates/launcher.env.cmd.in +++ b/launcher-templates/launcher.env.cmd.in @@ -1 +1 @@ -set @_arg@ +set @_arg@ diff --git a/launcher-templates/perconfig.vcproj.user.in b/launcher-templates/perconfig.vcproj.user.in index a5d1dc8..95cacec 100644 --- a/launcher-templates/perconfig.vcproj.user.in +++ b/launcher-templates/perconfig.vcproj.user.in @@ -1,28 +1,28 @@ - - - + + + diff --git a/launcher-templates/perconfig.vcxproj.user.in b/launcher-templates/perconfig.vcxproj.user.in index 0155a7e..ef02379 100644 --- a/launcher-templates/perconfig.vcxproj.user.in +++ b/launcher-templates/perconfig.vcxproj.user.in @@ -1,7 +1,7 @@ - - @USERFILE_ENVIRONMENT@ - WindowsLocalDebugger - ${USERFILE_@USERFILE_CONFIGNAME@_COMMAND} - @USERFILE_COMMAND_ARGUMENTS@ - @USERFILE_WORKING_DIRECTORY@ - + + @USERFILE_ENVIRONMENT@ + WindowsLocalDebugger + ${USERFILE_@USERFILE_CONFIGNAME@_COMMAND} + @USERFILE_COMMAND_ARGUMENTS@ + @USERFILE_WORKING_DIRECTORY@ + diff --git a/launcher-templates/targetlauncher.cmd.in b/launcher-templates/targetlauncher.cmd.in index 0c92cb1..c5715d6 100644 --- a/launcher-templates/targetlauncher.cmd.in +++ b/launcher-templates/targetlauncher.cmd.in @@ -1,8 +1,8 @@ -cd @USERFILE_WORKING_DIRECTORY@ -@USERFILE_ENV_COMMANDS@ -if [%1]==[--debugger] ( - SHIFT -) - -"@USERFILE_COMMAND@" @LAUNCHERSCRIPT_COMMAND_ARGUMENTS@ +cd @USERFILE_WORKING_DIRECTORY@ +@USERFILE_ENV_COMMANDS@ +if [%1]==[--debugger] ( + SHIFT +) + +"@USERFILE_COMMAND@" @LAUNCHERSCRIPT_COMMAND_ARGUMENTS@ pause diff --git a/launcher-templates/vcproj.user.in b/launcher-templates/vcproj.user.in index 71f0bc3..117473d 100644 --- a/launcher-templates/vcproj.user.in +++ b/launcher-templates/vcproj.user.in @@ -1,10 +1,10 @@ - - - -@USERFILE_CONFIGSECTIONS@ - - + + + +@USERFILE_CONFIGSECTIONS@ + + diff --git a/launcher-templates/vcxproj.user.in b/launcher-templates/vcxproj.user.in index 3629d39..f3e4238 100644 --- a/launcher-templates/vcxproj.user.in +++ b/launcher-templates/vcxproj.user.in @@ -1,4 +1,4 @@ - - -@USERFILE_CONFIGSECTIONS@ - + + +@USERFILE_CONFIGSECTIONS@ + diff --git a/module-help.html b/module-help.html index dc35875..e051192 100644 --- a/module-help.html +++ b/module-help.html @@ -1,24 +1,138 @@ module-help - cmake -

Master Index CMake 2.8.6

+

Master Index CMake 2.8.11.1

-

Introduction

+

Introduction

module-help - Reference of available CMake custom modules.

-

Description

+

Description

The "cmake" executable is the CMake command-line interface. It may be used to configure projects in scripts. Project configuration settings may be specified on the command line with the -D option. The -i option will cause cmake to interactively prompt for such settings.

CMake is a cross-platform build system generator. Projects specify their build process with platform-independent CMake listfiles included in each directory of a source tree with the name CMakeLists.txt. Users build a project by using CMake to generate a build system for a native tool on their platform.

-

Custom CMake Modules

+

Custom CMake Modules

+
  • AboutTheseModules
  • +
  • BoostTestTargets
  • +
  • BundleOSGPlugins
  • +
  • BundleOSGRuntime
  • +
  • BundleVRJ22Runtime
  • +
  • BundleVRJ30Runtime
  • +
  • CheckMacHIDAPI
  • +
  • CheckVersion
  • +
  • CleanDirectoryList
  • +
  • CleanLibraryList
  • +
  • CopyResourcesToBuildTree
  • +
  • CppcheckTargets
  • +
  • CreateDashboardScripts
  • +
  • CreateImportedTarget
  • +
  • CreateLaunchers
  • +
  • DoxygenTargets
  • +
  • EnableExtraCompilerWarnings
  • +
  • EnableProfiling
  • +
  • FileCopyTargets
  • +
  • FindALUT
  • +
  • FindAdrienne
  • +
  • FindBluez
  • +
  • FindCPPDOM
  • +
  • FindDCubed
  • +
  • FindDirectInput
  • +
  • FindDirectShow
  • +
  • FindDirectX
  • +
  • FindFlagpoll
  • +
  • FindGDB
  • +
  • FindGHOST
  • +
  • FindGLUI
  • +
  • FindGLUT
  • +
  • FindGMTL
  • +
  • FindGPM
  • +
  • FindGadgeteer12
  • +
  • FindGadgeteer20
  • +
  • FindGlove5DT
  • +
  • FindHIDAPI
  • +
  • FindIDLJ
  • +
  • FindInterSense
  • +
  • FindJCCL12
  • +
  • FindJCCL14
  • +
  • FindJtTk
  • +
  • FindLAPACKLibs
  • +
  • FindLibusb1
  • +
  • FindLuabind
  • +
  • FindLyX
  • +
  • FindMacHID
  • +
  • FindMarkdown
  • +
  • FindOpenCV
  • +
  • FindOpenHaptics
  • +
  • FindParasolid
  • +
  • FindPerformer
  • +
  • FindPerlModules
  • +
  • FindQVRPN
  • +
  • FindSonix12
  • +
  • FindSonix14
  • +
  • FindTR1
  • +
  • FindTooN
  • +
  • FindTooNtag
  • +
  • FindTweek12
  • +
  • FindTweek14
  • +
  • FindVPR20
  • +
  • FindVPR22
  • +
  • FindVPS
  • +
  • FindVRJ22
  • +
  • FindVRJ30
  • +
  • FindVRJOGL22
  • +
  • FindVRJOGL30
  • +
  • FindVRJuggler
  • +
  • FindVRJuggler22
  • +
  • FindVRJuggler30
  • +
  • FindVRPN
  • +
  • FindViewPoint
  • +
  • FindVirtuoseAPI
  • +
  • FindVirtuoseVPP
  • +
  • FindWiiSCAAT
  • +
  • FindWiiUse
  • +
  • FindWinHID
  • +
  • FindWindowsSDK
  • +
  • Findargp
  • +
  • Findcppcheck
  • +
  • Findcppunit
  • +
  • Findcutil
  • +
  • Finddb2pdf
  • +
  • FindosgLua
  • +
  • Findquatlib
  • +
  • GetCPUDetails
  • +
  • GetCompilerInfoString
  • +
  • GetDirectoryList
  • +
  • GetFileList
  • +
  • GetForceIncludeDefinitions
  • +
  • GetGitRevisionDescription
  • +
  • GetSubprojectStatus
  • +
  • Licensing
  • +
  • ListCombinations
  • +
  • ListFilter
  • +
  • LuaTargets
  • +
  • MSVCMultipleProcessCompile
  • +
  • MSVCStaticRuntime
  • +
  • MSVCVerboseLinking
  • +
  • OptionRequires
  • +
  • PrefixListGlob
  • +
  • ProgramFilesGlob
  • +
  • ResetConfigurations
  • +
  • SearchProgramFilesForOpenSceneGraph
  • +
  • SetDefaultBuildType
  • +
  • SplitLibraryList
  • +
  • StampSourcesWithVersion
  • +
  • TCHARWorkaround
  • +
  • UseBackportedModules
  • +
  • UseMarkdown
  • +
  • UseTR1
  • +
  • WarningDev
  • +

    The following modules are also available for CMake. They can be used with INCLUDE(ModuleName).

      Custom CMake Modules - Additional Modules for CMake.
    @@ -27,7 +141,7 @@

    Custom CMake Modules

    • - AboutTheseModules: Dummy module containing information about these modules for the HELP file
      + AboutTheseModules: Dummy module containing information about these modules for the HELP file

      This file documents a snapshot of the cmake-modules available from http://github.com/rpavlik/cmake-modules/ The latest version of these modules can always be found there. Additionally, you can find instructions on how to integrate these modules into your own project either in the README.markdown file in this directory, or on the GitHub page listed above (scroll to the bottom to see the README rendered attractively).

      In short: Modules of the form "FindSomeName.cmake" are considered to be "find modules", and are intended to be used indirectly by calling find_package, not by calling include. Thus, you'll want to do something like:

        find_package(SomeName)
      @@ -41,7 +155,7 @@

      Custom CMake Modules

    • - BoostTestTargets: Add tests using boost::test
      + BoostTestTargets: Add tests using boost::test


      Add this line to your test files in place of including a basic boost test header:

        #include <BoostTestTargetConfig.h>
      @@ -60,7 +174,7 @@

      Custom CMake Modules

    • - BundleOSGPlugins: Provide access to the OpenSceneGraph runtime files for bundling in
      + BundleOSGPlugins: Provide access to the OpenSceneGraph runtime files for bundling in

      an installation or package.

      Sets these variables:

        - OSGDB_PLUGINS_RELEASE
      - OSGDB_PLUGINS_DEBUG
      - OSGWRAPPER_PLUGINS_RELEASE
      - OSGWRAPPER_PLUGINS_DEBUG
      - OSG_RUNTIME_LIBRARY_DIR
      - OSG_PATH_TO_PLUGINS
      @@ -76,7 +190,7 @@

      Custom CMake Modules

    • - BundleOSGRuntime: Include the OpenSceneGraph runtime files in an installation or built package.
      + BundleOSGRuntime: Include the OpenSceneGraph runtime files in an installation or built package.


        OSGRUNTIME_BUNDLE - Set to "yes" to enable this behavior
      OSGRUNTIME_zlib1dll - Must be set to the location of zlib1.dll on Windows
      OSGRUNTIME_zlib1ddll - Can be set to the location of zlib1d.dll (debug) on Windows.
      If set, will be installed.


      @@ -88,7 +202,7 @@

      Custom CMake Modules

    • - BundleVRJ22Runtime: Include the VR Juggler runtime files in an installation or built package.
      + BundleVRJ22Runtime: Include the VR Juggler runtime files in an installation or built package.


        VRJUGGLERRUNTIME_BUNDLE
      VRJUGGLERRUNTIME_BUNDLE_DEBUG - set to yes to include debug dll's as well


      @@ -100,7 +214,7 @@

      Custom CMake Modules

    • - BundleVRJ30Runtime: Include the VR Juggler runtime files in an installation or built package.
      + BundleVRJ30Runtime: Include the VR Juggler runtime files in an installation or built package.


        VRJUGGLERRUNTIME_BUNDLE
      VRJUGGLERRUNTIME_BUNDLE_DEBUG - set to yes to include debug dll's as well


      @@ -111,7 +225,7 @@

      Custom CMake Modules

    • - CheckMacHIDAPI: Script to check if the signature for a mac HID callback uses UInt32 or uint32_t
      + CheckMacHIDAPI: Script to check if the signature for a mac HID callback uses UInt32 or uint32_t

      Requires that the associated CPP file be present: CheckMacHIDAPI.cpp.

      MACOSX_HID_UINT32T, set according to the results of our test.

      Use add_definitions(-DMACOSX_HID_UINT32T=${MACOSX_HID_UINT32T}) in your listfile and the following prototype for the function you'd like to register using setInterruptReportHandlerCallback:

      @@ -122,7 +236,7 @@

      Custom CMake Modules

    • - CheckVersion: Utility function for Find modules considering multiple possible versions
      + CheckVersion: Utility function for Find modules considering multiple possible versions


      Requires these CMake modules:

        no additional modules required
      @@ -132,7 +246,7 @@

      Custom CMake Modules

    • - CleanDirectoryList: Removes duplicate entries and non-directories from a provided list
      + CleanDirectoryList: Removes duplicate entries and non-directories from a provided list


        clean_directory_list(<listvar> [<additional list items>...])


      @@ -142,7 +256,7 @@

      Custom CMake Modules

    • - CleanLibraryList: A smarter replacement for list(REMOVE_DUPLICATES) for library lists
      + CleanLibraryList: A smarter replacement for list(REMOVE_DUPLICATES) for library lists


      Note that, in the case of cyclic link dependencies, you _do_ actually need a library in a list multiple times. So, only use this function when you know that the dependency graph is acyclic.

        clean_library_list(<listvar> [<additional list items>...]) - where
      listvar is the name of a destination variable, and also possibly a source, and
      it is followed by any number (including 0) of additional libraries to append
      to the list before processing.
      @@ -154,7 +268,7 @@

      Custom CMake Modules

    • - CopyResourcesToBuildTree: Copy the resources your app needs to the build tree.
      + CopyResourcesToBuildTree: Copy the resources your app needs to the build tree.


        copy_resources_to_build_tree(<target_name>)


      @@ -164,7 +278,7 @@

      Custom CMake Modules

    • - CppcheckTargets: Run cppcheck on c++ source files as a custom target and a test
      + CppcheckTargets: Run cppcheck on c++ source files as a custom target and a test


        include(CppcheckTargets)
      add_cppcheck(<target-name> [UNUSED_FUNCTIONS] [STYLE] [POSSIBLE_ERROR] [FAIL_ON_WARNINGS]) -
      Create a target to check a target's sources with cppcheck and the indicated options
      add_cppcheck_sources(<target-name> [UNUSED_FUNCTIONS] [STYLE] [POSSIBLE_ERROR] [FAIL_ON_WARNINGS]) -
      Create a target to check standalone sources with cppcheck and the indicated options


      @@ -177,7 +291,7 @@

      Custom CMake Modules

    • - CreateDashboardScripts: Create ctest -S scripts to use to run dashboard builds
      + CreateDashboardScripts: Create ctest -S scripts to use to run dashboard builds


        include(CreateDashboardScripts)
      create_dashboard_scripts([<initialcachetemplatefilename>])


      @@ -194,7 +308,7 @@

      Custom CMake Modules

    • - CreateImportedTarget: A smarter replacement for list(REMOVE_DUPLICATES) for library lists
      + CreateImportedTarget: A smarter replacement for list(REMOVE_DUPLICATES) for library lists


        create_imported_target(<libname> [SHARED|STATIC|MODULE] [<library dependency>...]) - where
      ${libname}_LIBRARIES is set to this library's paths.


      @@ -205,7 +319,7 @@

      Custom CMake Modules

    • - CreateLaunchers: Create launchers to set working directory, env. vars, etc.
      + CreateLaunchers: Create launchers to set working directory, env. vars, etc.


        include(CreateLaunchers) - to make these available
      guess_runtime_library_dirs(<outputvarname> [<extralibrary> ...])
      create_default_target_launcher(<targetname>
      [ARGS <args...>]
      [FORWARD_ARGS]
      [RUNTIME_LIBRARY_DIRS <dir...>]
      [WORKING_DIRECTORY <dir>]
      [ENVIRONMENT <VAR=value> [<VAR=value>...]])


      @@ -222,7 +336,7 @@

      Custom CMake Modules

    • - DoxygenTargets: Run doxygen on source files as a custom target
      + DoxygenTargets: Run doxygen on source files as a custom target


        include(DoxygenTargets)
      add_doxygen(<doxyfile> [OUTPUT_DIRECTORY <outputdir>]
      [INSTALL_DESTINATION <installdir>
      [INSTALL_COMPONENT <installcomponent>]
      [INSTALL_PDF_NAME <installpdfname>] ]
      [DOC_TARGET <targetname>]
      [PROJECT_NUMBER <versionnumber>]
      [NO_WARNINGS]
      [NO_PDF])


      @@ -235,7 +349,7 @@

      Custom CMake Modules

    • - EnableExtraCompilerWarnings: Add flags to compile with extra warnings
      + EnableExtraCompilerWarnings: Add flags to compile with extra warnings


        enable_extra_compiler_warnings(<targetname>)
      globally_enable_extra_compiler_warnings() - to modify CMAKE_CXX_FLAGS, etc
      to change for all targets declared after the command, instead of per-command


      @@ -245,7 +359,7 @@

      Custom CMake Modules

    • - EnableProfiling: Add flags to compile with profiling support - currently only for GCC
      + EnableProfiling: Add flags to compile with profiling support - currently only for GCC


        enable_profiling(<targetname>)
      globally_enable_profiling() - to modify CMAKE_CXX_FLAGS, etc
      to change for all targets declared after the command, instead of per-command


      @@ -255,7 +369,7 @@

      Custom CMake Modules

    • - FileCopyTargets: Add a target for files that just need to be copied
      + FileCopyTargets: Add a target for files that just need to be copied


        include(FileCopyTargets)
      add_file_copy_target(<target_name> <directory to copy to> <filename> [<filename>...])
      Creates a custom target that copies the files to a directory, if needed.
      Relative paths for the destination directory are considered with
      with respect to CMAKE_CURRENT_BINARY_DIR
      You can use this target in all the usual ways, including
      add_dependencies(some_other_target this_target) to specify that another
      target depends on this.


      @@ -268,7 +382,7 @@

      Custom CMake Modules

    • - FindALUT: try to find the OpenAL ALUT library
      + FindALUT: try to find the OpenAL ALUT library


      Users may optionally supply:

        ALUT_ROOT_DIR - a prefix to start searching.
      @@ -287,7 +401,7 @@

      Custom CMake Modules

    • - FindAdrienne: try to find Adrienne Electronics Corporation timecode card library
      + FindAdrienne: try to find Adrienne Electronics Corporation timecode card library


      SDK available from the manufacturer: http://www.adrielec.com/

      Cache Variables: (probably not for direct use in your scripts)

      @@ -313,7 +427,7 @@

      Custom CMake Modules

    • - FindBluez: try to find Bluez
      + FindBluez: try to find Bluez


      Cache Variables: (probably not for direct use in your scripts)

        BLUEZ_INCLUDE_DIR
      BLUEZ_LIBRARY
      @@ -329,7 +443,7 @@

      Custom CMake Modules

    • - FindCPPDOM: try to find CPPDOM library
      + FindCPPDOM: try to find CPPDOM library

      Optionally uses Flagpoll and FindFlagpoll.cmake

        CPPDOM_LIBRARY_DIR, library search path
      CPPDOM_INCLUDE_DIR, include search path
      CPPDOM_LIBRARY, the library to link against
      CPPDOM_CXX_FLAGS
      CPPDOM_FOUND, If false, do not try to use this library.


      @@ -343,7 +457,7 @@

      Custom CMake Modules

    • - FindDCubed: try to find DCUBED library
      + FindDCubed: try to find DCUBED library


        DCUBED_LIBRARY_DIR, library search path
      DCUBED_INCLUDE_DIR, include search path
      DCUBED_{component}_LIBRARY, the library to link against
      DCUBED_ENVIRONMENT
      DCUBED_FOUND, If false, do not try to use this library.


      @@ -356,7 +470,7 @@

      Custom CMake Modules

    • - FindDirectInput: try to find DirectInput library (part of DirectX SDK)
      + FindDirectInput: try to find DirectInput library (part of DirectX SDK)


      Cache Variables: (probably not for direct use in your scripts)

        DIRECTINPUT_DXGUID_LIBRARY
      DIRECTINPUT_DXERR_LIBRARY
      DIRECTINPUT_DINPUT_LIBRARY
      DIRECTINPUT_INCLUDE_DIR
      @@ -372,7 +486,7 @@

      Custom CMake Modules

    • - FindDirectShow: Find Microsoft DirectShow sample files, library, and headers.
      + FindDirectShow: Find Microsoft DirectShow sample files, library, and headers.


        DIRECTSHOW_INCLUDE_DIRS - where to find needed include file
      DIRECTSHOW_BASECLASS_DIR- Directory containing the DirectShow baseclass sample code.
      DIRECTSHOW_FOUND - True if DirectShow found.


      @@ -385,7 +499,7 @@

      Custom CMake Modules

    • - FindDirectX: try to find part of DirectX SDK
      + FindDirectX: try to find part of DirectX SDK


      Cache Variables: (probably not for direct use in your scripts)

        DIRECTX_INCLUDE_DIR
      @@ -401,7 +515,7 @@

      Custom CMake Modules

    • - FindFlagpoll: try to find Flagpoll application, and offer package-finding services
      + FindFlagpoll: try to find Flagpoll application, and offer package-finding services
        FLAGPOLL, the executable: if not defined, do not try to use Flagpoll.


      Useful configuration variables you might want to add to your cache:

      @@ -419,7 +533,7 @@

      Custom CMake Modules

    • - FindGDB: Try to find GDB
      + FindGDB: Try to find GDB


      Once done, this will define:

        GDB_FOUND - system has GDB
      GDB_COMMAND - the command to run
      GDB_VERSION - version
      GDB_HAS_RETURN_CHILD_RESULT - if the --return-child-result flag is supported
      @@ -432,7 +546,7 @@

      Custom CMake Modules

    • - FindGHOST: try to find Sensable GHOST library and include files
      + FindGHOST: try to find Sensable GHOST library and include files
        GHOST_INCLUDE_DIRS, where to find GL/glut.h, etc.
      GHOST_LIBRARIES, the libraries to link against
      GHOST_FOUND, If false, do not try to use GLUT.
      GHOST_RUNTIME_LIBRARY_DIRS, path to DLL on Windows for runtime use.


      Requires these CMake modules:

      @@ -443,7 +557,7 @@

      Custom CMake Modules

    • - FindGLUI: Try to find GLUI (GL User Interface)
      + FindGLUI: Try to find GLUI (GL User Interface)

      Requires OpenGL and GLUT - searches for them using find_package Once done, this will define

      GLUI_INCLUDE_DIR, where to find GL/glui.h (or GLUI/glui.h on mac) GLUI_LIBRARY, the libraries to link against GLUI_FOUND, If false, do not try to use GLUI.

      Plural versions refer to this library and its dependencies, and are recommended to be used instead, unless you have a good reason.

      @@ -455,7 +569,7 @@

      Custom CMake Modules

    • - FindGLUT: try to find glut library and include files
      + FindGLUT: try to find glut library and include files
        GLUT_INCLUDE_DIRS, where to find GL/glut.h, etc.
      GLUT_LIBRARIES, the libraries to link against
      GLUT_FOUND, If false, do not try to use GLUT.
      GLUT_RUNTIME_LIBRARY_DIRS, path to DLL on Windows for runtime use.
      GLUT_RUNTIME_LIBRARY, dll on Windows, for installation purposes


      Also defined, but not for general use are:

      @@ -463,7 +577,7 @@

      Custom CMake Modules

    • - FindGMTL: Try to find GMTL
      + FindGMTL: Try to find GMTL

      Optionally uses Flagpoll and FindFlagpoll.cmake Once done, this will define

        GMTL_FOUND - system has GMTL
      GMTL_INCLUDE_DIR - the GMTL include directory


      @@ -477,7 +591,7 @@

      Custom CMake Modules

    • - FindGPM: try to find GPM library
      + FindGPM: try to find GPM library


      Cache Variables: (probably not for direct use in your scripts)

        GPM_INCLUDE_DIR
      GPM_LIBRARY
      @@ -493,7 +607,7 @@

      Custom CMake Modules

    • - FindGadgeteer12: try to find Gadgeteer 1.2 library
      + FindGadgeteer12: try to find Gadgeteer 1.2 library

      Requires JCCL 1.2 and VPR 2.0 (thus FindJCCL12.cmake and FindVPR20.cmake) Requires X11 if not on Mac or Windows. Optionally uses Flagpoll and FindFlagpoll.cmake

      This library is a part of VR Juggler 2.2 - you probably want to use find_package(VRJuggler22) instead, for an easy interface to this and related scripts. See FindVRJuggler22.cmake for more information.

        GADGETEER12_LIBRARY_DIR, library search path
      GADGETEER12_INCLUDE_DIR, include search path
      GADGETEER12_LIBRARY, the library to link against
      GADGETEER12_FOUND, If false, do not try to use this library.
      @@ -509,7 +623,7 @@

      Custom CMake Modules

    • - FindGadgeteer20: try to find Gadgeteer 2.0 library
      + FindGadgeteer20: try to find Gadgeteer 2.0 library

      Requires JCCL 1.4 and VPR 2.2 (thus FindJCCL14.cmake and FindVPR22.cmake) Requires X11 if not on Mac or Windows. Optionally uses Flagpoll and FindFlagpoll.cmake

      This library is a part of VR Juggler 3.0 - you probably want to use find_package(VRJuggler30) instead, for an easy interface to this and related scripts. See FindVRJuggler30.cmake for more information.

        GADGETEER20_LIBRARY_DIR, library search path
      GADGETEER20_INCLUDE_DIR, include search path
      GADGETEER20_LIBRARY, the library to link against
      GADGETEER20_FOUND, If false, do not try to use this library.
      @@ -524,7 +638,7 @@

      Custom CMake Modules

    • - FindGlove5DT: try to find Glove5DT libraries
      + FindGlove5DT: try to find Glove5DT libraries


      Cache Variables: (probably not for direct use in your scripts)

        GLOVE5DT_INCLUDE_DIR
      GLOVE5DT_LIBRARY
      GLOVE5DT_LIBRARY_RELEASE
      GLOVE5DT_LIBRARY_DEBUG
      GLOVE5DT_RUNTIME_LIBRARY_RELEASE
      GLOVE5DT_RUNTIME_LIBRARY_DEBUG
      @@ -540,7 +654,7 @@

      Custom CMake Modules

    • - FindHIDAPI: try to find HIDAPI library
      + FindHIDAPI: try to find HIDAPI library

      from http://www.signal11.us/oss/hidapi/

      Cache Variables: (probably not for direct use in your scripts)

        HIDAPI_INCLUDE_DIR
      HIDAPI_LIBRARY
      @@ -556,7 +670,7 @@

      Custom CMake Modules

    • - FindIDLJ: try to find Java's IDLJ Interface Definition Language compiler.
      + FindIDLJ: try to find Java's IDLJ Interface Definition Language compiler.


      Ideally used with CMake 2.8.5 or newer for Java support using FindJava.cmake and UseJava.cmake

      Variables:

      @@ -573,7 +687,25 @@

      Custom CMake Modules

    • - FindJCCL12: try to find JCCL 1.2 library
      + FindInterSense: try to find InterSense library
      +


      +

      Cache Variables: (probably not for direct use in your scripts)

      +
        INTERSENSE_INCLUDE_DIR
      INTERSENSE_ISENSEC_DIR - location of the isense.c "import library" substitute.
      INTERSENSE_LIBRARY
      +


      +

      Non-cache variables you might use in your CMakeLists.txt:

      +
        INTERSENSE_FOUND
      INTERSENSE_INCLUDE_DIRS
      INTERSENSE_LIBRARIES
      +


      +

      Requires these CMake modules:

      +
        FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
      +


      +

      Author: 2013 Eric Marsh <bits@wemarsh.com> http://wemarsh.com/ Kognitiv Neuroinformatik, Universität Bremen

      +

      (building on Ryan Pavlik's templates)

      +

      2013 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC

      +

      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)

      + +
    • +
    • + FindJCCL12: try to find JCCL 1.2 library

      Requires VPR 2.0 (thus FindVPR20.cmake) Optionally uses Flagpoll and FindFlagpoll.cmake

      This library is a part of VR Juggler 2.2 - you probably want to use find_package(VRJuggler22) instead, for an easy interface to this and related scripts. See FindVRJuggler22.cmake for more information.

        JCCL12_LIBRARY_DIR, library search path
      JCCL12_INCLUDE_DIR, include search path
      JCCL12_LIBRARY, the library to link against
      JCCL12_FOUND, If false, do not try to use this library.
      @@ -589,7 +721,7 @@

      Custom CMake Modules

    • - FindJCCL14: try to find JCCL 1.4 library
      + FindJCCL14: try to find JCCL 1.4 library

      Requires VPR 2.2 (thus FindVPR22.cmake) Optionally uses Flagpoll and FindFlagpoll.cmake

      This library is a part of VR Juggler 3.0 - you probably want to use find_package(VRJuggler30) instead, for an easy interface to this and related scripts. See FindVRJuggler30.cmake for more information.

        JCCL14_LIBRARY_DIR, library search path
      JCCL14_INCLUDE_DIR, include search path
      JCCL14_LIBRARY, the library to link against
      JCCL14_FOUND, If false, do not try to use this library.
      @@ -604,7 +736,7 @@

      Custom CMake Modules

    • - FindJtTk: try to find JTTK library
      + FindJtTk: try to find JTTK library


        JTTK_LIBRARY_DIRS, library search path
      JTTK_INCLUDE_DIRS, include search path
      JTTK_{component}_LIBRARY, the library to link against
      JTTK_ENVIRONMENT, environment variables to set
      JTTK_RUNTIME_LIBRARY_DIRS
      JTTK_FOUND, If false, do not try to use this library.


      @@ -620,7 +752,7 @@

      Custom CMake Modules

    • - FindLAPACKLibs: Try to find LAPACK and BLAS libraries
      + FindLAPACKLibs: Try to find LAPACK and BLAS libraries

      Once done, this will define

        LAPACKLIBS_LIBRARIES, all libraries to link against
      LAPACKLIBS_FOUND, If false, do not try to use LAPACK library features.


      @@ -632,7 +764,7 @@

      Custom CMake Modules

    • - FindLibusb1: try to find libusb-1 library
      + FindLibusb1: try to find libusb-1 library


      Cache Variables: (probably not for direct use in your scripts)

        LIBUSB1_LIBRARY
      LIBUSB1_INCLUDE_DIR
      @@ -648,7 +780,7 @@

      Custom CMake Modules

    • - FindLuabind: try to find Luabind
      + FindLuabind: try to find Luabind


      Users may optionally supply:

        LUABIND_ROOT_DIR - a prefix to start searching
      @@ -664,7 +796,7 @@

      Custom CMake Modules

    • - FindLyX: Try to find LyX, and define some custom commands to export from LyX
      + FindLyX: Try to find LyX, and define some custom commands to export from LyX


      Once done, this will define:

        LYX_FOUND - system has LyX
      LYX_COMMAND - the command to run
      @@ -686,7 +818,7 @@

      Custom CMake Modules

    • - FindMacHID: try to find Mac HID frameworks
      + FindMacHID: try to find Mac HID frameworks


      Cache Variables: (probably not for direct use in your scripts)

        MACHID_CoreFoundation_LIBRARY
      MACHID_CoreFoundation_INCLUDE_DIR
      MACHID_IOKit_LIBRARY
      MACHID_IOKit_INCLUDE_DIR
      MACOSX_HID_UINT32T (from CheckMacHIDAPI)
      @@ -702,7 +834,7 @@

      Custom CMake Modules

    • - FindMarkdown: try to find Markdown tool
      + FindMarkdown: try to find Markdown tool


      Cache Variables:

        MARKDOWN_EXECUTABLE
      @@ -718,7 +850,7 @@

      Custom CMake Modules

    • - FindOpenCV: ------------------------------
      + FindOpenCV: ------------------------------

      See http://sourceforge.net/projects/opencvlibrary/

      The following variable is optionally searched for defaults

        OPENCV_ROOT_DIR:            Base directory of OpenCv tree to use.
      @@ -735,7 +867,7 @@

      Custom CMake Modules

    • - FindOpenHaptics: try to find OpenHaptics libraries
      + FindOpenHaptics: try to find OpenHaptics libraries


      Cache Variables: (probably not for direct use in your scripts)

        HDAPI_INCLUDE_DIR
      HDAPI_LIBRARY
      HDAPI_LIBRARY_RELEASE
      HDAPI_LIBRARY_DEBUG
      HDAPI_HDU_INCLUDE_DIR
      HDAPI_HDU_LIBRARY
      HDAPI_HDU_LIBRARY_RELEASE
      HDAPI_HDU_LIBRARY_DEBUG
      HLAPI_INCLUDE_DIR
      HLAPI_LIBRARY
      HLAPI_LIBRARY_RELEASE
      HLAPI_LIBRARY_DEBUG
      HLAPI_HLU_INCLUDE_DIR
      HLAPI_HLU_LIBRARY
      HLAPI_HLU_LIBRARY_RELEASE
      HLAPI_HLU_LIBRARY_DEBUG
      @@ -751,7 +883,7 @@

      Custom CMake Modules

    • - FindParasolid: try to find PARASOLID library
      + FindParasolid: try to find PARASOLID library

      Important note: If you are also using JtTk, do your

        find_package(JtTk)

      first, to avoid runtime PK_* errors!

      @@ -766,7 +898,7 @@

      Custom CMake Modules

    • - FindPerformer: try to find the OpenGL Performer library
      + FindPerformer: try to find the OpenGL Performer library


      Users may optionally supply:

        PERFORMER_ROOT_DIR - a prefix to start searching.
      @@ -785,7 +917,7 @@

      Custom CMake Modules

    • - FindPerlModules: try to find perl modules, passed as COMPONENTS
      + FindPerlModules: try to find perl modules, passed as COMPONENTS


      Non-cache variable you might use in your CMakeLists.txt:

        PERLMODULES_FOUND
      @@ -798,7 +930,7 @@

      Custom CMake Modules

    • - FindQVRPN: try to find QVRPN library
      + FindQVRPN: try to find QVRPN library


      Of course, you may also just choose to make QVRPN a submodule of your project itself.

      Cache Variables:

      @@ -817,7 +949,7 @@

      Custom CMake Modules

    • - FindSonix12: try to find Sonix 1.2 library
      + FindSonix12: try to find Sonix 1.2 library

      Requires VPR 2.0 and GMTL (thus FindVPR20.cmake and FindGMTL.cmake) Optionally uses Flagpoll and FindFlagpoll.cmake

      This library is a part of VR Juggler 2.2 - you probably want to use find_package(VRJuggler22) instead, for an easy interface to this and related scripts. See FindVRJuggler22.cmake for more information.

        SONIX12_LIBRARY_DIR, library search path
      SONIX12_INCLUDE_DIR, include search path
      SONIX12_LIBRARY, the library to link against
      SONIX12_FOUND, If false, do not try to use this library.
      @@ -833,7 +965,7 @@

      Custom CMake Modules

    • - FindSonix14: try to find Sonix 1.4 library
      + FindSonix14: try to find Sonix 1.4 library

      Requires VPR 2.2 and GMTL (thus FindVPR22.cmake and FindGMTL.cmake) Optionally uses Flagpoll and FindFlagpoll.cmake

      This library is a part of VR Juggler 3.0 - you probably want to use find_package(VRJuggler30) instead, for an easy interface to this and related scripts. See FindVRJuggler30.cmake for more information.

        SONIX14_LIBRARY_DIR, library search path
      SONIX14_INCLUDE_DIR, include search path
      SONIX14_LIBRARY, the library to link against
      SONIX14_FOUND, If false, do not try to use this library.
      @@ -848,7 +980,7 @@

      Custom CMake Modules

    • - FindTR1: Try to find C++ TR1 headers and libraries
      + FindTR1: Try to find C++ TR1 headers and libraries

      Once done, this will define

        TR1_USE_FILE, which you may "include" in your CMake file to be able
      to use TR1 features transparently
      TR1_INCLUDE_DIRS, any directories needed to access TR1 headers
      TR1_LIBRARY_DIRS, any directories needed to access (auto-link) TR1 libraries
      TR1_FOUND, If false, do not try to use TR1 features.


      @@ -858,7 +990,7 @@

      Custom CMake Modules

    • - FindTooN: try to find TooN headers
      + FindTooN: try to find TooN headers


      Users may optionally supply:

        TOON_ROOT_DIR - a prefix to start searching for the toon headers.
      @@ -877,7 +1009,7 @@

      Custom CMake Modules

    • - FindTooNtag: try to find tag algorithm library (built on TooN)
      + FindTooNtag: try to find tag algorithm library (built on TooN)


      Users may optionally supply:

        TAG_ROOT_DIR - a prefix to start searching for the toon headers.
      @@ -896,7 +1028,7 @@

      Custom CMake Modules

    • - FindTweek12: try to find Tweek 1.2 library
      + FindTweek12: try to find Tweek 1.2 library

      Requires VPR 2.0 (thus FindVPR20.cmake) Optionally uses Flagpoll and FindFlagpoll.cmake

      This library is a part of VR Juggler 2.2 - you probably want to use find_package(VRJuggler22) instead, for an easy interface to this and related scripts. See FindVRJuggler22.cmake for more information.

        TWEEK12_LIBRARY_DIR, library search path
      TWEEK12_INCLUDE_DIR, include search path
      TWEEK12_LIBRARY, the library to link against
      TWEEK12_FOUND, If false, do not try to use this library.
      @@ -912,7 +1044,7 @@

      Custom CMake Modules

    • - FindTweek14: try to find Tweek 1.4 library
      + FindTweek14: try to find Tweek 1.4 library

      Requires VPR 2.2 (thus FindVPR22.cmake) Optionally uses Flagpoll and FindFlagpoll.cmake

      This library is a part of VR Juggler 3.0 - you probably want to use find_package(VRJuggler30) instead, for an easy interface to this and related scripts. See FindVRJuggler30.cmake for more information.

        TWEEK14_LIBRARY_DIR, library search path
      TWEEK14_INCLUDE_DIR, include search path
      TWEEK14_LIBRARY, the library to link against
      TWEEK14_FOUND, If false, do not try to use this library.
      @@ -927,7 +1059,7 @@

      Custom CMake Modules

    • - FindVPR20: try to find VPR 2.0 library
      + FindVPR20: try to find VPR 2.0 library

      Requires Boost 1.33.1 or greater (including filesystem and signals libraries) (and thus FindBoost.cmake from 2.8rc3 or newer, preferably) Requires NSPR4 (and PLC4) on Windows Requires pthreads on Unix (Mac or Linux) Requires libuuid on Linux Optionally uses Flagpoll and FindFlagpoll.cmake

      This library is a part of VR Juggler 2.2 - you probably want to use find_package(VRJuggler22) instead, for an easy interface to this and related scripts. See FindVRJuggler22.cmake for more information.

        VPR20_LIBRARY_DIR, library search path
      VPR20_INCLUDE_DIR, include search path
      VPR20_LIBRARY, the library to link against
      VPR20_FOUND, If false, do not try to use this library.
      @@ -943,7 +1075,7 @@

      Custom CMake Modules

    • - FindVPR22: try to find VPR 2.2 library
      + FindVPR22: try to find VPR 2.2 library

      Requires Boost 1.33.1 or greater (including filesystem and signals libraries) (and thus FindBoost.cmake from 2.8rc3 or newer, preferably) Requires NSPR4 (and PLC4) on Windows Requires pthreads on Unix (Mac or Linux) Requires libuuid on Linux Optionally uses Flagpoll and FindFlagpoll.cmake

      This library is a part of VR Juggler 3.0 - you probably want to use find_package(VRJuggler30) instead, for an easy interface to this and related scripts. See FindVRJuggler30.cmake for more information.

        VPR22_LIBRARY_DIR, library search path
      VPR22_INCLUDE_DIR, include search path
      VPR22_LIBRARY, the library to link against
      VPR22_FOUND, If false, do not try to use this library.
      @@ -958,7 +1090,7 @@

      Custom CMake Modules

    • - FindVPS: try to find VPS library
      + FindVPS: try to find VPS library


        VPS_LIBRARY_DIR, library search path
      VPS_INCLUDE_DIR, include search path
      VPS_{component}_LIBRARY, the library to link against
      VPS_FOUND, If false, do not try to use this library.


      @@ -971,7 +1103,7 @@

      Custom CMake Modules

    • - FindVRJ22: try to find VR Juggler 2.2 core library
      + FindVRJ22: try to find VR Juggler 2.2 core library

      Requires JCCL 1.2, Gadgeteer 1.2, VPR 2.0, and Sonix 1.2 (thus FindJCCL12.cmake, FindGadgeteer12.cmake, FindVPR20.cmake, and FindSonix12.cmake) Requires X11 if not on Mac or Windows. Optionally uses Flagpoll and FindFlagpoll.cmake

      This library is a part of VR Juggler 2.2 - you probably want to use find_package(VRJuggler22) instead, for an easy interface to this and related scripts. See FindVRJuggler22.cmake for more information.

        VRJ22_LIBRARY_DIR, library search path
      VRJ22_INCLUDE_DIR, include search path
      VRJ22_LIBRARY, the library to link against
      VRJ22_FOUND, If false, do not try to use this library.
      @@ -987,7 +1119,7 @@

      Custom CMake Modules

    • - FindVRJ30: try to find VR Juggler 3.0 core library
      + FindVRJ30: try to find VR Juggler 3.0 core library

      Requires JCCL 1.4, Gadgeteer 1.4, VPR 2.2, and Sonix 1.4 (thus FindJCCL14.cmake, FindGadgeteer20.cmake, FindVPR22.cmake, and FindSonix14.cmake) Requires X11 if not on Mac or Windows. Optionally uses Flagpoll and FindFlagpoll.cmake

      This library is a part of VR Juggler 3.0 - you probably want to use find_package(VRJuggler30) instead, for an easy interface to this and related scripts. See FindVRJuggler30.cmake for more information.

        VRJ30_LIBRARY_DIR, library search path
      VRJ30_INCLUDE_DIR, include search path
      VRJ30_LIBRARY, the library to link against
      VRJ30_FOUND, If false, do not try to use this library.
      @@ -1003,7 +1135,7 @@

      Custom CMake Modules

    • - FindVRJOGL22: try to find VRJuggler 2.2 OpenGL library
      + FindVRJOGL22: try to find VRJuggler 2.2 OpenGL library

      Requires VRJ core 2.2 (thus FindVRJ22.cmake) Requires OpenGL. Optionally uses Flagpoll and FindFlagpoll.cmake

      This library is a part of VR Juggler 2.2 - you probably want to use find_package(VRJuggler22) instead, for an easy interface to this and related scripts. See FindVRJuggler22.cmake for more information.

        VRJOGL22_LIBRARY_DIR, library search path
      VRJOGL22_INCLUDE_DIRS, include search path for dependencies
      VRJOGL22_LIBRARY, the library to link against
      VRJOGL22_FOUND, If false, do not try to use this library.
      @@ -1019,7 +1151,7 @@

      Custom CMake Modules

    • - FindVRJOGL30: try to find VRJuggler 3.0 OpenGL library
      + FindVRJOGL30: try to find VRJuggler 3.0 OpenGL library

      Requires VRJ core 3.0 (thus FindVRJ30.cmake) Requires OpenGL. Optionally uses Flagpoll and FindFlagpoll.cmake

      This library is a part of VR Juggler 3.0 - you probably want to use find_package(VRJuggler30) instead, for an easy interface to this and related scripts. See FindVRJuggler30.cmake for more information.

        VRJOGL30_LIBRARY_DIR, library search path
      VRJOGL30_INCLUDE_DIRS, include search path for dependencies
      VRJOGL30_LIBRARY, the library to link against
      VRJOGL30_FOUND, If false, do not try to use this library.
      @@ -1034,7 +1166,7 @@

      Custom CMake Modules

    • - FindVRJuggler: try to find VR Juggler-related packages (combined finder)
      + FindVRJuggler: try to find VR Juggler-related packages (combined finder)
        VRJUGGLER_INCLUDE_DIRS, include search paths
      VRJUGGLER_LIBRARIES, the libraries to link against
      VRJUGGLER_ENVIRONMENT
      VRJUGGLER_RUNTIME_LIBRARY_DIRS
      VRJUGGLER_CXX_FLAGS
      VRJUGGLER_DEFINITIONS
      VRJUGGLER_FOUND, If false, do not try to use VR Juggler.


      Components available to search for (uses "VRJOGL" by default):

      @@ -1058,7 +1190,7 @@

      Custom CMake Modules

    • - FindVRJuggler22: try to find VRJuggler 2.2-related packages (main finder)
      + FindVRJuggler22: try to find VRJuggler 2.2-related packages (main finder)
        VRJUGGLER22_LIBRARY_DIRS, library search paths
      VRJUGGLER22_INCLUDE_DIRS, include search paths
      VRJUGGLER22_LIBRARIES, the libraries to link against
      VRJUGGLER22_ENVIRONMENT
      VRJUGGLER22_RUNTIME_LIBRARY_DIRS
      VRJUGGLER22_CXX_FLAGS
      VRJUGGLER22_DEFINITIONS
      VRJUGGLER22_FOUND, If false, do not try to use VR Juggler 2.2.


      Components available to search for (uses "VRJOGL22" by default):

      @@ -1082,7 +1214,7 @@

      Custom CMake Modules

    • - FindVRJuggler30: try to find VRJuggler 3.0-related packages (main finder)
      + FindVRJuggler30: try to find VRJuggler 3.0-related packages (main finder)
        VRJUGGLER30_LIBRARY_DIRS, library search paths
      VRJUGGLER30_INCLUDE_DIRS, include search paths
      VRJUGGLER30_LIBRARIES, the libraries to link against
      VRJUGGLER30_ENVIRONMENT
      VRJUGGLER30_RUNTIME_LIBRARY_DIRS
      VRJUGGLER30_CXX_FLAGS
      VRJUGGLER30_DEFINITIONS
      VRJUGGLER30_FOUND, If false, do not try to use VR Juggler 3.0.


      Components available to search for (uses "VRJOGL30" by default):

      @@ -1106,7 +1238,7 @@

      Custom CMake Modules

    • - FindVRPN: try to find VRPN library
      + FindVRPN: try to find VRPN library


      Cache Variables:

        VRPN_LIBRARY
      VRPN_SERVER_LIBRARY
      VRPN_INCLUDE_DIR
      @@ -1123,7 +1255,7 @@

      Custom CMake Modules

    • - FindViewPoint: try to find Arrington Research ViewPoint EyeTracker SDK
      + FindViewPoint: 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
      @@ -1139,20 +1271,20 @@

      Custom CMake Modules

    • - FindVirtuoseAPI: try to find Haption VirtuoseAPI library and include files
      + FindVirtuoseAPI: try to find Haption VirtuoseAPI library and include files


        VIRTUOSEAPI_INCLUDE_DIRS, where to find headers
      VIRTUOSEAPI_LIBRARIES, the libraries to link against
      VIRTUOSEAPI_FOUND, If false, do not try to use this library
      VIRTUOSEAPI_RUNTIME_LIBRARY_DIRS, path to DLL/SO for runtime use.
      VIRTUOSEAPI_RUNTIME_LIBRARIES, runtime libraries you might want to install
    • - FindVirtuoseVPP: try to find Haption VirtuoseAPI C++ wrapper include files
      + FindVirtuoseVPP: try to find Haption VirtuoseAPI C++ wrapper include files


      Use of this header depends on the VirtuoseAPI, so we search for that too.

        VIRTUOSEVPP_INCLUDE_DIRS, where to find headers
      VIRTUOSEVPP_LIBRARIES, the libraries to link against
      VIRTUOSEVPP_FOUND, If false, do not try to use this library
      VIRTUOSEVPP_RUNTIME_LIBRARY_DIRS, path to DLL/SO for runtime use.
      VIRTUOSEAPI_RUNTIME_LIBRARIES, runtime libraries you might want to install
    • - FindWiiSCAAT: try to find the Wii SCAAT library
      + FindWiiSCAAT: try to find the Wii SCAAT library


      Users may optionally supply:

        WIISCAAT_ROOT_DIR - a prefix to start searching for the headers.
      @@ -1171,7 +1303,7 @@

      Custom CMake Modules

    • - FindWiiUse: try to find WiiUse library
      + FindWiiUse: try to find WiiUse library


      Cache Variables: (probably not for direct use in your scripts)

        WIIUSE_INCLUDE_DIR
      WIIUSE_LIBRARY
      @@ -1187,7 +1319,7 @@

      Custom CMake Modules

    • - FindWinHID: try to find Windows HID support, part of the WDK/DDK
      + FindWinHID: 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
      @@ -1203,7 +1335,7 @@

      Custom CMake Modules

    • - FindWindowsSDK: Find the Windows SDK aka Platform SDK
      + FindWindowsSDK: Find the Windows SDK aka Platform 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
      @@ -1221,7 +1353,7 @@

      Custom CMake Modules

    • - Findargp: try to find the argp library/component of glibc
      + Findargp: try to find the argp library/component of glibc


      Users may optionally supply:

        ARGP_ROOT_DIR - a prefix to start searching.
      @@ -1240,7 +1372,7 @@

      Custom CMake Modules

    • - Findcppcheck: try to find cppcheck tool
      + Findcppcheck: try to find cppcheck tool


      Cache Variables:

        CPPCHECK_EXECUTABLE
      @@ -1256,7 +1388,7 @@

      Custom CMake Modules

    • - Findcppunit: try to find cppunit library
      + Findcppunit: try to find cppunit library


      Cache Variables: (probably not for direct use in your scripts)

        CPPUNIT_INCLUDE_DIR
      CPPUNIT_LIBRARY
      @@ -1272,7 +1404,7 @@

      Custom CMake Modules

    • - Findcutil: find NVIDIA CUDA and source for the cutil library, building cutil if needed.
      + Findcutil: find NVIDIA CUDA and source for the cutil library, building cutil if needed.


        CUTIL_LIBRARIES - Libraries to link against to use CUTIL
      CUTIL_INCLUDE_DIRS - Include directories to add before building a CUTIL app.


      @@ -1284,7 +1416,7 @@

      Custom CMake Modules

    • - Finddb2pdf: Try to find db2pdf, and define a custom command to turn docbook into pdf
      + Finddb2pdf: Try to find db2pdf, and define a custom command to turn docbook into pdf


      Once done, this will define:

        DB2PDF_FOUND - system has LyX
      DB2PDF_COMMAND - the command to run
      @@ -1300,7 +1432,7 @@

      Custom CMake Modules

    • - FindosgLua: try to find osgLua
      + FindosgLua: try to find osgLua


      Users may optionally supply:

        OSGLUA_ROOT_DIR - a prefix to start searching
      @@ -1316,7 +1448,7 @@

      Custom CMake Modules

    • - Findquatlib: Find quatlib
      + Findquatlib: 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.


      @@ -1325,9 +1457,9 @@

      Custom CMake Modules

    • - GetCPUDetails: Set a number of variables to indicate things about the current CPU and OS
      + GetCPUDetails: Set a number of variables to indicate things about the current CPU and OS


      -
        CPU_INTEL
      CPU_EXE_64BIT
      CPU_EXE_32BIT
      CPU_HAS_SSE
      CPU_HAS_SSE2
      CPU_HAS_SSE3
      CPU_HAS_SSSE3
      CPU_HAS_SSE4_1
      CPU_HAS_SSE4_2
      +
        CPU_COUNT
      CPU_INTEL
      CPU_EXE_64BIT
      CPU_EXE_32BIT
      CPU_HAS_SSE
      CPU_HAS_SSE2
      CPU_HAS_SSE3
      CPU_HAS_SSSE3
      CPU_HAS_SSE4_1
      CPU_HAS_SSE4_2


      Requires these CMake modules:

        no additional modules required
      @@ -1337,7 +1469,7 @@

      Custom CMake Modules

    • - GetCompilerInfoString: Utility function to return a human-useful-only string ID'ing the compiler
      + GetCompilerInfoString: Utility function to return a human-useful-only string ID'ing the compiler


        get_compiler_info_string(<resultvar>)


      @@ -1369,7 +1501,7 @@

      Custom CMake Modules

    • - GetDirectoryList: Returns a list of the parent directories of all files passed
      + GetDirectoryList: Returns a list of the parent directories of all files passed


        get_directory_list(<listvar> <file path> [<additional file paths>...])


      @@ -1379,7 +1511,7 @@

      Custom CMake Modules

    • - GetFileList: Returns a list of the file names of all files passed
      + GetFileList: Returns a list of the file names of all files passed


        get_file_list(<listvar> <file path> [<additional file paths>...])


      @@ -1389,7 +1521,7 @@

      Custom CMake Modules

    • - GetForceIncludeDefinitions: Get the platform-appropriate flags to add to force inclusion of a file
      + GetForceIncludeDefinitions: Get the platform-appropriate flags to add to force inclusion of a file


      The most common use of this is to use a generated config.h-type file placed out of the source tree in all files.

        get_force_include_definitions(var forcedincludefiles...) -
      where var is the name of your desired output variable, and everything
      else is a source file to forcibly include.
      a list item to be filtered.
      @@ -1399,7 +1531,7 @@

      Custom CMake Modules

    • - GetGitRevisionDescription: Returns a version string from Git
      + GetGitRevisionDescription: 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> ...])
      @@ -1417,7 +1549,7 @@

      Custom CMake Modules

    • - GetSubprojectStatus: Returns whether the current project is on its own or within another project's build
      + GetSubprojectStatus: Returns whether the current project is on its own or within another project's build


        get_subproject_status(<resultvar>) - resultvar will be YES if we are
      included in another project, or NO if we are being built separately


      @@ -1427,14 +1559,14 @@

      Custom CMake Modules

    • - Licensing: Building a licensing description file
      + Licensing: Building a licensing description file


      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)

    • - ListCombinations: Combine lists of prefixes and suffixes in all combinations
      + ListCombinations: 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.


      @@ -1443,7 +1575,7 @@

      Custom CMake Modules

    • - ListFilter: List filtering functions
      + ListFilter: List filtering functions


        list_filter(var regex listitems...) - where var is the name of
      your desired output variable, regex is the regex whose matching items
      WILL be put in the output variable, and everything else is considered
      a list item to be filtered.


      @@ -1454,7 +1586,7 @@

      Custom CMake Modules

    • - LuaTargets: Copy/parse lua source files as a custom target
      + LuaTargets: Copy/parse lua source files as a custom target


        include(LuaTargets)
      add_lua_target(<target_name> <directory to copy to> [<luafile> <luafile>])
      Relative paths for the destination directory are considered with
      with respect to CMAKE_CURRENT_BINARY_DIR


      @@ -1469,7 +1601,7 @@

      Custom CMake Modules

    • - MSVCMultipleProcessCompile: Compile with multiple processes on MSVC
      + MSVCMultipleProcessCompile: Compile with multiple processes on MSVC


        include(MSVCMultipleProcessCompile)


      @@ -1481,7 +1613,7 @@

      Custom CMake Modules

    • - MSVCStaticRuntime: Modify compile flags to use the static runtimes of MSVC
      + MSVCStaticRuntime: Modify compile flags to use the static runtimes of MSVC


        include(MSVCStaticRuntime)


      @@ -1493,7 +1625,7 @@

      Custom CMake Modules

    • - MSVCVerboseLinking: Add appropriate linker flags to show link details on Visual Studio
      + MSVCVerboseLinking: Add appropriate linker flags to show link details on Visual Studio


        include(MSVCVerboseLinking) - to add the flags automaticlly if applicable


      @@ -1506,7 +1638,7 @@

      Custom CMake Modules

    • - OptionRequires: Add an option that depends on one or more variables being true.
      + OptionRequires: Add an option that depends on one or more variables being true.


        option_requires(<option_name> <description> <variable_name> [<variable_name>...])


      @@ -1515,7 +1647,7 @@

      Custom CMake Modules

    • - PrefixListGlob: For each given prefix in a list, glob using the prefix+pattern
      + PrefixListGlob: 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

      @@ -1523,7 +1655,7 @@

      Custom CMake Modules

    • - ProgramFilesGlob: Find bit-appropriate program files directories matching a given pattern
      + ProgramFilesGlob: Find bit-appropriate program files directories matching a given pattern


      Requires these CMake modules:

        CleanDirectoryList
      PrefixListGlob
      @@ -1533,7 +1665,7 @@

      Custom CMake Modules

    • - ResetConfigurations: Re-set the available configurations to just RelWithDebInfo, Release, and Debug
      + ResetConfigurations: Re-set the available configurations to just RelWithDebInfo, Release, and Debug


      Requires these CMake modules:

        no additional modules required
      @@ -1543,7 +1675,7 @@

      Custom CMake Modules

    • - SearchProgramFilesForOpenSceneGraph: Use some smarts to try to find OpenSceneGraph in the Program Files dirs
      + SearchProgramFilesForOpenSceneGraph: Use some smarts to try to find OpenSceneGraph in the Program Files dirs


      Also uses the OSGHOME environment variable as OSG_DIR, if it's found.

      Usage:

      @@ -1557,7 +1689,7 @@

      Custom CMake Modules

    • - SetDefaultBuildType: Set a developer-chosen default build type
      + SetDefaultBuildType: Set a developer-chosen default build type


      Requires these CMake modules:

        no additional modules required
      @@ -1567,7 +1699,7 @@

      Custom CMake Modules

    • - SplitLibraryList: Given a list of libraries with OPTIMIZED, DEBUG, etc.
      + SplitLibraryList: Given a list of libraries with OPTIMIZED, DEBUG, etc.


        split_library_list(_generalvar _releasevar _debugvar)


      @@ -1577,7 +1709,7 @@

      Custom CMake Modules

    • - StampSourcesWithVersion: It will only attempt a substitution within the first C-style comment block
      + StampSourcesWithVersion: It will only attempt a substitution within the first C-style comment block


      To set up your source code for proper stamping, start your file with a Doxygen-style comment block, starting with /* and ending with */ On a line by itself, with unimportant whitespace, add the standard Doxygen "version" command:

        @version xxx
      @@ -1599,7 +1731,7 @@

      Custom CMake Modules

    • - TCHARWorkaround: Script to compile Win32-developed sources using tchar without modifying the code
      + TCHARWorkaround: Script to compile Win32-developed sources using tchar without modifying the code

      Requires that ${CMAKE_SOURCE_DIR}/cmake/workarounds/tchar/ be present.

      TCHAR_WORKAROUND, automatically set to on when not on win32 TCHAR_INCLUDE_DIR, location of our fake tchar.h file

      Original Author: 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC

      @@ -1607,7 +1739,7 @@

      Custom CMake Modules

    • - UseBackportedModules: Do a version-dependent check and auto-include backported modules dirs
      + UseBackportedModules: Do a version-dependent check and auto-include backported modules dirs


      Name your module directories cmake-*-modules where * is the full (maj.min.patch) version number that they came from. You can use subdirectories within those directories, if you like - all directories inside of a cmake-*-modules dir for a newer version of CMake that what we're running, that contain one or more .cmake files, will be appended to the CMAKE_MODULE_PATH.

      When backporting modules, be sure to test them and follow copyright instructions (usually updating copyright notices)

      @@ -1619,7 +1751,7 @@

      Custom CMake Modules

    • - UseMarkdown: Convert markdown source files to HTML as a custom target
      + UseMarkdown: Convert markdown source files to HTML as a custom target


        include(UseMarkdown)
      add_markdown_target(<target_name> <directory to copy to> <markdownfile> [<markdownfile>...] [RENAME <newname>])
      Relative paths for the destination directory are considered with
      with respect to CMAKE_CURRENT_BINARY_DIR. The RENAME argument is only
      valid with a single markdown file as input.


      @@ -1633,7 +1765,7 @@

      Custom CMake Modules

    • - UseTR1: Use settings to enable access to C++ TR1
      + UseTR1: Use settings to enable access to C++ TR1


      This calls include_directories and link_directories as needed to permit TR1 support.

      Original Author: 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> http://academic.cleardefinition.com Iowa State University HCI Graduate Program/VRAC

      @@ -1641,7 +1773,7 @@

      Custom CMake Modules

    • - WarningDev: Print a developer warning, using author_warning if we have cmake 2.8
      + WarningDev: Print a developer warning, using author_warning if we have cmake 2.8


        warning_dev("your desired message")


      @@ -1650,36 +1782,37 @@

      Custom CMake Modules

    -

    See Also

    +

    See Also

    +
  • Home Page
  • +
  • Frequently Asked Questions
  • +
  • Online Documentation
  • +
  • Mailing List
  • +

    .B ccmake(1), cpack(1), ctest(1), cmakecommands(1), cmakecompat(1), cmakemodules(1), cmakeprops(1), cmakevars(1)

    The following resources are available to get help using CMake:

    -

    Summary of helpful links:

    -
      Home: http://www.cmake.org
    Docs: http://www.cmake.org/HTML/Documentation.html
    Mail: http://www.cmake.org/HTML/MailingLists.html
    FAQ: http://www.cmake.org/Wiki/CMake_FAQ
    - diff --git a/module-help.txt b/module-help.txt index 07c4178..0a219f0 100644 --- a/module-help.txt +++ b/module-help.txt @@ -1,4 +1,4 @@ -cmake version 2.8.6 +cmake version 2.8.11.1 ------------------------------------------------------------------------------ Introduction @@ -1353,6 +1353,46 @@ a few. Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + FindInterSense + try to find InterSense library + + + + Cache Variables: (probably not for direct use in your scripts) + + INTERSENSE_INCLUDE_DIR + INTERSENSE_ISENSEC_DIR - location of the isense.c "import library" substitute. + INTERSENSE_LIBRARY + + + + Non-cache variables you might use in your CMakeLists.txt: + + INTERSENSE_FOUND + INTERSENSE_INCLUDE_DIRS + INTERSENSE_LIBRARIES + + + + Requires these CMake modules: + + FindPackageHandleStandardArgs (known included with CMake >=2.6.2) + + + + Author: 2013 Eric Marsh http://wemarsh.com/ + Kognitiv Neuroinformatik, Universität Bremen + + (building on Ryan Pavlik's templates) + + 2013 Ryan Pavlik + http://academic.cleardefinition.com Iowa State University HCI Graduate + Program/VRAC + + 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) + FindJCCL12 try to find JCCL 1.2 library @@ -3250,7 +3290,7 @@ a few. OS - + CPU_COUNT CPU_INTEL CPU_EXE_64BIT CPU_EXE_32BIT @@ -4000,11 +4040,3 @@ The following resources are available to get help using CMake: on the CMake web page. Please first read the full documentation at http://www.cmake.org before posting questions to the list. -Summary of helpful links: - - Home: http://www.cmake.org - Docs: http://www.cmake.org/HTML/Documentation.html - Mail: http://www.cmake.org/HTML/MailingLists.html - FAQ: http://www.cmake.org/Wiki/CMake_FAQ - - diff --git a/nested_targets/OpenHaptics/CMakeLists.txt b/nested_targets/OpenHaptics/CMakeLists.txt index 82f1571..f46daa3 100644 --- a/nested_targets/OpenHaptics/CMakeLists.txt +++ b/nested_targets/OpenHaptics/CMakeLists.txt @@ -10,6 +10,10 @@ # (See accompanying file ../../LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +if(WIN32) + # Work around bug in library at least <= 3.10 + add_definitions(-DWIN32) +endif() include_directories("${HDAPI_HDU_INCLUDE_DIR}" "${HDAPI_INCLUDE_DIR}" "${HLAPI_HLU_INCLUDE_DIR}" @@ -45,7 +49,7 @@ if(HDAPI_HDU_LIBRARY STREQUAL "openhaptics_hdu_nested_target") "${HDAPI_HDU_SOURCE_DIR}/hduPlane.cpp" "${HDAPI_HDU_SOURCE_DIR}/hduQuaternion.cpp" "${HDAPI_HDU_SOURCE_DIR}/hduRecord.cpp") - target_link_libraries(openhaptics_hdu_nested_target ${HDAPI_LIBRARIES}) + target_link_libraries(openhaptics_hdu_nested_target ${HDAPI_LIBRARY}) set_property(TARGET openhaptics_hdu_nested_target PROPERTY @@ -71,7 +75,7 @@ if(HLAPI_HLU_LIBRARY STREQUAL "openhaptics_hlu_nested_target") "${HLAPI_HLU_SOURCE_DIR}/hlu.cpp" "${HLAPI_HLU_SOURCE_DIR}/hluAfx.cpp" "${HLAPI_HLU_SOURCE_DIR}/hluAfx.h") - target_link_libraries(openhaptics_hlu_nested_target ${HLAPI_LIBRARIES}) + target_link_libraries(openhaptics_hlu_nested_target ${HLAPI_LIBRARY} ${HDAPI_LIBRARY}) set_property(TARGET openhaptics_hlu_nested_target