-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Squashed 'cmake/' changes from 0875d124..ad436ee7
ad436ee7 Add creator's update windows SDK to search directories. 6c3c6b0a Merge branch 'nickbroon-improve-cppcheck' 58843aef CppcheckTargets: update credits 66fe49e8 CppcheckTargets: fix indents 7638eb54 Rename convenience target back to all_cppcheck from cppcheck. 35e68230 Update requirement info for CppcheckTargets 065ecf13 Merge branch 'improve-cppcheck' of https://github.com/nickbroon/cmake-modules into nickbroon-improve-cppcheck 98e28d2f Merge pull request #44 from AlessandroMenti/boost-test-targets-check-fix 82e5a292 Merge pull request #45 from noma/master deca4d3d Added git_local_changes() to GetGitRevisionDescription.cmake 08987b54 Update to stash map config to make it actually properly push and pop c330929f New module: stash map config. 8a18a1b4 Add new InstallDebugSymbols module. 30573d30 Small JsonCpp cleanup. 2ef829da Fix "no target to set property" error in FindJsonCpp 997754e2 Fix wrong check in BoostTestTargets.cmake 41e16511 libusb1 enhancements from VRPN 7ef3955d Fixes to FindWindowsSDK so it doesn't return TRUE as the first element of every directory list. a4974827 Fix indentation and accidentally-left-in debug messages in FindDirectShow b43b5e27 Bug fix in backported FindGit. 7c8c7925 Add a greatly enhanced FindGLEW (for CMake 2.8.12+), based on the upstream. ec0c486f Add the Windows 10 1607 "Anniversary Update" SDK version to the WindowsSDK list. 7dc51986 Fix building against jsoncpp when the build types don't exactly match. 1932f85b Return to more conservative default settings. b1d2d88b cppcheck will check C as well as C++ a4561deb Improvements on cppcheck git-subtree-dir: cmake git-subtree-split: ad436ee7be33ca291a59866a173b777b0e2d81ce
- Loading branch information
Showing
12 changed files
with
439 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,14 +9,18 @@ | |
# 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 <[email protected]> <[email protected]> | ||
# 2009-2010 Ryan Pavlik <[email protected]> <[email protected]> | ||
# 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") | ||
|
@@ -79,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() | ||
|
@@ -119,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} | ||
|
@@ -133,6 +143,7 @@ function(add_cppcheck_sources _targetname) | |
COMMENT | ||
"${_targetname}_cppcheck: Running cppcheck on target ${_targetname}..." | ||
VERBATIM) | ||
add_dependencies(cppcheck ${_targetname}_cppcheck) | ||
endif() | ||
endfunction() | ||
|
||
|
@@ -142,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") | ||
|
@@ -183,7 +194,7 @@ function(add_cppcheck _name) | |
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() | ||
|
@@ -211,9 +222,7 @@ 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} | ||
|
@@ -226,6 +235,7 @@ function(add_cppcheck _name) | |
COMMENT | ||
"${_name}_cppcheck: Running cppcheck on target ${_name}..." | ||
VERBATIM) | ||
add_dependencies(all_cppcheck ${_name}_cppcheck) | ||
endif() | ||
|
||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.