COMP: Handle both ansi and non-ansi C
This commit is contained in:
parent
47ef504530
commit
a9c0929d39
|
@ -10,7 +10,8 @@ IF(NOT CMAKE_C_COMPILER_WORKS)
|
|||
"#ifdef __cplusplus\n"
|
||||
"# error \"The CMAKE_C_COMPILER is set to a C++ compiler\"\n"
|
||||
"#endif\n"
|
||||
"int main(){return 0;}\n")
|
||||
"#include <stdio.h>\n"
|
||||
"int main(int argc, char* argv[]){ printf(\"%s\\n\", argv[0]); return argc-1;}\n")
|
||||
TRY_COMPILE(CMAKE_C_COMPILER_WORKS ${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler.c
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
|
|
|
@ -684,6 +684,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
|
|||
<< std::endl;
|
||||
cmCTestLog(this->CTest, ERROR_MESSAGE, "Unable to find executable: "
|
||||
<< args[1].c_str() << std::endl);
|
||||
cres.Output = "Unable to find executable: " + args[1];
|
||||
if ( !this->CTest->GetShowOnly() )
|
||||
{
|
||||
cres.FullCommandLine = actualCommand;
|
||||
|
|
|
@ -139,7 +139,7 @@ void cmCommandArgumentParserHelper::AllocateParserType
|
|||
pt->str = 0;
|
||||
if ( len == 0 )
|
||||
{
|
||||
len = (int)strlen(str);
|
||||
len = static_cast<int>(strlen(str));
|
||||
}
|
||||
if ( len == 0 )
|
||||
{
|
||||
|
|
|
@ -56,6 +56,14 @@ bool cmIncludeDirectoryCommand
|
|||
tmp += unixPath;
|
||||
unixPath = tmp;
|
||||
}
|
||||
/*
|
||||
if ( !cmSystemTools::FileExists(unixPath.c_str()) )
|
||||
{
|
||||
std::string out = "Cannot find directory: " + unixPath;
|
||||
this->SetError(out.c_str());
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
this->Makefile->AddIncludeDirectory(unixPath.c_str(), before);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -905,7 +905,7 @@ void cmMakefile::AddLinkLibraryForTarget(const char *target,
|
|||
{
|
||||
cmOStringStream e;
|
||||
e << "Attempt to add link target " << lib << " of type: "
|
||||
<< cmTarget::TargetTypeNames[(int)tgt->GetType()]
|
||||
<< cmTarget::TargetTypeNames[static_cast<int>(tgt->GetType())]
|
||||
<< "\nto target " << target
|
||||
<< ". You can only link to STATIC or SHARED libraries.";
|
||||
// in older versions of cmake linking to modules was allowed
|
||||
|
|
|
@ -1338,7 +1338,7 @@ std::string cmSystemTools::MakeXMLSafe(const char* str)
|
|||
&& ch != '\r' )
|
||||
{
|
||||
char buffer[33];
|
||||
sprintf(buffer, "<%d>", (int)ch);
|
||||
sprintf(buffer, "<%d>", static_cast<int>(ch));
|
||||
//sprintf(buffer, "&#x%0x;", (unsigned int)ch);
|
||||
result.insert(result.end(), buffer, buffer+strlen(buffer));
|
||||
}
|
||||
|
|
17
bootstrap
17
bootstrap
|
@ -537,7 +537,24 @@ fi
|
|||
TMPFILE=`cmake_tmp_file`
|
||||
cat > "${TMPFILE}.c" <<EOF
|
||||
#include<stdio.h>
|
||||
#if defined(__hpux) && !defined(__GNUC__)
|
||||
# if defined(__CLASSIC_C__)
|
||||
/* No ansi option given. */
|
||||
# define bootstrap_require_no_prototype
|
||||
# elif defined(__STDC_EXT__)
|
||||
/* Option -Ae given. */
|
||||
# else
|
||||
/* Option -Aa given. */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef bootstrap_require_no_prototype
|
||||
int main(argc, argv)
|
||||
int argc;
|
||||
char* argv[];
|
||||
#else
|
||||
int main(int argc, char* argv[])
|
||||
#endif
|
||||
{
|
||||
printf("%d\n", (argv != 0));
|
||||
return argc-1;
|
||||
|
|
Loading…
Reference in New Issue