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

ENH: merge in changes from branch RC 7

parent 32233300
......@@ -7,7 +7,7 @@ SET(CMake_VERSION_MAJOR 2)
SET(CMake_VERSION_MINOR 4)
SET(CMake_VERSION_PATCH 7)
# for an actual release this should not be defined
SET(CMake_VERSION_RC 6)
SET(CMake_VERSION_RC 7)
SET(CMake_VERSION "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
SET(CMake_VERSION_FULL "${CMake_VERSION}.${CMake_VERSION_PATCH}")
......
Changes in CMake 2.4.7
--- RC 7 ---
* Fix @ in Xcode projects
* add some fixes for FindSWIG.cmake
* Fix new line stuff in UsePkgConfig.cmake
* Add new FindPkgConfig.cmake from CVS
* improve docs for try_compile and list commands
* fix for bug 4384, preserve sym links in install directory
* Use platform variable for link path exclusion added in RC6
--- RC 6 ---
* Fix stack reporting bug in macros and include
......
......@@ -30,3 +30,9 @@ SET(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_SYSTEM_LIBRARY_PATH}
SET(CMAKE_SYSTEM_PROGRAM_PATH ${CMAKE_SYSTEM_PROGRAM_PATH}
/bin /usr/bin /usr/local/bin /usr/pkg/bin /sbin
)
SET(CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}
/lib /usr/lib /usr/lib32 /usr/lib64
)
......@@ -29,13 +29,22 @@ MACRO(PKGCONFIG _package _include_DIR _link_DIR _link_FLAGS _cflags)
# and if the package of interest also exists for pkg-config, then get the information
IF(NOT _return_VALUE)
EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --variable=includedir OUTPUT_VARIABLE ${_include_DIR} )
EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --variable=libdir OUTPUT_VARIABLE ${_link_DIR} )
EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --libs OUTPUT_VARIABLE ${_link_FLAGS} )
EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --cflags OUTPUT_VARIABLE ${_cflags} )
EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --variable=includedir
OUTPUT_VARIABLE ${_include_DIR} )
string(REGEX REPLACE "[\r\n]" " " ${_include_DIR} "${${_include_DIR}}")
EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --variable=libdir
OUTPUT_VARIABLE ${_link_DIR} )
string(REGEX REPLACE "[\r\n]" " " ${_link_DIR} "${${_link_DIR}}")
EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --libs
OUTPUT_VARIABLE ${_link_FLAGS} )
string(REGEX REPLACE "[\r\n]" " " ${_link_FLAGS} "${${_link_FLAGS}}")
EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --cflags
OUTPUT_VARIABLE ${_cflags} )
string(REGEX REPLACE "[\r\n]" " " ${_cflags} "${${_cflags}}")
ENDIF(NOT _return_VALUE)
......
......@@ -49,7 +49,7 @@ ENDMACRO(SWIG_MODULE_INITIALIZE)
MACRO(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile)
FOREACH(it ${SWIG_PYTHON_EXTRA_FILE_EXTENSION})
SET(outfiles ${outfiles}
SET(${outfiles} ${${outfiles}}
"${generatedpath}/${infile}.${it}")
ENDFOREACH(it)
ENDMACRO(SWIG_GET_EXTRA_OUTPUT_FILES)
......@@ -96,9 +96,15 @@ MACRO(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
SET(swig_generated_file_fullname
"${swig_generated_file_fullname}/${swig_source_file_relative_path}")
ENDIF(swig_source_file_relative_path)
# If CMAKE_SWIG_OUTDIR was specified then pass it to -outdir
IF(CMAKE_SWIG_OUTDIR)
SET(swig_outdir ${CMAKE_SWIG_OUTDIR})
ELSE(CMAKE_SWIG_OUTDIR)
SET(swig_outdir ${CMAKE_CURRENT_BINARY_DIR})
ENDIF(CMAKE_SWIG_OUTDIR)
SWIG_GET_EXTRA_OUTPUT_FILES(${SWIG_MODULE_${name}_LANGUAGE}
swig_extra_generated_files
"${swig_generated_file_fullname}"
"${swig_outdir}"
"${swig_source_file_name_we}")
SET(swig_generated_file_fullname
"${swig_generated_file_fullname}/${swig_source_file_name_we}")
......@@ -132,15 +138,13 @@ MACRO(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
IF(SWIG_MODULE_${name}_EXTRA_FLAGS)
SET(swig_extra_flags ${swig_extra_flags} ${SWIG_MODULE_${name}_EXTRA_FLAGS})
ENDIF(SWIG_MODULE_${name}_EXTRA_FLAGS)
# If CMAKE_SWIG_OUTDIR was specified then pass it to -outdir
IF(CMAKE_SWIG_OUTDIR)
ADD_CUSTOM_COMMAND(
OUTPUT "${swig_generated_file_fullname}"
OUTPUT "${swig_generated_file_fullname}" ${swig_extra_generated_files}
COMMAND "${SWIG_EXECUTABLE}"
ARGS "-${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}"
${swig_source_file_flags}
${CMAKE_SWIG_FLAGS}
-outdir ${CMAKE_SWIG_OUTDIR}
-outdir ${swig_outdir}
${swig_special_flags}
${swig_extra_flags}
${swig_include_dirs}
......@@ -149,26 +153,9 @@ MACRO(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
MAIN_DEPENDENCY "${swig_source_file_fullname}"
DEPENDS ${SWIG_MODULE_${name}_EXTRA_DEPS}
COMMENT "Swig source")
ELSE(CMAKE_SWIG_OUTDIR)
ADD_CUSTOM_COMMAND(
OUTPUT "${swig_generated_file_fullname}"
COMMAND "${SWIG_EXECUTABLE}"
ARGS "-${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG}"
${swig_source_file_flags}
${CMAKE_SWIG_FLAGS}
${swig_outdir_flags}
${swig_special_flags}
${swig_extra_flags}
${swig_include_dirs}
-o "${swig_generated_file_fullname}"
"${swig_source_file_fullname}"
MAIN_DEPENDENCY "${swig_source_file_fullname}"
DEPENDS ${SWIG_MODULE_${name}_EXTRA_DEPS}
COMMENT "Swig source")
ENDIF(CMAKE_SWIG_OUTDIR)
SET_SOURCE_FILES_PROPERTIES("${swig_generated_file_fullname}"
SET_SOURCE_FILES_PROPERTIES("${swig_generated_file_fullname}" ${swig_extra_generated_files}
PROPERTIES GENERATED 1)
SET(${outfiles} "${swig_generated_file_fullname}")
SET(${outfiles} "${swig_generated_file_fullname}" ${swig_extra_generated_files})
ENDMACRO(SWIG_ADD_SOURCE_TO_MODULE)
#
......
......@@ -452,8 +452,64 @@ public:
}
return true;
}
private:
bool InstallSymlink(const char* fromFile, const char* toFile, bool always);
};
//----------------------------------------------------------------------------
bool cmFileInstaller::InstallSymlink(const char* fromFile, const char* toFile,
bool always)
{
// Inform the user about this file installation.
std::string message = "Installing ";
message += toFile;
this->Makefile->DisplayStatus(message.c_str(), -1);
// Read the original symlink.
std::string symlinkTarget;
if(!cmSystemTools::ReadSymlink(fromFile, symlinkTarget))
{
cmOStringStream e;
e << "INSTALL cannot read symlink \"" << fromFile
<< "\" to duplicate at \"" << toFile << "\".";
this->FileCommand->SetError(e.str().c_str());
return false;
}
// Compare the symlink value to that at the destination if not
// always installing.
if(!always)
{
std::string oldSymlinkTarget;
if(cmSystemTools::ReadSymlink(toFile, oldSymlinkTarget))
{
if(symlinkTarget == oldSymlinkTarget)
{
return true;
}
}
}
// Remove the destination file so we can always create the symlink.
cmSystemTools::RemoveFile(toFile);
// Create the symlink.
if(!cmSystemTools::CreateSymlink(symlinkTarget.c_str(), toFile))
{
cmOStringStream e;
e << "INSTALL cannot duplicate symlink \"" << fromFile
<< "\" at \"" << toFile << "\".";
this->FileCommand->SetError(e.str().c_str());
return false;
}
// Add the file to the manifest.
this->ManifestAppend(toFile);
return true;
}
//----------------------------------------------------------------------------
bool cmFileInstaller::InstallFile(const char* fromFile, const char* toFile,
bool always)
......@@ -467,6 +523,12 @@ bool cmFileInstaller::InstallFile(const char* fromFile, const char* toFile,
return true;
}
// Short-circuit for symbolic links.
if(cmSystemTools::FileIsSymlink(fromFile))
{
return this->InstallSymlink(fromFile, toFile, always);
}
// Inform the user about this file installation.
std::string message = "Installing ";
message += toFile;
......@@ -519,6 +581,12 @@ bool cmFileInstaller::InstallDirectory(const char* source,
return true;
}
// Short-circuit for symbolic links.
if(cmSystemTools::FileIsSymlink(source))
{
return this->InstallSymlink(source, destination, always);
}
// Inform the user about this directory installation.
std::string message = "Installing ";
message += destination;
......
......@@ -79,9 +79,9 @@ public:
"INSERT will insert elements to the list to the specified location.\n"
"When specifying an index, negative value corresponds to index from the"
" end of the list.\n"
"REMOVE_AT and REMOVE_ITEM will remove item from the list. The "
"REMOVE_AT and REMOVE_ITEM will remove items from the list. The "
"difference is that REMOVE_ITEM will remove the given items, while "
"REMOVE_AT will remove the item at the given indices.\n"
"REMOVE_AT will remove the items at the given indices.\n"
;
}
......
......@@ -1466,9 +1466,17 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout,
// Some search paths should never be emitted
emitted.insert("");
emitted.insert("/usr/lib");
emitted.insert("/usr/lib32");
emitted.insert("/usr/lib64");
if(const char* implicitLinks =
(this->Makefile->GetDefinition
("CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES")))
{
std::vector<std::string> implicitLinkVec;
cmSystemTools::ExpandListArgument(implicitLinks, implicitLinkVec);
for(unsigned int k = 0; k < implicitLinkVec.size(); ++k)
{
emitted.insert(implicitLinkVec[k]);
}
}
std::string libPathFlag =
this->Makefile->GetRequiredDefinition("CMAKE_LIBRARY_PATH_FLAG");
std::string libLinkFlag =
......
......@@ -77,30 +77,41 @@ public:
" TRY_COMPILE(RESULT_VAR bindir srcdir\n"
" projectName <targetname> <CMAKE_FLAGS <Flags>>\n"
" <OUTPUT_VARIABLE var>)\n"
"Try compiling a program. Return the success or failure in "
"RESULT_VAR. If <target name> is specified then build just that target "
"Try compiling a program. In this form, srcdir should contain a complete "
"CMake project with a CMakeLists.txt file and all sources. The bindir and "
"srcdir will not be deleted after this command is run. "
"If <target name> is specified then build just that target "
"otherwise the all or ALL_BUILD target is built.\n"
" TRY_COMPILE(RESULT_VAR bindir srcfile\n"
" <CMAKE_FLAGS <Flags>>\n"
" <COMPILE_DEFINITIONS <flags> ...>\n"
" <OUTPUT_VARIABLE var>)\n"
"Try compiling a srcfile. Return the success or failure in "
"RESULT_VAR. CMAKE_FLAGS can be used to pass -DVAR:TYPE=VALUE flags "
"to cmake. Some extra flags that can be included are, "
"Try compiling a srcfile. In this case, the user need only supply a "
"source file. CMake will create the appropriate CMakeLists.txt file "
"to build the source. "
"In this version all files in bindir/CMakeFiles/CMakeTmp, "
"will be cleaned automatically, for debugging a --debug-trycompile can "
"be passed to cmake to avoid the clean. Some extra flags that "
" can be included are, "
"INCLUDE_DIRECTORIES, LINK_DIRECTORIES, and LINK_LIBRARIES. "
"COMPILE_DEFINITIONS are -Ddefinition that will be passed to the "
"compile line. If srcfile is specified the files in "
"bindir/CMakeFiles/CMakeTmp "
"are cleaned automatically. If OUTPUT_VARIABLE is specified, then the "
"output from the build process is stored in the given variable. "
"compile line. "
"TRY_COMPILE creates a CMakeList.txt "
"file on the fly, and in that file it looks like this:\n"
"file on the fly that looks like this:\n"
" ADD_DEFINITIONS( <expanded COMPILE_DEFINITIONS from calling "
"cmake>)\n"
" INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES})\n"
" LINK_DIRECTORIES(${LINK_DIRECTORIES})\n"
" ADD_EXECUTABLE(cmTryCompileExec sources)\n"
" TARGET_LINK_LIBRARIES(cmTryCompileExec ${LINK_LIBRARIES})\n";
" TARGET_LINK_LIBRARIES(cmTryCompileExec ${LINK_LIBRARIES})\n"
"In both versions of the command, "
"if OUTPUT_VARIABLE is specified, then the "
"output from the build process is stored in the given variable. "
"Return the success or failure in "
"RESULT_VAR. CMAKE_FLAGS can be used to pass -DVAR:TYPE=VALUE flags "
"to the cmake that is run during the build. "
"";
}
cmTypeMacro(cmTryCompileCommand, cmCommand);
......
......@@ -192,7 +192,7 @@ void cmXCodeObject::SetString(const char* s)
}
bool needQuote = false;
this->String = "";
if(ss.find_first_of(" <>.+-=") != ss.npos)
if(ss.find_first_of(" <>.+-=@") != ss.npos)
{
needQuote = true;
}
......
......@@ -2326,6 +2326,44 @@ bool SystemTools::FileIsSymlink(const char* name)
#endif
}
#if defined(_WIN32) && !defined(__CYGWIN__)
bool SystemTools::CreateSymlink(const char*, const char*)
{
return false;
}
#else
bool SystemTools::CreateSymlink(const char* origName, const char* newName)
{
return symlink(origName, newName) >= 0;
}
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
bool SystemTools::ReadSymlink(const char*, kwsys_stl::string&)
{
return false;
}
#else
bool SystemTools::ReadSymlink(const char* newName,
kwsys_stl::string& origName)
{
char buf[KWSYS_SYSTEMTOOLS_MAXPATH+1];
int count =
static_cast<int>(readlink(newName, buf, KWSYS_SYSTEMTOOLS_MAXPATH));
if(count >= 0)
{
// Add null-terminator.
buf[count] = 0;
origName = buf;
return true;
}
else
{
return false;
}
}
#endif
int SystemTools::ChangeDirectory(const char *dir)
{
return Chdir(dir);
......
......@@ -587,6 +587,18 @@ public:
unsigned long length = 256,
double percent_bin = 0.05);
/**
* Create a symbolic link if the platform supports it. Returns whether
* creation succeded.
*/
static bool CreateSymlink(const char* origName, const char* newName);
/**
* Read the contents of a symbolic link. Returns whether reading
* succeded.
*/
static bool ReadSymlink(const char* newName, kwsys_stl::string& origName);
/**
* Try to locate the file 'filename' in the directory 'dir'.
* If 'filename' is a fully qualified filename, the basename of the file is
......
Markdown is supported
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