Commit cc217347 authored by Bill Hoffman's avatar Bill Hoffman
Browse files

ENH: move changes from main tree

parent ecf914e6
......@@ -19,6 +19,7 @@ SET(CTEST_CUSTOM_WARNING_EXCEPTION
"Redeclaration of .send..... with a different storage class specifier"
"Utilities/cmexpat/"
"is not used for resolving any symbol"
"Clock skew detected"
"remark\\(1209"
"stl_deque.h:1051"
)
......
Changes in CMake 2.4.3
* fix bootstrap to use more ansi c main it test compiler
* fix import build settings to do case insensitive match on windows
* fix building in root directory c:/
* Add support for CXX only projects
* Better FindWxWidgets
......
......@@ -43,9 +43,16 @@ MACRO(CMAKE_IMPORT_BUILD_SETTINGS SETTINGS_FILE)
# Check the C++ compiler setting. If it is empty, the imported
# project is not a C++ project, and doesn't need a matching compiler.
IF(CMAKE_BUILD_SETTING_CXX_COMPILER)
STRING(COMPARE NOTEQUAL
"x${CMAKE_CXX_COMPILER}" "x${CMAKE_BUILD_SETTING_CXX_COMPILER}"
CMAKE_CXX_COMPILER_MISMATCH)
IF(WIN32)
STRING(TOLOWER "x${CMAKE_CXX_COMPILER}" COMPARE_CXX_LOCAL)
STRING(TOLOWER "x${CMAKE_BUILD_SETTING_CXX_COMPILER}" COMPARE_CXX_REMOTE)
STRING(COMPARE NOTEQUAL "${COMPARE_CXX_LOCAL}" "${COMPARE_CXX_REMOTE}"
CMAKE_CXX_COMPILER_MISMATCH)
ELSE(WIN32)
STRING(COMPARE NOTEQUAL
"x${CMAKE_CXX_COMPILER}" "x${CMAKE_BUILD_SETTING_CXX_COMPILER}"
CMAKE_CXX_COMPILER_MISMATCH)
ENDIF(WIN32)
ENDIF(CMAKE_BUILD_SETTING_CXX_COMPILER)
# Check the C build variation flags.
......@@ -119,7 +126,7 @@ MACRO(CMAKE_IMPORT_BUILD_SETTINGS SETTINGS_FILE)
"because C++ projects must use the same compiler. "
"If this message appears for more than one imported project, "
"you have conflicting C++ compilers and will have to "
"re-build one of those projects.")
"re-build one of those projects. Was set to ${CMAKE_CXX_COMPILER}")
SET(CMAKE_CXX_COMPILER ${CMAKE_BUILD_SETTING_CXX_COMPILER}
CACHE STRING "C++ compiler imported from ${CMAKE_BUILD_SETTING_PROJECT_NAME}." FORCE)
ENDIF(CMAKE_CXX_COMPILER_MISMATCH)
......
......@@ -86,7 +86,11 @@ IF(CMAKE_GENERATOR MATCHES "Makefiles")
"${CMAKE_ROOT}/Modules/CMakeTestNMakeCLVersion.c")
STRING(REGEX REPLACE "/" "\\\\" testNmakeCLVersionFile "${testNmakeCLVersionFile}")
MESSAGE(STATUS "Check for CL compiler version")
EXEC_PROGRAM(${CMAKE_C_COMPILER}
SET(CMAKE_TEST_COMPILER ${CMAKE_C_COMPILER})
IF (NOT CMAKE_C_COMPILER)
SET(CMAKE_TEST_COMPILER ${CMAKE_CXX_COMPILER})
ENDIF(NOT CMAKE_C_COMPILER)
EXEC_PROGRAM(${CMAKE_TEST_COMPILER}
ARGS /nologo -EP \"${testNmakeCLVersionFile}\"
OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT
RETURN_VALUE CMAKE_COMPILER_RETURN
......@@ -139,7 +143,7 @@ IF(CMAKE_GENERATOR MATCHES "Makefiles")
"${CMAKE_ROOT}/Modules/CMakeTestForFreeVC.cxx")
STRING(REGEX REPLACE "/" "\\\\" testForFreeVCFile "${testForFreeVCFile}")
MESSAGE(STATUS "Check if this is a free VC compiler")
EXEC_PROGRAM(${CMAKE_C_COMPILER} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2
EXEC_PROGRAM(${CMAKE_TEST_COMPILER} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2
ARGS /nologo /MD /EHsc
\"${testForFreeVCFile}\"
OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT
......@@ -160,7 +164,7 @@ IF(CMAKE_GENERATOR MATCHES "Makefiles")
ENDIF(CMAKE_COMPILER_RETURN)
MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3")
MESSAGE(STATUS "Check CL platform")
EXEC_PROGRAM(${CMAKE_C_COMPILER} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3
EXEC_PROGRAM(${CMAKE_TEST_COMPILER} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3
ARGS /nologo
\"${testForFreeVCFile}\"
/link /machine:i386
......
......@@ -176,6 +176,7 @@ void cmLocalVisualStudio7Generator::AddVCProjBuildRule(cmTarget& tgt)
std::string makefileIn = this->Makefile->GetStartDirectory();
makefileIn += "/";
makefileIn += "CMakeLists.txt";
makefileIn = cmSystemTools::CollapseFullPath(makefileIn.c_str());
std::string comment = "Building Custom Rule ";
comment += makefileIn;
std::string args;
......
......@@ -56,6 +56,7 @@
#include <sys/ioctl.h>
#include <unistd.h>
#include <termios.h>
#include <signal.h> /* sigprocmask */
#endif
// Windows API. Some parts used even on cygwin.
......@@ -886,6 +887,7 @@ kwsys_stl::string SystemTools::UnCapitalizedWords(const kwsys_stl::string& s)
return n;
}
// only works for words with at least two letters
kwsys_stl::string SystemTools::AddSpaceBetweenCapitalizedWords(
const kwsys_stl::string& s)
{
......@@ -1035,7 +1037,7 @@ char* SystemTools::RemoveCharsButUpperHex(const char* str)
char *ptr = clean_str;
while (*str)
{
if ((*str >= '0' && *str <= '9') || (*str >= 'A' && *str <= 'H'))
if ((*str >= '0' && *str <= '9') || (*str >= 'A' && *str <= 'F'))
{
*ptr++ = *str;
}
......@@ -1339,13 +1341,17 @@ void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path)
path.replace(0,1,homeEnv);
}
}
// remove trailing slash if the path is more than
// a single /
pathCString = path.c_str();
if (*(pathCString+(path.size()-1)) == '/')
if(path.size() > 1 && *(pathCString+(path.size()-1)) == '/')
{
// if it is c:/ then do not remove the trailing slash
if(!((path.size() == 3 && pathCString[1] == ':')))
{
path = path.substr(0, path.size()-1);
}
}
}
}
......@@ -2503,7 +2509,6 @@ kwsys_stl::string SystemTools::CollapseFullPath(const char* in_path,
// Split the input path components.
kwsys_stl::vector<kwsys_stl::string> path_components;
SystemTools::SplitPath(in_path, path_components);
// If the input path is relative, start with a base path.
if(path_components[0].length() == 0)
{
......@@ -2891,7 +2896,16 @@ kwsys_stl::string SystemTools::GetFilenamePath(const kwsys_stl::string& filename
kwsys_stl::string::size_type slash_pos = fn.rfind("/");
if(slash_pos != kwsys_stl::string::npos)
{
return fn.substr(0, slash_pos);
kwsys_stl::string ret = fn.substr(0, slash_pos);
if(ret.size() == 2 && ret[1] == ':')
{
return ret + '/';
}
if(ret.size() == 0)
{
return "/";
}
return ret;
}
else
{
......@@ -3533,7 +3547,34 @@ void SystemTools::Delay(unsigned int msec)
#ifdef _WIN32
Sleep(msec);
#else
// Block signals to make sure the entire sleep duration occurs. If
// a signal were to arrive the sleep or usleep might return early
// and there is no way to accurately know how much time was really
// slept without setting up timers.
sigset_t newset;
sigset_t oldset;
sigfillset(&newset);
sigprocmask(SIG_BLOCK, &newset, &oldset);
// The sleep function gives 1 second resolution and the usleep
// function gives 1e-6 second resolution but on some platforms has a
// maximum sleep time of 1 second. This could be re-implemented to
// use select with masked signals or pselect to mask signals
// atomically. If select is given empty sets and zero as the max
// file descriptor but a non-zero timeout it can be used to block
// for a precise amount of time.
if(msec >= 1000)
{
sleep(msec / 1000);
usleep((msec % 1000) * 1000);
}
else
{
usleep(msec * 1000);
}
// Restore the signal mask to the previous setting.
sigprocmask(SIG_SETMASK, &oldset, 0);
#endif
}
......
......@@ -206,6 +206,7 @@ public:
/**
* Return string with space added between capitalized words
* (i.e. EatMyShorts becomes Eat My Shorts )
* (note that IEatShorts becomes IEat Shorts)
*/
static kwsys_stl::string AddSpaceBetweenCapitalizedWords(
const kwsys_stl::string&);
......
......@@ -118,6 +118,151 @@ bool CheckDetectFileType()
return res;
}
//----------------------------------------------------------------------------
bool CheckStringOperations()
{
bool res = true;
kwsys_stl::string test = "mary had a little lamb.";
if (kwsys::SystemTools::CapitalizedWords(test) != "Mary Had A Little Lamb.")
{
kwsys_ios::cerr
<< "Problem with CapitalizedWords "
<< TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl;
res = false;
}
test = "Mary Had A Little Lamb.";
if (kwsys::SystemTools::UnCapitalizedWords(test) !=
"mary had a little lamb.")
{
kwsys_ios::cerr
<< "Problem with UnCapitalizedWords "
<< TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl;
res = false;
}
test = "MaryHadTheLittleLamb.";
if (kwsys::SystemTools::AddSpaceBetweenCapitalizedWords(test) !=
"Mary Had The Little Lamb.")
{
kwsys_ios::cerr
<< "Problem with AddSpaceBetweenCapitalizedWords "
<< TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl;
res = false;
}
char * cres =
kwsys::SystemTools::AppendStrings("Mary Had A"," Little Lamb.");
if (strcmp(cres,"Mary Had A Little Lamb."))
{
delete [] cres;
kwsys_ios::cerr
<< "Problem with AppendStrings "
<< TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl;
res = false;
}
delete [] cres;
cres =
kwsys::SystemTools::AppendStrings("Mary Had"," A ","Little Lamb.");
if (strcmp(cres,"Mary Had A Little Lamb."))
{
delete [] cres;
kwsys_ios::cerr
<< "Problem with AppendStrings "
<< TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl;
res = false;
}
delete [] cres;
if (kwsys::SystemTools::CountChar("Mary Had A Little Lamb.",'a') != 3)
{
kwsys_ios::cerr
<< "Problem with CountChar "
<< TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl;
res = false;
}
cres =
kwsys::SystemTools::RemoveChars("Mary Had A Little Lamb.","aeiou");
if (strcmp(cres,"Mry Hd A Lttl Lmb."))
{
delete [] cres;
kwsys_ios::cerr
<< "Problem with RemoveChars "
<< TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl;
res = false;
}
delete [] cres;
cres =
kwsys::SystemTools::RemoveCharsButUpperHex("Mary Had A Little Lamb.");
if (strcmp(cres,"A"))
{
delete [] cres;
kwsys_ios::cerr
<< "Problem with RemoveCharsButUpperHex "
<< TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl;
res = false;
}
delete [] cres;
char *cres2 = new char [strlen("Mary Had A Little Lamb.")+1];
strcpy(cres2,"Mary Had A Little Lamb.");
kwsys::SystemTools::ReplaceChars(cres2,"aeiou",'X');
if (strcmp(cres2,"MXry HXd A LXttlX LXmb."))
{
delete [] cres2;
kwsys_ios::cerr
<< "Problem with ReplaceChars "
<< TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl;
res = false;
}
delete [] cres2;
if (!kwsys::SystemTools::StringStartsWith("Mary Had A Little Lamb.",
"Mary "))
{
kwsys_ios::cerr
<< "Problem with StringStartsWith "
<< TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl;
res = false;
}
if (!kwsys::SystemTools::StringEndsWith("Mary Had A Little Lamb.",
" Lamb."))
{
kwsys_ios::cerr
<< "Problem with StringEndsWith "
<< TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl;
res = false;
}
cres = kwsys::SystemTools::DuplicateString("Mary Had A Little Lamb.");
if (strcmp(cres,"Mary Had A Little Lamb."))
{
delete [] cres;
kwsys_ios::cerr
<< "Problem with DuplicateString "
<< TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl;
res = false;
}
delete [] cres;
test = "Mary Had A Little Lamb.";
if (kwsys::SystemTools::CropString(test,13) !=
"Mary ...Lamb.")
{
kwsys_ios::cerr
<< "Problem with CropString "
<< TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl;
res = false;
}
return res;
}
//----------------------------------------------------------------------------
int main(/*int argc, char* argv*/)
{
......@@ -145,5 +290,7 @@ int main(/*int argc, char* argv*/)
res &= CheckDetectFileType();
res &= CheckStringOperations();
return res ? 0 : 1;
}
......@@ -146,6 +146,14 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[])
ccDep[0],
0, 0);
ccArgs[1] = "echo";
ccArgs[2] = "Build has finished";
info->CAPI->AddCustomCommandToTarget(mf, "LoadedCommand",
file,
3, ccArgs,
CM_POST_BUILD);
info->CAPI->Free(file);
args[0] = "TEST_EXEC";
......@@ -158,6 +166,13 @@ 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
if (!info->CAPI->GetSource(mf,argv[1]))
{
info->CAPI->SetError(mf, "Source file could not be found!");
return 0;
}
return 1;
}
......
......@@ -146,6 +146,14 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[])
ccDep[0],
0, 0);
ccArgs[1] = "echo";
ccArgs[2] = "Build has finished";
info->CAPI->AddCustomCommandToTarget(mf, "LoadedCommand",
file,
3, ccArgs,
CM_POST_BUILD);
info->CAPI->Free(file);
args[0] = "TEST_EXEC";
......@@ -158,6 +166,13 @@ 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
if (!info->CAPI->GetSource(mf,argv[1]))
{
info->CAPI->SetError(mf, "Source file could not be found!");
return 0;
}
return 1;
}
......
......@@ -537,10 +537,10 @@ fi
TMPFILE=`cmake_tmp_file`
cat > "${TMPFILE}.c" <<EOF
#include<stdio.h>
int main()
int main(int argc, char* argv[])
{
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