From 1756aa5780571879ffbc2f77c2ae04cc1953002b Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Thu, 27 Jul 2006 10:37:12 -0400 Subject: ENH: move changes from main tree to branch --- ChangeLog.manual | 4 +++ Modules/CMakeCommonLanguageInclude.cmake | 6 ++-- Modules/CMakeTestCCompiler.cmake | 10 +++++- Modules/Platform/Windows-cl.cmake | 26 ++++++++++---- Source/CTest/cmCTestTestHandler.cxx | 1 + Source/cmCommandArgumentParserHelper.cxx | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- Source/cmMakefile.cxx | 2 +- Source/cmSystemTools.cxx | 2 +- Tests/LoadCommand/CMakeCommands/cmTestCommand.c | 2 +- Tests/LoadCommand/LoadedCommand.cxx | 41 ---------------------- .../CMakeCommands/cmTestCommand.c | 2 +- Tests/LoadCommandOneConfig/LoadedCommand.cxx | 41 ---------------------- bootstrap | 17 +++++++-- 14 files changed, 57 insertions(+), 101 deletions(-) delete mode 100644 Tests/LoadCommand/LoadedCommand.cxx delete mode 100644 Tests/LoadCommandOneConfig/LoadedCommand.cxx diff --git a/ChangeLog.manual b/ChangeLog.manual index 8da27e9..ed79ce3 100644 --- a/ChangeLog.manual +++ b/ChangeLog.manual @@ -1,5 +1,9 @@ Changes in CMake 2.4.3 +* better prototype for main in try compile of c programs avoids warnings in logs. + +* with visual studio do not use incremental linking for release builds by default. + * fix bootstrap to use more ansi c main it test compiler * fix import build settings to do case insensitive match on windows diff --git a/Modules/CMakeCommonLanguageInclude.cmake b/Modules/CMakeCommonLanguageInclude.cmake index cb4aee6..373a9a3 100644 --- a/Modules/CMakeCommonLanguageInclude.cmake +++ b/Modules/CMakeCommonLanguageInclude.cmake @@ -20,7 +20,7 @@ IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) SET (CMAKE_EXE_LINKER_FLAGS_MINSIZEREL ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT} CACHE STRING "Flags used by the linker during release minsize builds.") - SET (CMAKE_EXE_LINKER_FLAGS_RELEASE ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT} "" CACHE STRING + SET (CMAKE_EXE_LINKER_FLAGS_RELEASE ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT} CACHE STRING "Flags used by the linker during release builds.") SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO @@ -34,7 +34,7 @@ IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) CACHE STRING "Flags used by the linker during release minsize builds.") - SET (CMAKE_SHARED_LINKER_FLAGS_RELEASE ${CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT} "" CACHE STRING + SET (CMAKE_SHARED_LINKER_FLAGS_RELEASE ${CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT} CACHE STRING "Flags used by the linker during release builds.") SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO @@ -48,7 +48,7 @@ IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) CACHE STRING "Flags used by the linker during release minsize builds.") - SET (CMAKE_MODULE_LINKER_FLAGS_RELEASE ${CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT} "" CACHE STRING + SET (CMAKE_MODULE_LINKER_FLAGS_RELEASE ${CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT} CACHE STRING "Flags used by the linker during release builds.") SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO diff --git a/Modules/CMakeTestCCompiler.cmake b/Modules/CMakeTestCCompiler.cmake index 0beadd8..639baee 100644 --- a/Modules/CMakeTestCCompiler.cmake +++ b/Modules/CMakeTestCCompiler.cmake @@ -10,7 +10,15 @@ 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 \n" + "#if defined(__CLASSIC_C__)\n" + "int main(argc, argv)\n" + " int argc;\n" + " char* argv[];\n" + "#else\n" + "int main(int argc, char* argv[])\n" + "#endif\n" + "{ 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/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake index 594029b..ba306ad 100644 --- a/Modules/Platform/Windows-cl.cmake +++ b/Modules/Platform/Windows-cl.cmake @@ -255,25 +255,39 @@ SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") # executable linker flags SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") +# set the stack size and the machine type IF(CMAKE_CL_64) - SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /machine:x64 /INCREMENTAL:YES") + SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /machine:x64") ELSE(CMAKE_CL_64) - SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /machine:I386 /INCREMENTAL:YES") + SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /machine:I386") ENDIF(CMAKE_CL_64) + +# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtyp +# on versions that support it IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) - SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept") - SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept") + SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept /INCREMENTAL:YES") + SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept /INCREMENTAL:YES") ELSE (CMAKE_COMPILER_SUPPORTS_PDBTYPE) - SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug") - SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug") + SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /INCREMENTAL:YES") + SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /INCREMENTAL:YES") ENDIF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) +# for release and minsize release default to no incremental linking +SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT "/INCREMENTAL:NO") +SET(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "/INCREMENTAL:NO") +# copy the EXE_LINKER flags to SHARED and MODULE linker flags +# shared linker flags SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) +# module linker flags SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) # save computed information for this platform diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 28cbc61..3ec419a 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -684,6 +684,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector &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(strlen(str)); } if ( len == 0 ) { diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 0a2226f..444fc92 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -791,7 +791,7 @@ cmGlobalUnixMakefileGenerator3 } commands.push_back(progCmd.str()); } - progressDir = "Building target "; + progressDir = "Built target "; progressDir += t->first; lg->AppendEcho(commands,progressDir.c_str()); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 5027021..bbcc044 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(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(ch)); //sprintf(buffer, "&#x%0x;", (unsigned int)ch); result.insert(result.end(), buffer, buffer+strlen(buffer)); } diff --git a/Tests/LoadCommand/CMakeCommands/cmTestCommand.c b/Tests/LoadCommand/CMakeCommands/cmTestCommand.c index 84d1619..36bf33b 100644 --- a/Tests/LoadCommand/CMakeCommands/cmTestCommand.c +++ b/Tests/LoadCommand/CMakeCommands/cmTestCommand.c @@ -166,7 +166,7 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) } info->CAPI->ExecuteCommand(mf,"SET",2,args); - // make sure we can find the source file + /* make sure we can find the source file */ if (!info->CAPI->GetSource(mf,argv[1])) { info->CAPI->SetError(mf, "Source file could not be found!"); diff --git a/Tests/LoadCommand/LoadedCommand.cxx b/Tests/LoadCommand/LoadedCommand.cxx deleted file mode 100644 index c58bcf1..0000000 --- a/Tests/LoadCommand/LoadedCommand.cxx +++ /dev/null @@ -1,41 +0,0 @@ -#include "LoadedCommand.h" -#include - -int testSizeOf(int s1, int s2) -{ - return s1 - s2; -} - -int main () -{ - int ret = 0; -#ifdef HAVE_VSBLABLA - printf("Should not be able to find vsblabla\n"); - ret = 1; -#endif - -#if !defined( HAVE_PRINTF ) - printf("Should be able to find printf\n"); - ret= 1; -#endif - -#if !defined( ADDED_DEFINITION ) - printf("Should have ADDED_DEFINITION defined\n"); - ret= 1; -#endif -#if !defined(CMAKE_IS_FUN) - printf("Loaded Command was not built with CMAKE_IS_FUN: failed.\n"); - ret = 1; -#endif - if(testSizeOf(SIZEOF_CHAR, sizeof(char))) - { - printf("Size of char is broken.\n"); - ret = 1; - } - if(testSizeOf(SIZEOF_SHORT, sizeof(short))) - { - printf("Size of short is broken.\n"); - ret = 1; - } - return ret; -} diff --git a/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c b/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c index 84d1619..36bf33b 100644 --- a/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c +++ b/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c @@ -166,7 +166,7 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) } info->CAPI->ExecuteCommand(mf,"SET",2,args); - // make sure we can find the source file + /* make sure we can find the source file */ if (!info->CAPI->GetSource(mf,argv[1])) { info->CAPI->SetError(mf, "Source file could not be found!"); diff --git a/Tests/LoadCommandOneConfig/LoadedCommand.cxx b/Tests/LoadCommandOneConfig/LoadedCommand.cxx deleted file mode 100644 index c58bcf1..0000000 --- a/Tests/LoadCommandOneConfig/LoadedCommand.cxx +++ /dev/null @@ -1,41 +0,0 @@ -#include "LoadedCommand.h" -#include - -int testSizeOf(int s1, int s2) -{ - return s1 - s2; -} - -int main () -{ - int ret = 0; -#ifdef HAVE_VSBLABLA - printf("Should not be able to find vsblabla\n"); - ret = 1; -#endif - -#if !defined( HAVE_PRINTF ) - printf("Should be able to find printf\n"); - ret= 1; -#endif - -#if !defined( ADDED_DEFINITION ) - printf("Should have ADDED_DEFINITION defined\n"); - ret= 1; -#endif -#if !defined(CMAKE_IS_FUN) - printf("Loaded Command was not built with CMAKE_IS_FUN: failed.\n"); - ret = 1; -#endif - if(testSizeOf(SIZEOF_CHAR, sizeof(char))) - { - printf("Size of char is broken.\n"); - ret = 1; - } - if(testSizeOf(SIZEOF_SHORT, sizeof(short))) - { - printf("Size of short is broken.\n"); - ret = 1; - } - return ret; -} diff --git a/bootstrap b/bootstrap index 1fb6698..d6331df 100755 --- a/bootstrap +++ b/bootstrap @@ -536,11 +536,22 @@ fi # Check if C compiler works TMPFILE=`cmake_tmp_file` cat > "${TMPFILE}.c" < -int main() + +#if defined(__CLASSIC_C__) +int main(argc, argv) + int argc; + char* argv[]; +#else +int main(int argc, char* argv[]) +#endif { - printf("1\n"); - return 0; + printf("%d\n", (argv != 0)); + return argc-1; } EOF for a in ${cmake_c_compilers}; do -- cgit v0.12