Commit 9ecc4cab authored by Andreas Schuh's avatar Andreas Schuh

Enable packaging of library using CPack.

parent ddc53574
This diff is collapsed.
......@@ -3,9 +3,9 @@ INSTALLING A BINARY DISTRIBUTION PACKAGE
========================================
No official binary distribution packages are provided by the gflags developers.
There may, however, be binary packages available for your OS, in particular
for various flavors of Linux. Please consult the package repositories of your
Linux distribution to see if a binary package is available.
There may, however, be binary packages available for your OS at
https://code.google.com/p/gflags/downloads/list. Please consult also the
package repositories of your Linux distribution.
For example on Debian/Ubuntu Linux, gflags can be installed using the
following command:
......
This repository contains the C++ implementation of the commandline flags module
originally developed at Google. Documentation for this module is in doc/.
The python version of gflags is now a separate project.
See INSTALL for (generic) installation instructions.
A commandline flags library that allows for distributed flags.
This package contains a library that implements commandline flags
processing. As such it's a replacement for getopt(). It has increased
flexibility, including built-in support for C++ types like string, and
the ability to define flags in the source file in which they're used.
The devel package contains static and debug libraries and header files
for developing applications that use the gflags package.
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.
# 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}$" STREQUAL "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_${CMAKE_SYSTEM_PROCESSOR}")
execute_process (
COMMAND dpkg --print-architecture
RESULT_VARIABLE RV
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
)
if (NOT RV EQUAL 0)
set (CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
endif ()
set (CPACK_DEBIAN_PACKAGE_DEPENDS)
set (CPACK_DEBIAN_PACKAGE_SECTION devel)
set (CPACK_DEBIAN_PACKAGE_PRIORITY optional)
# ------------------------------------------------------------------------------
# RPM package
elseif ("^${CPACK_GENERATOR}$" STREQUAL "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_${CMAKE_SYSTEM_PROCESSOR}")
endif ()
......@@ -86,8 +86,10 @@
// ---------------------------------------------------------------------------
// Windows
// Whether gflags library is shared.
#define GFLAGS_IS_A_DLL @GFLAGS_IS_A_DLL@
// Whether gflags library is a DLL.
#ifndef GFLAGS_IS_A_DLL
# define GFLAGS_IS_A_DLL 0
#endif
// Always export symbols when compiling a shared library as this file is only
// included by internal modules when building the gflags library itself.
......
......@@ -12,7 +12,17 @@ set (GFLAGS_FLAGFILES_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
# ----------------------------------------------------------------------------
# common include directories and link libraries
include_directories ("${CMAKE_CURRENT_SOURCE_DIR}")
link_libraries (gflags_nothreads)
if (BUILD_SHARED_LIBS)
set (type shared)
else ()
set (type static)
endif ()
if (BUILD_gflags_LIB)
link_libraries (gflags-${type})
else ()
link_libraries (gflags_nothreads-${type})
endif ()
# ----------------------------------------------------------------------------
# STRIP_FLAG_HELP
......@@ -35,7 +45,7 @@ add_executable (gflags_unittest gflags_unittest.cc)
add_executable (gflags_unittest-main gflags_unittest-main.cc)
add_executable (gflags_unittest_main gflags_unittest_main.cc)
if (WIN32 AND NOT CYGWIN)
if (OS_WINDOWS)
set (SLASH "\\\\")
else ()
set (SLASH "/")
......@@ -146,11 +156,11 @@ add_gflags_test(always_fail 1 "ERROR: failed validation of new value 'true' for
# ----------------------------------------------------------------------------
# (negative) compilation tests
if (BUILD_NEGATIVE_COMPILATION_TESTS)
if (BUILD_NC_TESTS)
find_package (PythonInterp)
if (NOT PYTHON_EXECUTABLE)
message (FATAL_ERROR "No Python installation found! It is required by the negative compilation tests."
" Either install Python or set NEGATIVE_COMPILATION_TESTS to FALSE and try again.")
" Either install Python or set BUILD_NC_TESTS to FALSE and try again.")
endif ()
set (SRCDIR "${CMAKE_CURRENT_SOURCE_DIR}/nc")
configure_file (gflags_nc.py.in "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nc.py" @ONLY)
......@@ -165,4 +175,4 @@ if (BUILD_NEGATIVE_COMPILATION_TESTS)
add_gflags_nc_test (int_instead_of_bool)
add_gflags_nc_test (bool_in_quotes)
add_gflags_nc_test (define_string_with_0)
endif ()
\ No newline at end of file
endif ()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment