gtest-config

提供: C++入門
移動: 案内検索
スポンサーリンク


gtest-config は、 Google Test (Google C++ Testing Framework) で提供されるコマンドです。コンパイルやリンクのフラグを提供します。

読み方

gtest-config
じーてすと こんふぃぐ

概要

Google Test を利用したコードをビルドする際に、gtest-configを利用することで、コンパイルオプションを簡単に記述できます。

Usage

Usage: gtest-config [OPTIONS...]
 
The `gtest-config' script provides access to the necessary compile and linking
flags to connect with Google C++ Testing Framework, both in a build prior to
installation, and on the system proper after installation. The installation
overrides may be issued in combination with any other queries, but will only
affect installation queries if called on a built but not installed gtest. The
installation queries may not be issued with any other types of queries, and
only one installation query may be made at a time. The version queries and
compiler flag queries may be combined as desired but not mixed. Different
version queries are always combined with logical "and" semantics, and only the
last of any particular query is used while all previous ones ignored. All
versions must be specified as a sequence of numbers separated by periods.
Compiler flag queries output the union of the sets of flags when combined.
 
 Examples:
  gtest-config --min-version=1.0 || echo "Insufficient Google Test version."
 
  g++ $(gtest-config --cppflags --cxxflags) -o foo.o -c foo.cpp
  g++ $(gtest-config --ldflags --libs) -o foo foo.o
 
  # When using a built but not installed Google Test:
  g++ $(../../my_gtest_build/scripts/gtest-config ...) ...
 
  # When using an installed Google Test, but with installation overrides:
  export GTEST_PREFIX="/opt"
  g++ $(gtest-config --libdir="/opt/lib64" ...) ...
 
 Help:
  --usage                    brief usage information
  --help                     display this help message
 
 Installation Overrides:
  --prefix=<dir>             overrides the installation prefix
  --exec-prefix=<dir>        overrides the executable installation prefix
  --libdir=<dir>             overrides the library installation prefix
  --includedir=<dir>         overrides the header file installation prefix
 
 Installation Queries:
  --prefix                   installation prefix
  --exec-prefix              executable installation prefix
  --libdir                   library installation directory
  --includedir               header file installation directory
  --version                  the version of the Google Test installation
 
 Version Queries:
  --min-version=VERSION      return 0 if the version is at least VERSION
  --exact-version=VERSION    return 0 if the version is exactly VERSION
  --max-version=VERSION      return 0 if the version is at most VERSION
 
 Compilation Flag Queries:
  --cppflags                 compile flags specific to the C-like preprocessors
  --cxxflags                 compile flags appropriate for C++ programs
  --ldflags                  linker flags
  --libs                     libraries for linking


実行例

g++ $(gtest-config --cppflags --cxxflags) -o foo.o -c foo.cpp
g++ $(gtest-config --ldflags --libs) -o foo foo.o

関連項目




スポンサーリンク