summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2006-07-26 15:46:22 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2006-07-26 15:46:22 (GMT)
commita9c0929d3938e432484cc2c3e44bf79167ed010d (patch)
treee9b9ebe3403518d16eb3cee89f32801828341e55
parent47ef50453004e62510f5705185d912950e8fb68f (diff)
downloadCMake-a9c0929d3938e432484cc2c3e44bf79167ed010d.zip
CMake-a9c0929d3938e432484cc2c3e44bf79167ed010d.tar.gz
CMake-a9c0929d3938e432484cc2c3e44bf79167ed010d.tar.bz2
COMP: Handle both ansi and non-ansi C
-rw-r--r--Modules/CMakeTestCCompiler.cmake3
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx1
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx2
-rw-r--r--Source/cmIncludeDirectoryCommand.cxx8
-rw-r--r--Source/cmMakefile.cxx2
-rw-r--r--Source/cmSystemTools.cxx2
-rwxr-xr-xbootstrap17
7 files changed, 31 insertions, 4 deletions
diff --git a/Modules/CMakeTestCCompiler.cmake b/Modules/CMakeTestCCompiler.cmake
index 0beadd8..9b9a51a 100644
--- a/Modules/CMakeTestCCompiler.cmake
+++ b/Modules/CMakeTestCCompiler.cmake
@@ -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)
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 6a37ba9..a8c2861 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -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;
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index 51a4d3a..1d37a34 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -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 )
{
diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx
index b493eb3..39492a6 100644
--- a/Source/cmIncludeDirectoryCommand.cxx
+++ b/Source/cmIncludeDirectoryCommand.cxx
@@ -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;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 49bf647..871a81b 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -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
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index bc9af6a..4d257b2 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1338,7 +1338,7 @@ std::string cmSystemTools::MakeXMLSafe(const char* str)
&& ch != '\r' )
{
char buffer[33];
- sprintf(buffer, "&lt;%d&gt;", (int)ch);
+ sprintf(buffer, "&lt;%d&gt;", static_cast<int>(ch));
//sprintf(buffer, "&#x%0x;", (unsigned int)ch);
result.insert(result.end(), buffer, buffer+strlen(buffer));
}
diff --git a/bootstrap b/bootstrap
index 9dff3df..047f0f1 100755
--- a/bootstrap
+++ b/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;