Skip to content

Commit

Permalink
Squashed 'cmake/' changes from cac13f1..38131f4
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rpavlik committed Nov 20, 2018
1 parent dd2c7e9 commit 0e90a8b
Show file tree
Hide file tree
Showing 75 changed files with 5,341 additions and 972 deletions.
10 changes: 10 additions & 0 deletions .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
32 changes: 8 additions & 24 deletions BoostTestTargets.cmake
Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand All @@ -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}")
Expand Down
19 changes: 19 additions & 0 deletions 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()
29 changes: 29 additions & 0 deletions 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()
16 changes: 16 additions & 0 deletions 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()
16 changes: 16 additions & 0 deletions 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"?
32 changes: 32 additions & 0 deletions 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(<target_name> [<imported target name> ...])
#
# install_imported_target(<imported target name> <arguments to pass to install(FILES))
#
# Likely requires CMake 2.8.12 or newer to work well.
#
# Original Author:
# 2015 Ryan Pavlik <ryan.pavlik@gmail.com> <abiryan@ryand.net>
#
# 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 $<TARGET_FILE:${_dep}> $<TARGET_FILE_DIR:${_target}>
COMMENT "Copying required DLL for dependency ${_dep}"
VERBATIM)
endif()
endforeach()
endfunction()


function(install_imported_target _dep)
install(FILES $<TARGET_FILE:${_dep}> ${ARGN})
endfunction()
66 changes: 47 additions & 19 deletions CppcheckTargets.cmake
@@ -1,22 +1,26 @@
# - 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]) -
# add_cppcheck(<target-name> [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(<target-name> [UNUSED_FUNCTIONS] [STYLE] [POSSIBLE_ERROR] [FAIL_ON_WARNINGS]) -
# add_cppcheck_sources(<target-name> [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 <rpavlik@iastate.edu> <abiryan@ryand.net>
# 2009-2010 Ryan Pavlik <ryan.pavlik@gmail.com> <abiryan@ryand.net>
# 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)
Expand All @@ -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")
Expand All @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -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}
Expand All @@ -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()

Expand All @@ -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")
Expand All @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -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()
21 changes: 15 additions & 6 deletions CreateDashboardScripts.cmake
Expand Up @@ -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 <rpavlik@iastate.edu> <abiryan@ryand.net>
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 0e90a8b

Please sign in to comment.