Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
G
gflags
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
gflags
Commits
389ef3f7
Commit
389ef3f7
authored
Mar 01, 2016
by
Andreas Schuh
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:gflags/gflags
parents
752c6324
f9e69b35
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
191 additions
and
67 deletions
+191
-67
CMakeLists.txt
CMakeLists.txt
+0
-0
config.cmake.in
cmake/config.cmake.in
+119
-62
utils.cmake
cmake/utils.cmake
+68
-1
CMakeLists.txt
test/CMakeLists.txt
+2
-2
CMakeLists.txt
test/nc/CMakeLists.txt
+2
-2
No files found.
CMakeLists.txt
View file @
389ef3f7
This diff is collapsed.
Click to expand it.
cmake/config.cmake.in
View file @
389ef3f7
## gflags CMake configuration file
# library version information
set (@PACKAGE_
NAME
@_VERSION_STRING "@PACKAGE_VERSION@")
set (@PACKAGE_
NAME
@_VERSION_MAJOR @PACKAGE_VERSION_MAJOR@)
set (@PACKAGE_
NAME
@_VERSION_MINOR @PACKAGE_VERSION_MINOR@)
set (@PACKAGE_
NAME
@_VERSION_PATCH @PACKAGE_VERSION_PATCH@)
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
include ("${CMAKE_CURRENT_LIST_DIR}/@PACKAGE_NAME@-
export
.cmake")
include ("${CMAKE_CURRENT_LIST_DIR}/@PACKAGE_NAME@-
targets
.cmake")
# installation prefix
get_filename_component (CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
...
...
@@ -18,94 +18,151 @@ get_filename_component (_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_PREF
# 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_
NAME
@_INCLUDE_DIR "${_INSTALL_PREFIX}/@INCLUDE_INSTALL_DIR@")
set (@PACKAGE_
PREFIX
@_INCLUDE_DIR "${_INSTALL_PREFIX}/@INCLUDE_INSTALL_DIR@")
# default settings
if (NOT DEFINED @PACKAGE_NAME@_SHARED)
if (TARGET @PACKAGE_NAME@-static OR TARGET @PACKAGE_NAME@_nothreads-static)
set (@PACKAGE_NAME@_SHARED FALSE)
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_NAME@_shared OR TARGET @PACKAGE_NAME@_nothreads_shared)
set (@PACKAGE_PREFIX@_SHARED TRUE)
else ()
set (@PACKAGE_
NAME@_SHARED TRU
E)
set (@PACKAGE_
PREFIX@_SHARED FALS
E)
endif ()
endif ()
if (NOT DEFINED @PACKAGE_NAME@_NOTHREADS)
if (TARGET @PACKAGE_NAME@-static OR TARGET @PACKAGE_NAME@-shared)
set (@PACKAGE_NAME@_NOTHREADS FALSE)
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_NAME@_static OR TARGET @PACKAGE_NAME@_shared)
set (@PACKAGE_PREFIX@_NOTHREADS FALSE)
else ()
set (@PACKAGE_
NAME
@_NOTHREADS TRUE)
set (@PACKAGE_
PREFIX
@_NOTHREADS TRUE)
endif ()
endif ()
# choose imported library target
if (NOT @PACKAGE_NAME@_TARGET)
if (@PACKAGE_NAME@_SHARED)
if (@PACKAGE_NAME@_NOTHREADS)
set (@PACKAGE_NAME@_TARGET @PACKAGE_NAME@_nothreads-shared)
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_NAME@_nothreads_shared)
else ()
set (@PACKAGE_
NAME@_TARGET @PACKAGE_NAME@-
shared)
set (@PACKAGE_
PREFIX@_TARGET @PACKAGE_NAME@_
shared)
endif ()
else ()
if (@PACKAGE_
NAME
@_NOTHREADS)
set (@PACKAGE_
NAME@_TARGET @PACKAGE_NAME@_nothreads-
static)
if (@PACKAGE_
PREFIX
@_NOTHREADS)
set (@PACKAGE_
PREFIX@_TARGET @PACKAGE_NAME@_nothreads_
static)
else ()
set (@PACKAGE_
NAME@_TARGET @PACKAGE_NAME@-
static)
set (@PACKAGE_
PREFIX@_TARGET @PACKAGE_NAME@_
static)
endif ()
endif ()
endif ()
if (NOT TARGET ${@PACKAGE_
NAME
@_TARGET})
message (FATAL_ERROR "Your @PACKAGE_NAME@ installation does not contain a ${@PACKAGE_
NAME
@_TARGET} library target!"
" Try a different combination of @PACKAGE_
NAME@_SHARED and @PACKAGE_NAME
@_NOTHREADS.")
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_NAME@" import target
if (NOT TARGET @PACKAGE_NAME@)
if (@PACKAGE_
NAME
@_SHARED)
if (@PACKAGE_
PREFIX
@_SHARED)
add_library (@PACKAGE_NAME@ SHARED IMPORTED)
else ()
add_library (@PACKAGE_NAME@ STATIC IMPORTED)
endif ()
# INTERFACE_INCLUDE_DIRECTORIES
get_target_property (_@PACKAGE_NAME@_INCLUDES ${@PACKAGE_NAME@_TARGET} INTERFACE_INCLUDE_DIRECTORIES)
if (_@PACKAGE_NAME@_INCLUDES)
set_target_properties(@PACKAGE_NAME@ PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_@PACKAGE_NAME@_INCLUDES}"
)
endif ()
unset (_@PACKAGE_NAME@_INCLUDES)
# set configuration specific properties
get_target_property (_@PACKAGE_NAME@_CONFIGURATIONS ${@PACKAGE_NAME@_TARGET} IMPORTED_CONFIGURATIONS)
set_target_properties (@PACKAGE_NAME@ PROPERTIES IMPORTED_CONFIGURATIONS "${_@PACKAGE_NAME@_CONFIGURATIONS}")
foreach (_@PACKAGE_NAME@_CONFIG IN LISTS _@PACKAGE_NAME@_CONFIGURATIONS)
# IMPORTED_LOCATION_<config>
get_target_property (_@PACKAGE_NAME@_LOCATION ${@PACKAGE_NAME@_TARGET} IMPORTED_LOCATION_${_@PACKAGE_NAME@_CONFIG})
if (_@PACKAGE_NAME@_LOCATION)
# 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_NAME@ PROPERTIES
I
MPORTED_LOCATION_${_@PACKAGE_NAME@_CONFIG} "${_@PACKAGE_NAME@_LOCATION
}"
I
NTERFACE_${_@PACKAGE_PREFIX@_PROPERTY_NAME} "${_@PACKAGE_PREFIX@_PROPERTY_VALUE
}"
)
endif ()
unset (_@PACKAGE_NAME@_LOCATION)
# IMPORTED_LINK_INTERFACE_LANGUAGES_<config> (static)
get_target_property (_@PACKAGE_NAME@_LANGUAGES ${@PACKAGE_NAME@_TARGET} IMPORTED_LINK_INTERFACE_LANGUAGES_${_@PACKAGE_NAME@_CONFIG})
if (_@PACKAGE_NAME@_LANGUAGES)
set_target_properties(@PACKAGE_NAME@ PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_${_@PACKAGE_NAME@_CONFIG} "${_@PACKAGE_NAME@_LANGUAGES}"
)
endif ()
unset (_@PACKAGE_NAME@_LANGUAGES)
# IMPORTED_SONAME_<config> (shared)
get_target_property (_@PACKAGE_NAME@_SONAME ${@PACKAGE_NAME@_TARGET} IMPORTED_SONAME_${_@PACKAGE_NAME@_CONFIG})
if (_@PACKAGE_NAME@_SONAME)
set_target_properties(@PACKAGE_NAME@ PROPERTIES
IMPORTED_SONAME_${_@PACKAGE_NAME@_CONFIG} "${_@PACKAGE_NAME@_SONAME}"
)
endif ()
unset (_@PACKAGE_NAME@_SONAME)
endforeach ()
unset (_@PACKAGE_NAME@_CONFIGURATIONS)
# copy IMPORTED_*_<CONFIG> properties
get_target_property (_@PACKAGE_PREFIX@_CONFIGURATIONS ${@PACKAGE_PREFIX@_TARGET} IMPORTED_CONFIGURATIONS)
set_target_properties (@PACKAGE_NAME@ PROPERTIES IMPORTED_CONFIGURATIONS "${_@PACKAGE_PREFIX@_CONFIGURATIONS}")
foreach (_@PACKAGE_PREFIX@_PROPERTY_NAME IN ITEMS
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_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_NAME@_LIBRARIES "${@PACKAGE_NAME@_TARGET}")
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)
cmake/utils.cmake
View file @
389ef3f7
...
...
@@ -11,7 +11,7 @@ macro (bool_to_int VAR)
endmacro
()
# ----------------------------------------------------------------------------
## Extract version numbers from version string
.
## 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
)
...
...
@@ -41,6 +41,73 @@ function (version_numbers version major minor patch)
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
)
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
)
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
)
...
...
test/CMakeLists.txt
View file @
389ef3f7
...
...
@@ -22,9 +22,9 @@ else ()
set
(
type static
)
endif
()
if
(
BUILD_gflags_LIB
)
link_libraries
(
gflags
-
${
type
}
)
link_libraries
(
gflags
_
${
type
}
)
else
()
link_libraries
(
gflags_nothreads
-
${
type
}
)
link_libraries
(
gflags_nothreads
_
${
type
}
)
endif
()
# ----------------------------------------------------------------------------
...
...
test/nc/CMakeLists.txt
View file @
389ef3f7
## gflags negative compilation tests
cmake_minimum_required
(
VERSION 2.8
)
cmake_minimum_required
(
VERSION 2.8
.12 FATAL_ERROR
)
if
(
NOT TEST_NAME
)
message
(
FATAL_ERROR
"Missing TEST_NAME CMake flag"
)
...
...
@@ -13,4 +13,4 @@ find_package (gflags REQUIRED)
include_directories
(
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/.."
)
add_definitions
(
-DTEST_
${
TEST_NAME_UPPER
}
)
add_executable
(
gflags_
${
TEST_NAME
}
gflags_nc.cc
)
target_link_libraries
(
gflags_
${
TEST_NAME
}
${
gflags_LIBRARIES
}
)
target_link_libraries
(
gflags_
${
TEST_NAME
}
gflags
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment