summaryrefslogtreecommitdiffstats
path: root/Source/cmakemain.cxx
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2011-08-25 19:40:49 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2011-08-25 19:40:49 (GMT)
commit28cba226b352e04c96441f8ca051edf98c68994e (patch)
treec05a39ab6389f588dcb0b5ef0b9d864753ca6555 /Source/cmakemain.cxx
parentf5115f91d974e866b21a7c65386fcda34221e6bf (diff)
parent59238dc2deb80f3f3d101de9a3945f890981a2c0 (diff)
downloadCMake-28cba226b352e04c96441f8ca051edf98c68994e.zip
CMake-28cba226b352e04c96441f8ca051edf98c68994e.tar.gz
CMake-28cba226b352e04c96441f8ca051edf98c68994e.tar.bz2
Merge topic 'UsingCMakeLikePkgConfig2'
59238dc Fix --find-package mode on Cygwin, where enable_language(RC) is called 98472e4 Require the current cmake version in --find-package mode a6ccf3c Use $(CXXFLAGS) and $(LDFLAGS) in the --find-package test Makefile 4386918 Fix line length 7d69310 Only enable the test when using GNU make 3011149 Make the test harder by always having a space in the include dirs ab57ff6 Make the --find-package test harder 626fc71 Much improved test, should now be executed on all UNIXes ec6982d Disable any STATUS output in --find-package mode e552ae7 Dont check for -isysroot and -mmacosx-version on OSX in --find-package mode e589589 Rename helper macros print_compile_flags() to set_compile_flags_var() aecfc1f Fix test on OpenBSD with BSD make 6bb4ca3 The makefile for the test was kindof wrong fd15b5e Only run the test if we are using a makefile generator under UNIX 9fc87c6 Add a test for the new --find-package mode d3ae0ff Improve documentation for --find-package mode bf07375 Add a cmake.m4 for using cmake in autoconf projects instead of pkgconfig b0e3578 Use the file-utility to test for 64bit if there is no /usr/lib64 53edfb2 Better support for lib64 and Debian multiarch b8fdaa1 Fix copyright notice in new CMakeFindPackageMode.cmake 7690edf Replace cmake::GetScriptMode() with GetWorkingMode() e4f603b Implement find-package mode of cmake a91d662 Add find-package mode, which does nothing yet b976e70 Make clLocalGenerator::GetTargetFlags() public
Diffstat (limited to 'Source/cmakemain.cxx')
-rw-r--r--Source/cmakemain.cxx17
1 files changed, 14 insertions, 3 deletions
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 1fe9e82..9f213a5 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -103,6 +103,11 @@ static const char * cmDocumentationOptions[][3] =
"No configure or generate step is performed and the cache is not"
" modified. If variables are defined using -D, this must be done "
"before the -P argument."},
+ {"--find-package", "Run in pkg-config like mode.",
+ "Search a package using find_package() and print the resulting flags "
+ "to stdout. This can be used to use cmake instead of pkg-config to find "
+ "installed libraries in plain Makefile-based projects or in "
+ "autoconf-based projects (via share/aclocal/cmake.m4)."},
{"--graphviz=[file]", "Generate graphviz of dependencies.",
"Generate a graphviz input file that will contain all the library and "
"executable dependencies in the project."},
@@ -434,7 +439,7 @@ int do_cmake(int ac, char** av)
bool list_all_cached = false;
bool list_help = false;
bool view_only = false;
- bool script_mode = false;
+ cmake::WorkingMode workingMode = cmake::NORMAL_MODE;
std::vector<std::string> args;
for(int i =0; i < ac; ++i)
{
@@ -482,12 +487,18 @@ int do_cmake(int ac, char** av)
}
else
{
- script_mode = true;
+ workingMode = cmake::SCRIPT_MODE;
args.push_back(av[i]);
i++;
args.push_back(av[i]);
}
}
+ else if (!command && strncmp(av[i], "--find-package",
+ strlen("--find-package")) == 0)
+ {
+ workingMode = cmake::FIND_PACKAGE_MODE;
+ args.push_back(av[i]);
+ }
else
{
args.push_back(av[i]);
@@ -512,7 +523,7 @@ int do_cmake(int ac, char** av)
cmake cm;
cmSystemTools::SetErrorCallback(cmakemainErrorCallback, (void *)&cm);
cm.SetProgressCallback(cmakemainProgressCallback, (void *)&cm);
- cm.SetScriptMode(script_mode);
+ cm.SetWorkingMode(workingMode);
int res = cm.Run(args, view_only);
if ( list_cached || list_all_cached )