summaryrefslogtreecommitdiffstats
path: root/Source/cmCoreTryCompile.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-09-24 19:21:32 (GMT)
committerBrad King <brad.king@kitware.com>2015-09-24 19:26:32 (GMT)
commit710bde43aa5ed1ccfbcffa01d3d86a4eecbbe849 (patch)
tree3fcdacd95dcbd8d9829be02345a5153e3acf41b9 /Source/cmCoreTryCompile.cxx
parentcbfae8c3f2c971441d4943a630efe7b186ee0c44 (diff)
downloadCMake-710bde43aa5ed1ccfbcffa01d3d86a4eecbbe849.zip
CMake-710bde43aa5ed1ccfbcffa01d3d86a4eecbbe849.tar.gz
CMake-710bde43aa5ed1ccfbcffa01d3d86a4eecbbe849.tar.bz2
cmCoreTryCompile: Fix internal argument vector construction
In TryCompileCode we construct an internal argv[] vector that needs to have a fake argv[0] so our internal cmake command line looks like a real command line. Fix construction of the fake argv[0] when try_compile is called without the CMAKE_FLAGS argument. Otherwise the first internal -DVAR=val argument that we use to pass information like CMAKE_OSX_SYSROOT is ignored.
Diffstat (limited to 'Source/cmCoreTryCompile.cxx')
-rw-r--r--Source/cmCoreTryCompile.cxx6
1 files changed, 1 insertions, 5 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index e489ad2..3d9c4bf 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -29,7 +29,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
const char* sourceDirectory = argv[2].c_str();
const char* projectName = 0;
std::string targetName;
- std::vector<std::string> cmakeFlags;
+ std::vector<std::string> cmakeFlags(1, "CMAKE_FLAGS"); // fake argv[0]
std::vector<std::string> compileDefs;
std::string outputVariable;
std::string copyFile;
@@ -53,10 +53,6 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
if(argv[i] == "CMAKE_FLAGS")
{
doing = DoingCMakeFlags;
- // CMAKE_FLAGS is the first argument because we need an argv[0] that
- // is not used, so it matches regular command line parsing which has
- // the program name as arg 0
- cmakeFlags.push_back(argv[i]);
}
else if(argv[i] == "COMPILE_DEFINITIONS")
{