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.
This commit is contained in:
parent
f3cd1e06f5
commit
80c947b397
@ -297,6 +297,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
|
|||||||
this->BinaryDirectory.c_str(),
|
this->BinaryDirectory.c_str(),
|
||||||
projectName,
|
projectName,
|
||||||
targetName,
|
targetName,
|
||||||
|
this->SrcFileSignature,
|
||||||
&cmakeFlags,
|
&cmakeFlags,
|
||||||
&output);
|
&output);
|
||||||
if ( erroroc )
|
if ( erroroc )
|
||||||
|
@ -1026,7 +1026,7 @@ void cmGlobalGenerator::CheckLocalGenerators()
|
|||||||
|
|
||||||
int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir,
|
int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir,
|
||||||
const char *projectName,
|
const char *projectName,
|
||||||
const char *target,
|
const char *target, bool fast,
|
||||||
std::string *output, cmMakefile *mf)
|
std::string *output, cmMakefile *mf)
|
||||||
{
|
{
|
||||||
// if this is not set, then this is a first time configure
|
// 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");
|
const char* config = mf->GetDefinition("CMAKE_TRY_COMPILE_CONFIGURATION");
|
||||||
return this->Build(srcdir,bindir,projectName,
|
return this->Build(srcdir,bindir,projectName,
|
||||||
newTarget.c_str(),
|
newTarget.c_str(),
|
||||||
output,makeCommand.c_str(),config,false,true,
|
output,makeCommand.c_str(),config,false,fast,
|
||||||
this->TryCompileTimeout);
|
this->TryCompileTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual int TryCompile(const char *srcdir, const char *bindir,
|
virtual int TryCompile(const char *srcdir, const char *bindir,
|
||||||
const char *projectName, const char *targetName,
|
const char *projectName, const char *targetName,
|
||||||
std::string *output, cmMakefile* mf);
|
bool fast, std::string *output, cmMakefile* mf);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2728,6 +2728,7 @@ void cmMakefile::ExpandSourceListArguments(
|
|||||||
|
|
||||||
int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
|
int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
|
||||||
const char *projectName, const char *targetName,
|
const char *projectName, const char *targetName,
|
||||||
|
bool fast,
|
||||||
const std::vector<std::string> *cmakeArgs,
|
const std::vector<std::string> *cmakeArgs,
|
||||||
std::string *output)
|
std::string *output)
|
||||||
{
|
{
|
||||||
@ -2808,6 +2809,7 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
|
|||||||
this->LocalGenerator->GetGlobalGenerator()->TryCompile(srcdir,bindir,
|
this->LocalGenerator->GetGlobalGenerator()->TryCompile(srcdir,bindir,
|
||||||
projectName,
|
projectName,
|
||||||
targetName,
|
targetName,
|
||||||
|
fast,
|
||||||
output,
|
output,
|
||||||
this);
|
this);
|
||||||
|
|
||||||
|
@ -121,6 +121,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
int TryCompile(const char *srcdir, const char *bindir,
|
int TryCompile(const char *srcdir, const char *bindir,
|
||||||
const char *projectName, const char *targetName,
|
const char *projectName, const char *targetName,
|
||||||
|
bool fast,
|
||||||
const std::vector<std::string> *cmakeArgs,
|
const std::vector<std::string> *cmakeArgs,
|
||||||
std::string *output);
|
std::string *output);
|
||||||
|
|
||||||
|
@ -110,8 +110,9 @@ MESSAGE("Testing try_compile project mode")
|
|||||||
TRY_COMPILE(TEST_INNER
|
TRY_COMPILE(TEST_INNER
|
||||||
${TryCompile_BINARY_DIR}/CMakeFiles/Inner
|
${TryCompile_BINARY_DIR}/CMakeFiles/Inner
|
||||||
${TryCompile_SOURCE_DIR}/Inner
|
${TryCompile_SOURCE_DIR}/Inner
|
||||||
TryCompileInner)
|
TryCompileInner innerexe
|
||||||
TEST_ASSERT(TEST_INNER "try_compile project mode failed")
|
OUTPUT_VARIABLE output)
|
||||||
|
TEST_ASSERT(TEST_INNER "try_compile project mode failed:\n${output}")
|
||||||
|
|
||||||
ADD_EXECUTABLE(TryCompile pass.c)
|
ADD_EXECUTABLE(TryCompile pass.c)
|
||||||
|
|
||||||
|
@ -10,4 +10,6 @@ if(NOT SHOULD_PASS)
|
|||||||
message(FATAL_ERROR "Inner try-compile SHOULD_PASS failed!")
|
message(FATAL_ERROR "Inner try-compile SHOULD_PASS failed!")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(inner ../pass.c)
|
add_library(innerlib innerlib.c)
|
||||||
|
add_executable(innerexe innerexe.c)
|
||||||
|
target_link_libraries(innerexe innerlib)
|
||||||
|
2
Tests/TryCompile/Inner/innerexe.c
Normal file
2
Tests/TryCompile/Inner/innerexe.c
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
extern int innerlib(void);
|
||||||
|
int main() { return innerlib(); }
|
1
Tests/TryCompile/Inner/innerlib.c
Normal file
1
Tests/TryCompile/Inner/innerlib.c
Normal file
@ -0,0 +1 @@
|
|||||||
|
int innerlib(void) { return 0; }
|
Loading…
x
Reference in New Issue
Block a user