Commit 1756aa57 authored by Bill Hoffman's avatar Bill Hoffman
Browse files

ENH: move changes from main tree to branch

parent dbbe605e
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
......
......@@ -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
......
......@@ -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 <stdio.h>\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)
......
......@@ -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
......
......@@ -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 )
{
......
......@@ -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());
......
......@@ -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, "&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));
}
......
......@@ -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!");
......
#include "LoadedCommand.h"
#include <stdio.h>
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;
}
......@@ -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!");
......
#include "LoadedCommand.h"
#include <stdio.h>
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;
}
......@@ -536,11 +536,22 @@ fi
# Check if C compiler works
TMPFILE=`cmake_tmp_file`
cat > "${TMPFILE}.c" <<EOF
#ifdef __cplusplus
# error "The CMAKE_C_COMPILER is set to a C++ compiler"
#endif
#include<stdio.h>
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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment