init repo.
This commit is contained in:
4
third_party/gflags/cmake/README_runtime.txt
vendored
Normal file
4
third_party/gflags/cmake/README_runtime.txt
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
This package contains runtime libraries only which are required
|
||||
by applications that use these libraries for the commandline flags
|
||||
processing. If you want to develop such application, download
|
||||
and install the development package instead.
|
26
third_party/gflags/cmake/cmake_uninstall.cmake.in
vendored
Normal file
26
third_party/gflags/cmake/cmake_uninstall.cmake.in
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
|
||||
if (NOT DEFINED CMAKE_INSTALL_PREFIX)
|
||||
set (CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@")
|
||||
endif ()
|
||||
message(${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
|
||||
string(REGEX REPLACE "\n" ";" files "${files}")
|
||||
foreach(file ${files})
|
||||
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
|
||||
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
|
||||
exec_program(
|
||||
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RETURN_VALUE rm_retval
|
||||
)
|
||||
if(NOT "${rm_retval}" STREQUAL 0)
|
||||
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
|
||||
endif(NOT "${rm_retval}" STREQUAL 0)
|
||||
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
|
||||
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
|
||||
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
|
||||
endforeach(file)
|
183
third_party/gflags/cmake/config.cmake.in
vendored
Normal file
183
third_party/gflags/cmake/config.cmake.in
vendored
Normal file
@ -0,0 +1,183 @@
|
||||
## gflags CMake configuration file
|
||||
|
||||
# library version information
|
||||
set (@PACKAGE_PREFIX@_VERSION_STRING "@PACKAGE_VERSION@")
|
||||
set (@PACKAGE_PREFIX@_VERSION_MAJOR @PACKAGE_VERSION_MAJOR@)
|
||||
set (@PACKAGE_PREFIX@_VERSION_MINOR @PACKAGE_VERSION_MINOR@)
|
||||
set (@PACKAGE_PREFIX@_VERSION_PATCH @PACKAGE_VERSION_PATCH@)
|
||||
|
||||
# import targets
|
||||
if (NOT DEFINED @PACKAGE_PREFIX@_USE_TARGET_NAMESPACE)
|
||||
set (@PACKAGE_PREFIX@_USE_TARGET_NAMESPACE FALSE)
|
||||
endif ()
|
||||
if (@PACKAGE_PREFIX@_USE_TARGET_NAMESPACE)
|
||||
include ("${CMAKE_CURRENT_LIST_DIR}/@EXPORT_NAME@.cmake")
|
||||
set (@PACKAGE_PREFIX@_TARGET_NAMESPACE @PACKAGE_NAME@)
|
||||
else ()
|
||||
include ("${CMAKE_CURRENT_LIST_DIR}/@PACKAGE_NAME@-nonamespace-targets.cmake")
|
||||
set (@PACKAGE_PREFIX@_TARGET_NAMESPACE)
|
||||
endif ()
|
||||
if (@PACKAGE_PREFIX@_TARGET_NAMESPACE)
|
||||
set (@PACKAGE_PREFIX@_TARGET_PREFIX ${@PACKAGE_PREFIX@_TARGET_NAMESPACE}::)
|
||||
else ()
|
||||
set (@PACKAGE_PREFIX@_TARGET_PREFIX)
|
||||
endif ()
|
||||
|
||||
# installation prefix
|
||||
get_filename_component (CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
get_filename_component (_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_PREFIX_REL2CONFIG_DIR@" ABSOLUTE)
|
||||
|
||||
# include directory
|
||||
#
|
||||
# Newer versions of CMake set the INTERFACE_INCLUDE_DIRECTORIES property
|
||||
# of the imported targets. It is hence not necessary to add this path
|
||||
# manually to the include search path for targets which link to gflags.
|
||||
set (@PACKAGE_PREFIX@_INCLUDE_DIR "${_INSTALL_PREFIX}/@INCLUDE_INSTALL_DIR@")
|
||||
|
||||
if (@PACKAGE_NAME@_FIND_COMPONENTS)
|
||||
foreach (@PACKAGE_NAME@_FIND_COMPONENT IN LISTS @PACKAGE_NAME@_FIND_COMPONENTS)
|
||||
if (@PACKAGE_NAME@_FIND_REQUIRED_${@PACKAGE_NAME@_FIND_COMPONENT} AND NOT TARGET @PACKAGE_NAME@_${@PACKAGE_NAME@_FIND_COMPONENT})
|
||||
message (FATAL_ERROR "Package @PACKAGE_NAME@ was installed without required component ${@PACKAGE_NAME@_FIND_COMPONENT}!")
|
||||
endif ()
|
||||
endforeach ()
|
||||
list (GET @PACKAGE_NAME@_FIND_COMPONENTS 0 @PACKAGE_NAME@_FIND_COMPONENT)
|
||||
else ()
|
||||
set (@PACKAGE_NAME@_FIND_COMPONENT)
|
||||
endif ()
|
||||
|
||||
# default settings of @PACKAGE_PREFIX@_SHARED and @PACKAGE_PREFIX@_NOTHREADS
|
||||
#
|
||||
# It is recommended to use either one of the following find_package commands
|
||||
# instead of setting the @PACKAGE_PREFIX@_(SHARED|NOTHREADS) variables:
|
||||
# - find_package(@PACKAGE_NAME@ REQUIRED)
|
||||
# - find_package(@PACKAGE_NAME@ COMPONENTS nothreads_static)
|
||||
# - find_package(@PACKAGE_NAME@ COMPONENTS nothreads_shared)
|
||||
# - find_package(@PACKAGE_NAME@ COMPONENTS static)
|
||||
# - find_package(@PACKAGE_NAME@ COMPONENTS shared)
|
||||
if (NOT DEFINED @PACKAGE_PREFIX@_SHARED)
|
||||
if (DEFINED @PACKAGE_NAME@_SHARED)
|
||||
set (@PACKAGE_PREFIX@_SHARED ${@PACKAGE_NAME@_SHARED})
|
||||
elseif (@PACKAGE_NAME@_FIND_COMPONENT)
|
||||
if (@PACKAGE_NAME@_FIND_COMPONENT MATCHES "shared")
|
||||
set (@PACKAGE_PREFIX@_SHARED TRUE)
|
||||
else ()
|
||||
set (@PACKAGE_PREFIX@_SHARED FALSE)
|
||||
endif ()
|
||||
elseif (TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_shared OR TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_nothreads_shared)
|
||||
set (@PACKAGE_PREFIX@_SHARED TRUE)
|
||||
else ()
|
||||
set (@PACKAGE_PREFIX@_SHARED FALSE)
|
||||
endif ()
|
||||
endif ()
|
||||
if (NOT DEFINED @PACKAGE_PREFIX@_NOTHREADS)
|
||||
if (DEFINED @PACKAGE_NAME@_NOTHREADS)
|
||||
set (@PACKAGE_PREFIX@_NOTHREADS ${@PACKAGE_NAME@_NOTHREADS})
|
||||
elseif (@PACKAGE_NAME@_FIND_COMPONENT)
|
||||
if (@PACKAGE_NAME@_FIND_COMPONENT MATCHES "nothreads")
|
||||
set (@PACKAGE_PREFIX@_NOTHREADS TRUE)
|
||||
else ()
|
||||
set (@PACKAGE_PREFIX@_NOTHREADS FALSE)
|
||||
endif ()
|
||||
elseif (TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}PACKAGE_NAME@_static OR TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_shared)
|
||||
set (@PACKAGE_PREFIX@_NOTHREADS FALSE)
|
||||
else ()
|
||||
set (@PACKAGE_PREFIX@_NOTHREADS TRUE)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# choose imported library target
|
||||
if (NOT @PACKAGE_PREFIX@_TARGET)
|
||||
if (@PACKAGE_NAME@_TARGET)
|
||||
set (@PACKAGE_PREFIX@_TARGET ${@PACKAGE_NAME@_TARGET})
|
||||
elseif (@PACKAGE_PREFIX@_SHARED)
|
||||
if (@PACKAGE_PREFIX@_NOTHREADS)
|
||||
set (@PACKAGE_PREFIX@_TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_nothreads_shared)
|
||||
else ()
|
||||
set (@PACKAGE_PREFIX@_TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_shared)
|
||||
endif ()
|
||||
else ()
|
||||
if (@PACKAGE_PREFIX@_NOTHREADS)
|
||||
set (@PACKAGE_PREFIX@_TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_nothreads_static)
|
||||
else ()
|
||||
set (@PACKAGE_PREFIX@_TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_static)
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
if (NOT TARGET ${@PACKAGE_PREFIX@_TARGET})
|
||||
message (FATAL_ERROR "Your @PACKAGE_NAME@ installation does not contain a ${@PACKAGE_PREFIX@_TARGET} library target!"
|
||||
" Try a different combination of @PACKAGE_PREFIX@_SHARED and @PACKAGE_PREFIX@_NOTHREADS.")
|
||||
endif ()
|
||||
|
||||
# add more convenient "${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@" import target
|
||||
if (NOT TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@)
|
||||
if (@PACKAGE_PREFIX@_SHARED)
|
||||
add_library (${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@ SHARED IMPORTED)
|
||||
else ()
|
||||
add_library (${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@ STATIC IMPORTED)
|
||||
endif ()
|
||||
# copy INTERFACE_* properties
|
||||
foreach (_@PACKAGE_PREFIX@_PROPERTY_NAME IN ITEMS
|
||||
COMPILE_DEFINITIONS
|
||||
COMPILE_FEATURES
|
||||
COMPILE_OPTIONS
|
||||
INCLUDE_DIRECTORIES
|
||||
LINK_LIBRARIES
|
||||
POSITION_INDEPENDENT_CODE
|
||||
)
|
||||
get_target_property (_@PACKAGE_PREFIX@_PROPERTY_VALUE ${@PACKAGE_PREFIX@_TARGET} INTERFACE_${_@PACKAGE_PREFIX@_PROPERTY_NAME})
|
||||
if (_@PACKAGE_PREFIX@_PROPERTY_VALUE)
|
||||
set_target_properties(${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@ PROPERTIES
|
||||
INTERFACE_${_@PACKAGE_PREFIX@_PROPERTY_NAME} "${_@PACKAGE_PREFIX@_PROPERTY_VALUE}"
|
||||
)
|
||||
endif ()
|
||||
endforeach ()
|
||||
# copy IMPORTED_*_<CONFIG> properties
|
||||
get_target_property (_@PACKAGE_PREFIX@_CONFIGURATIONS ${@PACKAGE_PREFIX@_TARGET} IMPORTED_CONFIGURATIONS)
|
||||
set_target_properties (${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@ PROPERTIES IMPORTED_CONFIGURATIONS "${_@PACKAGE_PREFIX@_CONFIGURATIONS}")
|
||||
foreach (_@PACKAGE_PREFIX@_PROPERTY_NAME IN ITEMS
|
||||
IMPLIB
|
||||
LOCATION
|
||||
LINK_DEPENDENT_LIBRARIES
|
||||
LINK_INTERFACE_LIBRARIES
|
||||
LINK_INTERFACE_LANGUAGES
|
||||
LINK_INTERFACE_MULTIPLICITY
|
||||
NO_SONAME
|
||||
SONAME
|
||||
)
|
||||
foreach (_@PACKAGE_PREFIX@_CONFIG IN LISTS _@PACKAGE_PREFIX@_CONFIGURATIONS)
|
||||
get_target_property (_@PACKAGE_PREFIX@_PROPERTY_VALUE ${@PACKAGE_PREFIX@_TARGET} IMPORTED_${_@PACKAGE_PREFIX@_PROPERTY_NAME}_${_@PACKAGE_PREFIX@_CONFIG})
|
||||
if (_@PACKAGE_PREFIX@_PROPERTY_VALUE)
|
||||
set_target_properties(${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@ PROPERTIES
|
||||
IMPORTED_${_@PACKAGE_PREFIX@_PROPERTY_NAME}_${_@PACKAGE_PREFIX@_CONFIG} "${_@PACKAGE_PREFIX@_PROPERTY_VALUE}"
|
||||
)
|
||||
endif ()
|
||||
endforeach ()
|
||||
endforeach ()
|
||||
unset (_@PACKAGE_PREFIX@_CONFIGURATIONS)
|
||||
unset (_@PACKAGE_PREFIX@_CONFIG)
|
||||
unset (_@PACKAGE_PREFIX@_PROPERTY_NAME)
|
||||
unset (_@PACKAGE_PREFIX@_PROPERTY_VALUE)
|
||||
endif ()
|
||||
|
||||
# alias for default import target to be compatible with older CMake package configurations
|
||||
set (@PACKAGE_PREFIX@_LIBRARIES "${@PACKAGE_PREFIX@_TARGET}")
|
||||
|
||||
# set @PACKAGE_NAME@_* variables for backwards compatibility
|
||||
if (NOT "^@PACKAGE_NAME@$" STREQUAL "^@PACKAGE_PREFIX@$")
|
||||
foreach (_@PACKAGE_PREFIX@_VARIABLE IN ITEMS
|
||||
VERSION_STRING
|
||||
VERSION_MAJOR
|
||||
VERSION_MINOR
|
||||
VERSION_PATCH
|
||||
INCLUDE_DIR
|
||||
LIBRARIES
|
||||
TARGET
|
||||
)
|
||||
set (@PACKAGE_NAME@_${_@PACKAGE_PREFIX@_VARIABLE} "${@PACKAGE_PREFIX@_${_@PACKAGE_PREFIX@_VARIABLE}}")
|
||||
endforeach ()
|
||||
unset (_@PACKAGE_PREFIX@_VARIABLE)
|
||||
endif ()
|
||||
|
||||
# unset private variables
|
||||
unset (@PACKAGE_NAME@_FIND_COMPONENT)
|
||||
unset (_INSTALL_PREFIX)
|
53
third_party/gflags/cmake/execute_test.cmake
vendored
Normal file
53
third_party/gflags/cmake/execute_test.cmake
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
# ----------------------------------------------------------------------------
|
||||
# sanitize string stored in variable for use in regular expression.
|
||||
macro (sanitize_for_regex STRVAR)
|
||||
string (REGEX REPLACE "([.+*?^$()])" "\\\\\\1" ${STRVAR} "${${STRVAR}}")
|
||||
endmacro ()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# script arguments
|
||||
if (NOT COMMAND)
|
||||
message (FATAL_ERROR "Test command not specified!")
|
||||
endif ()
|
||||
if (NOT DEFINED EXPECTED_RC)
|
||||
set (EXPECTED_RC 0)
|
||||
endif ()
|
||||
if (EXPECTED_OUTPUT)
|
||||
sanitize_for_regex(EXPECTED_OUTPUT)
|
||||
endif ()
|
||||
if (UNEXPECTED_OUTPUT)
|
||||
sanitize_for_regex(UNEXPECTED_OUTPUT)
|
||||
endif ()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# set a few environment variables (useful for --tryfromenv)
|
||||
set (ENV{FLAGS_undefok} "foo,bar")
|
||||
set (ENV{FLAGS_weirdo} "")
|
||||
set (ENV{FLAGS_version} "true")
|
||||
set (ENV{FLAGS_help} "false")
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# execute test command
|
||||
execute_process(
|
||||
COMMAND ${COMMAND}
|
||||
RESULT_VARIABLE RC
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
ERROR_VARIABLE OUTPUT
|
||||
)
|
||||
|
||||
if (OUTPUT)
|
||||
message ("${OUTPUT}")
|
||||
endif ()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# check test result
|
||||
if (NOT RC EQUAL EXPECTED_RC)
|
||||
string (REPLACE ";" " " COMMAND "${COMMAND}")
|
||||
message (FATAL_ERROR "Command:\n\t${COMMAND}\nExit status is ${RC}, expected ${EXPECTED_RC}")
|
||||
endif ()
|
||||
if (EXPECTED_OUTPUT AND NOT OUTPUT MATCHES "${EXPECTED_OUTPUT}")
|
||||
message (FATAL_ERROR "Test output does not match expected output: ${EXPECTED_OUTPUT}")
|
||||
endif ()
|
||||
if (UNEXPECTED_OUTPUT AND OUTPUT MATCHES "${UNEXPECTED_OUTPUT}")
|
||||
message (FATAL_ERROR "Test output matches unexpected output: ${UNEXPECTED_OUTPUT}")
|
||||
endif ()
|
49
third_party/gflags/cmake/package.cmake.in
vendored
Normal file
49
third_party/gflags/cmake/package.cmake.in
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
# Per-generator CPack configuration file. See CPACK_PROJECT_CONFIG_FILE documented at
|
||||
# http://www.cmake.org/cmake/help/v2.8.12/cpack.html#variable:CPACK_PROJECT_CONFIG_FILE
|
||||
#
|
||||
# All common CPACK_* variables are set in CMakeLists.txt already. This file only
|
||||
# overrides some of these to provide package generator specific settings.
|
||||
|
||||
# whether package contains all development files or only runtime files
|
||||
set (DEVEL @INSTALL_HEADERS@)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Mac OS X package
|
||||
if (CPACK_GENERATOR MATCHES "PackageMaker|DragNDrop")
|
||||
|
||||
set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}")
|
||||
if (DEVEL)
|
||||
set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-devel")
|
||||
endif ()
|
||||
set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${CPACK_PACKAGE_VERSION}")
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Debian package
|
||||
elseif (CPACK_GENERATOR MATCHES "DEB")
|
||||
|
||||
set (CPACK_PACKAGE_FILE_NAME "lib${CPACK_PACKAGE_NAME}")
|
||||
if (DEVEL)
|
||||
set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-dev")
|
||||
else ()
|
||||
set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}0")
|
||||
endif ()
|
||||
set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}_${CPACK_PACKAGE_VERSION}-1_${CPACK_PACKAGE_ARCHITECTURE}")
|
||||
|
||||
set (CPACK_DEBIAN_PACKAGE_DEPENDS)
|
||||
set (CPACK_DEBIAN_PACKAGE_SECTION "devel")
|
||||
set (CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
||||
set (CPACK_DEBIAN_PACKAGE_HOMEPAGE "${CPACK_RPM_PACKAGE_URL}")
|
||||
set (CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_VENDOR}")
|
||||
set (CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${CPACK_PACKAGE_ARCHITECTURE}")
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# RPM package
|
||||
elseif (CPACK_GENERATOR MATCHES "RPM")
|
||||
|
||||
set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}")
|
||||
if (DEVEL)
|
||||
set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-devel")
|
||||
endif ()
|
||||
set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${CPACK_PACKAGE_VERSION}-1.${CPACK_PACKAGE_ARCHITECTURE}")
|
||||
|
||||
endif ()
|
14
third_party/gflags/cmake/package.pc.in
vendored
Normal file
14
third_party/gflags/cmake/package.pc.in
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
bindir=${prefix}/@RUNTIME_INSTALL_DIR@
|
||||
libdir=${prefix}/@LIBRARY_INSTALL_DIR@
|
||||
includedir=${prefix}/@INCLUDE_INSTALL_DIR@
|
||||
|
||||
Name: @PACKAGE_NAME@
|
||||
Version: @PACKAGE_VERSION@
|
||||
Description: @PACKAGE_DESCRIPTION@
|
||||
URL: @PACKAGE_URL@
|
||||
Requires:
|
||||
Libs: -L${libdir} -lgflags
|
||||
Libs.private: -lpthread
|
||||
Cflags: -I${includedir}
|
205
third_party/gflags/cmake/utils.cmake
vendored
Normal file
205
third_party/gflags/cmake/utils.cmake
vendored
Normal file
@ -0,0 +1,205 @@
|
||||
## Utility CMake functions.
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
## Convert boolean value to 0 or 1
|
||||
macro (bool_to_int VAR)
|
||||
if (${VAR})
|
||||
set (${VAR} 1)
|
||||
else ()
|
||||
set (${VAR} 0)
|
||||
endif ()
|
||||
endmacro ()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
## Extract version numbers from version string
|
||||
function (version_numbers version major minor patch)
|
||||
if (version MATCHES "([0-9]+)(\\.[0-9]+)?(\\.[0-9]+)?(rc[1-9][0-9]*|[a-z]+)?")
|
||||
if (CMAKE_MATCH_1)
|
||||
set (_major ${CMAKE_MATCH_1})
|
||||
else ()
|
||||
set (_major 0)
|
||||
endif ()
|
||||
if (CMAKE_MATCH_2)
|
||||
set (_minor ${CMAKE_MATCH_2})
|
||||
string (REGEX REPLACE "^\\." "" _minor "${_minor}")
|
||||
else ()
|
||||
set (_minor 0)
|
||||
endif ()
|
||||
if (CMAKE_MATCH_3)
|
||||
set (_patch ${CMAKE_MATCH_3})
|
||||
string (REGEX REPLACE "^\\." "" _patch "${_patch}")
|
||||
else ()
|
||||
set (_patch 0)
|
||||
endif ()
|
||||
else ()
|
||||
set (_major 0)
|
||||
set (_minor 0)
|
||||
set (_patch 0)
|
||||
endif ()
|
||||
set ("${major}" "${_major}" PARENT_SCOPE)
|
||||
set ("${minor}" "${_minor}" PARENT_SCOPE)
|
||||
set ("${patch}" "${_patch}" PARENT_SCOPE)
|
||||
endfunction ()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
## Determine if cache entry exists
|
||||
macro (gflags_is_cached retvar varname)
|
||||
if (DEFINED ${varname})
|
||||
get_property (${retvar} CACHE ${varname} PROPERTY TYPE SET)
|
||||
else ()
|
||||
set (${retvar} FALSE)
|
||||
endif ()
|
||||
endmacro ()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
## Add gflags configuration variable
|
||||
#
|
||||
# The default value of the (cached) configuration value can be overridden either
|
||||
# on the CMake command-line or the super-project by setting the GFLAGS_<varname>
|
||||
# variable. When gflags is a subproject of another project (GFLAGS_IS_SUBPROJECT),
|
||||
# the variable is not added to the CMake cache. Otherwise it is cached.
|
||||
macro (gflags_define type varname docstring default)
|
||||
# note that ARGC must be expanded here, as it is not a "real" variable
|
||||
# (see the CMake documentation for the macro command)
|
||||
if ("${ARGC}" GREATER 5)
|
||||
message (FATAL_ERROR "gflags_variable: Too many macro arguments")
|
||||
endif ()
|
||||
if (NOT DEFINED GFLAGS_${varname})
|
||||
if (GFLAGS_IS_SUBPROJECT AND "${ARGC}" EQUAL 5)
|
||||
set (GFLAGS_${varname} "${ARGV4}")
|
||||
else ()
|
||||
set (GFLAGS_${varname} "${default}")
|
||||
endif ()
|
||||
endif ()
|
||||
if (GFLAGS_IS_SUBPROJECT)
|
||||
if (NOT DEFINED ${varname})
|
||||
set (${varname} "${GFLAGS_${varname}}")
|
||||
endif ()
|
||||
else ()
|
||||
set (${varname} "${GFLAGS_${varname}}" CACHE ${type} "${docstring}")
|
||||
endif ()
|
||||
endmacro ()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
## Set property of cached gflags configuration variable
|
||||
macro (gflags_property varname property value)
|
||||
gflags_is_cached (_cached ${varname})
|
||||
if (_cached)
|
||||
# note that property must be expanded here, as it is not a "real" variable
|
||||
# (see the CMake documentation for the macro command)
|
||||
if ("${property}" STREQUAL "ADVANCED")
|
||||
if (${value})
|
||||
mark_as_advanced (FORCE ${varname})
|
||||
else ()
|
||||
mark_as_advanced (CLEAR ${varname})
|
||||
endif ()
|
||||
else ()
|
||||
set_property (CACHE ${varname} PROPERTY "${property}" "${value}")
|
||||
endif ()
|
||||
endif ()
|
||||
unset (_cached)
|
||||
endmacro ()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
## Modify value of gflags configuration variable
|
||||
macro (gflags_set varname value)
|
||||
gflags_is_cached (_cached ${varname})
|
||||
if (_cached)
|
||||
set_property (CACHE ${varname} PROPERTY VALUE "${value}")
|
||||
else ()
|
||||
set (${varname} "${value}")
|
||||
endif ()
|
||||
unset (_cached)
|
||||
endmacro ()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
## Configure public header files
|
||||
function (configure_headers out)
|
||||
set (tmp)
|
||||
foreach (src IN LISTS ARGN)
|
||||
if (IS_ABSOLUTE "${src}")
|
||||
list (APPEND tmp "${src}")
|
||||
elseif (EXISTS "${PROJECT_SOURCE_DIR}/src/${src}.in")
|
||||
configure_file ("${PROJECT_SOURCE_DIR}/src/${src}.in" "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}" @ONLY)
|
||||
list (APPEND tmp "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}")
|
||||
else ()
|
||||
configure_file ("${PROJECT_SOURCE_DIR}/src/${src}" "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}" COPYONLY)
|
||||
list (APPEND tmp "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}")
|
||||
endif ()
|
||||
endforeach ()
|
||||
set (${out} "${tmp}" PARENT_SCOPE)
|
||||
endfunction ()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
## Configure source files with .in suffix
|
||||
function (configure_sources out)
|
||||
set (tmp)
|
||||
foreach (src IN LISTS ARGN)
|
||||
if (src MATCHES ".h$" AND EXISTS "${PROJECT_SOURCE_DIR}/src/${src}.in")
|
||||
configure_file ("${PROJECT_SOURCE_DIR}/src/${src}.in" "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}" @ONLY)
|
||||
list (APPEND tmp "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}")
|
||||
else ()
|
||||
list (APPEND tmp "${PROJECT_SOURCE_DIR}/src/${src}")
|
||||
endif ()
|
||||
endforeach ()
|
||||
set (${out} "${tmp}" PARENT_SCOPE)
|
||||
endfunction ()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
## Add usage test
|
||||
#
|
||||
# Using PASS_REGULAR_EXPRESSION and FAIL_REGULAR_EXPRESSION would
|
||||
# do as well, but CMake/CTest does not allow us to specify an
|
||||
# expected exit status. Moreover, the execute_test.cmake script
|
||||
# sets environment variables needed by the --fromenv/--tryfromenv tests.
|
||||
macro (add_gflags_test name expected_rc expected_output unexpected_output cmd)
|
||||
set (args "--test_tmpdir=${PROJECT_BINARY_DIR}/Testing/Temporary"
|
||||
"--srcdir=${PROJECT_SOURCE_DIR}/test")
|
||||
add_test (
|
||||
NAME ${name}
|
||||
COMMAND "${CMAKE_COMMAND}" "-DCOMMAND:STRING=$<TARGET_FILE:${cmd}>;${args};${ARGN}"
|
||||
"-DEXPECTED_RC:STRING=${expected_rc}"
|
||||
"-DEXPECTED_OUTPUT:STRING=${expected_output}"
|
||||
"-DUNEXPECTED_OUTPUT:STRING=${unexpected_output}"
|
||||
-P "${PROJECT_SOURCE_DIR}/cmake/execute_test.cmake"
|
||||
WORKING_DIRECTORY "${GFLAGS_FLAGFILES_DIR}"
|
||||
)
|
||||
endmacro ()
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
## Register installed package with CMake
|
||||
#
|
||||
# This function adds an entry to the CMake registry for packages with the
|
||||
# path of the directory where the package configuration file of the installed
|
||||
# package is located in order to help CMake find the package in a custom
|
||||
# installation prefix. This differs from CMake's export(PACKAGE) command
|
||||
# which registers the build directory instead.
|
||||
function (register_gflags_package CONFIG_DIR)
|
||||
if (NOT IS_ABSOLUTE "${CONFIG_DIR}")
|
||||
set (CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/${CONFIG_DIR}")
|
||||
endif ()
|
||||
string (MD5 REGISTRY_ENTRY "${CONFIG_DIR}")
|
||||
if (WIN32)
|
||||
install (CODE
|
||||
"execute_process (
|
||||
COMMAND reg add \"HKCU\\\\Software\\\\Kitware\\\\CMake\\\\Packages\\\\${PACKAGE_NAME}\" /v \"${REGISTRY_ENTRY}\" /d \"${CONFIG_DIR}\" /t REG_SZ /f
|
||||
RESULT_VARIABLE RT
|
||||
ERROR_VARIABLE ERR
|
||||
OUTPUT_QUIET
|
||||
)
|
||||
if (RT EQUAL 0)
|
||||
message (STATUS \"Register: Added HKEY_CURRENT_USER\\\\Software\\\\Kitware\\\\CMake\\\\Packages\\\\${PACKAGE_NAME}\\\\${REGISTRY_ENTRY}\")
|
||||
else ()
|
||||
string (STRIP \"\${ERR}\" ERR)
|
||||
message (STATUS \"Register: Failed to add registry entry: \${ERR}\")
|
||||
endif ()"
|
||||
)
|
||||
elseif (IS_DIRECTORY "$ENV{HOME}")
|
||||
file (WRITE "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-registry-entry" "${CONFIG_DIR}")
|
||||
install (
|
||||
FILES "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-registry-entry"
|
||||
DESTINATION "$ENV{HOME}/.cmake/packages/${PACKAGE_NAME}"
|
||||
RENAME "${REGISTRY_ENTRY}"
|
||||
)
|
||||
endif ()
|
||||
endfunction ()
|
21
third_party/gflags/cmake/version.cmake.in
vendored
Normal file
21
third_party/gflags/cmake/version.cmake.in
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
## gflags CMake configuration version file
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# library version
|
||||
set (PACKAGE_VERSION "@PACKAGE_VERSION@")
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# check compatibility
|
||||
|
||||
# Perform compatibility check here using the input CMake variables.
|
||||
# See example in http://www.cmake.org/Wiki/CMake_2.6_Notes.
|
||||
|
||||
set (PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
set (PACKAGE_VERSION_UNSUITABLE FALSE)
|
||||
|
||||
if ("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL "@PACKAGE_VERSION_MAJOR@" AND
|
||||
"${PACKAGE_FIND_VERSION_MINOR}" EQUAL "@PACKAGE_VERSION_MINOR@")
|
||||
set (PACKAGE_VERSION_EXACT TRUE)
|
||||
else ()
|
||||
set (PACKAGE_VERSION_EXACT FALSE)
|
||||
endif ()
|
Reference in New Issue
Block a user