diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2006-07-26 15:46:22 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2006-07-26 15:46:22 (GMT) |
commit | a9c0929d3938e432484cc2c3e44bf79167ed010d (patch) | |
tree | e9b9ebe3403518d16eb3cee89f32801828341e55 | |
parent | 47ef50453004e62510f5705185d912950e8fb68f (diff) | |
download | CMake-a9c0929d3938e432484cc2c3e44bf79167ed010d.zip CMake-a9c0929d3938e432484cc2c3e44bf79167ed010d.tar.gz CMake-a9c0929d3938e432484cc2c3e44bf79167ed010d.tar.bz2 |
COMP: Handle both ansi and non-ansi C
-rw-r--r-- | Modules/CMakeTestCCompiler.cmake | 3 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 1 | ||||
-rw-r--r-- | Source/cmCommandArgumentParserHelper.cxx | 2 | ||||
-rw-r--r-- | Source/cmIncludeDirectoryCommand.cxx | 8 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 2 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 2 | ||||
-rwxr-xr-x | bootstrap | 17 |
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, "<%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)); } @@ -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; |