|
@@ -238,7 +238,7 @@ std::set<std::string> const ghs_platform_vars{
|
|
|
int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
|
|
int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
|
|
|
bool isTryRun)
|
|
bool isTryRun)
|
|
|
{
|
|
{
|
|
|
- this->BinaryDirectory = argv[1];
|
|
|
|
|
|
|
+ std::string const& resultVar = argv[0];
|
|
|
this->OutputFile.clear();
|
|
this->OutputFile.clear();
|
|
|
// which signature were we called with ?
|
|
// which signature were we called with ?
|
|
|
this->SrcFileSignature = true;
|
|
this->SrcFileSignature = true;
|
|
@@ -264,7 +264,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- std::string sourceDirectory = argv[2];
|
|
|
|
|
|
|
+ std::string sourceDirectory;
|
|
|
std::string projectName;
|
|
std::string projectName;
|
|
|
std::string targetName;
|
|
std::string targetName;
|
|
|
std::vector<std::string> cmakeFlags(1, "CMAKE_FLAGS"); // fake argv[0]
|
|
std::vector<std::string> cmakeFlags(1, "CMAKE_FLAGS"); // fake argv[0]
|
|
@@ -287,7 +287,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
|
|
|
bool didOutputVariable = false;
|
|
bool didOutputVariable = false;
|
|
|
bool didCopyFile = false;
|
|
bool didCopyFile = false;
|
|
|
bool didCopyFileError = false;
|
|
bool didCopyFileError = false;
|
|
|
- bool useSources = argv[2] == "SOURCES";
|
|
|
|
|
|
|
+ bool useSources = false;
|
|
|
std::vector<std::string> sources;
|
|
std::vector<std::string> sources;
|
|
|
|
|
|
|
|
enum Doing
|
|
enum Doing
|
|
@@ -303,9 +303,12 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
|
|
|
DoingSources,
|
|
DoingSources,
|
|
|
DoingCMakeInternal
|
|
DoingCMakeInternal
|
|
|
};
|
|
};
|
|
|
- Doing doing = useSources ? DoingSources : DoingNone;
|
|
|
|
|
- for (size_t i = 3; i < argv.size(); ++i) {
|
|
|
|
|
- if (argv[i] == "CMAKE_FLAGS") {
|
|
|
|
|
|
|
+ Doing doing = DoingNone;
|
|
|
|
|
+ for (size_t i = 1; i < argv.size(); ++i) {
|
|
|
|
|
+ if (argv[i] == "SOURCES") {
|
|
|
|
|
+ useSources = true;
|
|
|
|
|
+ doing = DoingSources;
|
|
|
|
|
+ } else if (argv[i] == "CMAKE_FLAGS") {
|
|
|
doing = DoingCMakeFlags;
|
|
doing = DoingCMakeFlags;
|
|
|
} else if (argv[i] == "COMPILE_DEFINITIONS") {
|
|
} else if (argv[i] == "COMPILE_DEFINITIONS") {
|
|
|
doing = DoingCompileDefinitions;
|
|
doing = DoingCompileDefinitions;
|
|
@@ -379,6 +382,10 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
|
|
|
} else if (doing == DoingCMakeInternal) {
|
|
} else if (doing == DoingCMakeInternal) {
|
|
|
cmakeInternal = argv[i];
|
|
cmakeInternal = argv[i];
|
|
|
doing = DoingNone;
|
|
doing = DoingNone;
|
|
|
|
|
+ } else if (i == 1) {
|
|
|
|
|
+ this->BinaryDirectory = argv[i];
|
|
|
|
|
+ } else if (i == 2) {
|
|
|
|
|
+ sourceDirectory = argv[i];
|
|
|
} else if (i == 3) {
|
|
} else if (i == 3) {
|
|
|
this->SrcFileSignature = false;
|
|
this->SrcFileSignature = false;
|
|
|
projectName = argv[i];
|
|
projectName = argv[i];
|
|
@@ -1012,7 +1019,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// set the result var to the return value to indicate success or failure
|
|
// set the result var to the return value to indicate success or failure
|
|
|
- this->Makefile->AddCacheDefinition(argv[0], (res == 0 ? "TRUE" : "FALSE"),
|
|
|
|
|
|
|
+ this->Makefile->AddCacheDefinition(resultVar, (res == 0 ? "TRUE" : "FALSE"),
|
|
|
"Result of TRY_COMPILE",
|
|
"Result of TRY_COMPILE",
|
|
|
cmStateEnums::INTERNAL);
|
|
cmStateEnums::INTERNAL);
|
|
|
|
|
|