summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-08-04 14:37:46 -0400
committerBrad King <brad.king@kitware.com>2009-08-04 14:37:46 -0400
commit80c947b3975825f2a9a7b1ebdc285e6b0cf6ba02 (patch)
tree85d047b0e5023e668a4804833198d4dcf767a539
parentf3cd1e06f5a5fb092f249de3e1b582125d067daa (diff)
downloadcmake-80c947b3975825f2a9a7b1ebdc285e6b0cf6ba02.tar.gz
No /fast targets in try_compile project mode
The try_compile command builds the cmTryCompileExec executable using the cmTryCompileExec/fast target with Makefile generators in order to save time since dependencies are not needed. However, in project mode the command builds an entire source tree that may have dependencies. Therefore we can use the /fast target approach only in one-source mode.
-rw-r--r--Source/cmCoreTryCompile.cxx1
-rw-r--r--Source/cmGlobalGenerator.cxx4
-rw-r--r--Source/cmGlobalGenerator.h2
-rw-r--r--Source/cmMakefile.cxx2
-rw-r--r--Source/cmMakefile.h1
-rw-r--r--Tests/TryCompile/CMakeLists.txt5
-rw-r--r--Tests/TryCompile/Inner/CMakeLists.txt4
-rw-r--r--Tests/TryCompile/Inner/innerexe.c2
-rw-r--r--Tests/TryCompile/Inner/innerlib.c1
9 files changed, 16 insertions, 6 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index c45a8063b2..02abf315c9 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -297,6 +297,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
this->BinaryDirectory.c_str(),
projectName,
targetName,
+ this->SrcFileSignature,
&cmakeFlags,
&output);
if ( erroroc )
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index a7982005b8..f4fa6f42a7 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1026,7 +1026,7 @@ void cmGlobalGenerator::CheckLocalGenerators()
int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir,
const char *projectName,
- const char *target,
+ const char *target, bool fast,
std::string *output, cmMakefile *mf)
{
// if this is not set, then this is a first time configure
@@ -1077,7 +1077,7 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir,
const char* config = mf->GetDefinition("CMAKE_TRY_COMPILE_CONFIGURATION");
return this->Build(srcdir,bindir,projectName,
newTarget.c_str(),
- output,makeCommand.c_str(),config,false,true,
+ output,makeCommand.c_str(),config,false,fast,
this->TryCompileTimeout);
}
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 4b60778641..c2e410f239 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -91,7 +91,7 @@ public:
*/
virtual int TryCompile(const char *srcdir, const char *bindir,
const char *projectName, const char *targetName,
- std::string *output, cmMakefile* mf);
+ bool fast, std::string *output, cmMakefile* mf);
/**
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 648639c590..5057ef4214 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2728,6 +2728,7 @@ void cmMakefile::ExpandSourceListArguments(
int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
const char *projectName, const char *targetName,
+ bool fast,
const std::vector<std::string> *cmakeArgs,
std::string *output)
{
@@ -2808,6 +2809,7 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
this->LocalGenerator->GetGlobalGenerator()->TryCompile(srcdir,bindir,
projectName,
targetName,
+ fast,
output,
this);
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 5cd3587c28..7123eb5c26 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -121,6 +121,7 @@ public:
*/
int TryCompile(const char *srcdir, const char *bindir,
const char *projectName, const char *targetName,
+ bool fast,
const std::vector<std::string> *cmakeArgs,
std::string *output);
diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt
index 7895d39851..5925a871d3 100644
--- a/Tests/TryCompile/CMakeLists.txt
+++ b/Tests/TryCompile/CMakeLists.txt
@@ -110,8 +110,9 @@ MESSAGE("Testing try_compile project mode")
TRY_COMPILE(TEST_INNER
${TryCompile_BINARY_DIR}/CMakeFiles/Inner
${TryCompile_SOURCE_DIR}/Inner
- TryCompileInner)
-TEST_ASSERT(TEST_INNER "try_compile project mode failed")
+ TryCompileInner innerexe
+ OUTPUT_VARIABLE output)
+TEST_ASSERT(TEST_INNER "try_compile project mode failed:\n${output}")
ADD_EXECUTABLE(TryCompile pass.c)
diff --git a/Tests/TryCompile/Inner/CMakeLists.txt b/Tests/TryCompile/Inner/CMakeLists.txt
index 41b94aec41..d62bcc4dd2 100644
--- a/Tests/TryCompile/Inner/CMakeLists.txt
+++ b/Tests/TryCompile/Inner/CMakeLists.txt
@@ -10,4 +10,6 @@ if(NOT SHOULD_PASS)
message(FATAL_ERROR "Inner try-compile SHOULD_PASS failed!")
endif()
-add_executable(inner ../pass.c)
+add_library(innerlib innerlib.c)
+add_executable(innerexe innerexe.c)
+target_link_libraries(innerexe innerlib)
diff --git a/Tests/TryCompile/Inner/innerexe.c b/Tests/TryCompile/Inner/innerexe.c
new file mode 100644
index 0000000000..9b121a17d7
--- /dev/null
+++ b/Tests/TryCompile/Inner/innerexe.c
@@ -0,0 +1,2 @@
+extern int innerlib(void);
+int main() { return innerlib(); }
diff --git a/Tests/TryCompile/Inner/innerlib.c b/Tests/TryCompile/Inner/innerlib.c
new file mode 100644
index 0000000000..0ce11799be
--- /dev/null
+++ b/Tests/TryCompile/Inner/innerlib.c
@@ -0,0 +1 @@
+int innerlib(void) { return 0; }