diff options
40 files changed, 190 insertions, 147 deletions
diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake index a0afd34..4a3e68c 100644 --- a/Modules/FindBISON.cmake +++ b/Modules/FindBISON.cmake @@ -47,7 +47,7 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -find_program(BISON_EXECUTABLE bison DOC "path to the bison executable") +find_program(BISON_EXECUTABLE NAMES bison win_bison DOC "path to the bison executable") mark_as_advanced(BISON_EXECUTABLE) if(BISON_EXECUTABLE) diff --git a/Modules/FindBullet.cmake b/Modules/FindBullet.cmake index 1c4a9de..1a27fc3 100644 --- a/Modules/FindBullet.cmake +++ b/Modules/FindBullet.cmake @@ -33,6 +33,8 @@ macro(_FIND_BULLET_LIBRARY _var) ${ARGN} HINTS ${BULLET_ROOT} + ${BULLET_ROOT}/lib/Release + ${BULLET_ROOT}/lib/Debug ${BULLET_ROOT}/out/release8/libs ${BULLET_ROOT}/out/debug8/libs PATH_SUFFIXES lib diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake index daae94f..79a3a1e 100644 --- a/Modules/FindFLEX.cmake +++ b/Modules/FindFLEX.cmake @@ -63,7 +63,7 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -find_program(FLEX_EXECUTABLE flex DOC "path to the flex executable") +find_program(FLEX_EXECUTABLE NAMES flex win_flex DOC "path to the flex executable") mark_as_advanced(FLEX_EXECUTABLE) find_library(FL_LIBRARY NAMES fl @@ -93,10 +93,12 @@ if(FLEX_EXECUTABLE) else() # older versions of flex printed "/full/path/to/executable version X.Y" # newer versions use "basename(executable) X.Y" - get_filename_component(FLEX_EXE_NAME "${FLEX_EXECUTABLE}" NAME) - string(REGEX REPLACE "^.*${FLEX_EXE_NAME}\"? (version )?([0-9]+[^ ]*)( .*)?$" "\\2" + get_filename_component(FLEX_EXE_NAME_WE "${FLEX_EXECUTABLE}" NAME_WE) + get_filename_component(FLEX_EXE_EXT "${FLEX_EXECUTABLE}" EXT) + string(REGEX REPLACE "^.*${FLEX_EXE_NAME_WE}(${FLEX_EXE_EXT})?\"? (version )?([0-9]+[^ ]*)( .*)?$" "\\3" FLEX_VERSION "${FLEX_version_output}") - unset(FLEX_EXE_NAME) + unset(FLEX_EXE_EXT) + unset(FLEX_EXE_NAME_WE) endif() #============================================================ diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake index f1c78ae..1a6bd39 100644 --- a/Modules/FindGettext.cmake +++ b/Modules/FindGettext.cmake @@ -209,5 +209,3 @@ function(GETTEXT_PROCESS_PO_FILES _lang) add_dependencies(pofiles ${uniqueTargetName}) endfunction() - -set(GETTEXT_FOUND ${Gettext_FOUND}) diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in index ffc425e..59a444b 100644 --- a/Modules/NSIS.template.in +++ b/Modules/NSIS.template.in @@ -37,6 +37,9 @@ ;Set compression SetCompressor @CPACK_NSIS_COMPRESSOR@ + ;Require administrator access + RequestExecutionLevel admin + @CPACK_NSIS_DEFINES@ !include Sections.nsh @@ -119,7 +122,7 @@ Var AR_RegFlags "exit_${SecName}:" !macroend -!macro RemoveSection SecName +!macro RemoveSection_CPack SecName ; This macro is used to call section's Remove_... macro ;from the uninstaller. ;Input: section index constant name specified in Section command. @@ -841,7 +844,7 @@ Section "Uninstall" DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" ; Removes all optional components - !insertmacro SectionList "RemoveSection" + !insertmacro SectionList "RemoveSection_CPack" !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP diff --git a/Modules/Platform/Windows-Intel.cmake b/Modules/Platform/Windows-Intel.cmake index 58da8c5..8a9d630 100644 --- a/Modules/Platform/Windows-Intel.cmake +++ b/Modules/Platform/Windows-Intel.cmake @@ -50,7 +50,7 @@ elseif(MSVC_CXX_ARCHITECTURE_ID) elseif(MSVC_Fortran_ARCHITECTURE_ID) set(_MACHINE_ARCH_FLAG "/machine:${MSVC_Fortran_ARCHITECTURE_ID}") endif() -set (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /INCREMENTAL:YES ${_MACHINE_ARCH_FLAG}") +set (CMAKE_EXE_LINKER_FLAGS_INIT "/INCREMENTAL:YES ${_MACHINE_ARCH_FLAG}") set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug") set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug") diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 32dd546..5cbf9ee 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -165,7 +165,7 @@ 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 +# set the machine type set(_MACHINE_ARCH_FLAG ${MSVC_C_ARCHITECTURE_ID}) if(NOT _MACHINE_ARCH_FLAG) set(_MACHINE_ARCH_FLAG ${MSVC_CXX_ARCHITECTURE_ID}) @@ -178,7 +178,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE") endif() endif() set (CMAKE_EXE_LINKER_FLAGS_INIT - "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:${_MACHINE_ARCH_FLAG}") + "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:${_MACHINE_ARCH_FLAG}") # add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype # on versions that support it diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b77883e..be8259d 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 10) -set(CMake_VERSION_TWEAK 20121126) +set(CMake_VERSION_TWEAK 20121127) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 6317fa0..7cc1522 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -23,7 +23,6 @@ #include <cmsys/SystemTools.hxx> #include <cmsys/Glob.hxx> -#include <memory> // auto_ptr #include <algorithm> #if defined(__HAIKU__) @@ -696,7 +695,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( cm.SetProgressCallback(cmCPackGeneratorProgress, this); cmGlobalGenerator gg; gg.SetCMakeInstance(&cm); - std::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator()); cmMakefile *mf = lg->GetMakefile(); std::string realInstallDirectory = tempInstallDirectory; if ( !installSubDirectory.empty() && installSubDirectory != "/" ) diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx index 37ff460..eba1ef9 100644 --- a/Source/CPack/cmCPackGeneratorFactory.cxx +++ b/Source/CPack/cmCPackGeneratorFactory.cxx @@ -61,6 +61,8 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory() { this->RegisterGenerator("NSIS", "Null Soft Installer", cmCPackNSISGenerator::CreateGenerator); + this->RegisterGenerator("NSIS64", "Null Soft Installer (64-bit)", + cmCPackNSISGenerator::CreateGenerator64); } #ifdef __CYGWIN__ if (cmCPackCygwinBinaryGenerator::CanGenerate()) diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index fdbae35..9f86ea2 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -33,8 +33,9 @@ #endif //---------------------------------------------------------------------- -cmCPackNSISGenerator::cmCPackNSISGenerator() +cmCPackNSISGenerator::cmCPackNSISGenerator(bool nsis64) { + Nsis64 = nsis64; } //---------------------------------------------------------------------- @@ -359,6 +360,21 @@ int cmCPackNSISGenerator::InitializeInternal() bool gotRegValue = false; #ifdef _WIN32 + if (Nsis64) + { + if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS\\Unicode", nsisPath, + cmsys::SystemTools::KeyWOW64_64) ) + { + gotRegValue = true; + } + if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath, + cmsys::SystemTools::KeyWOW64_64) ) + { + gotRegValue = true; + } + } if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue( "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS\\Unicode", nsisPath, cmsys::SystemTools::KeyWOW64_32) ) diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h index 8224854..e46fbda 100644 --- a/Source/CPack/cmCPackNSISGenerator.h +++ b/Source/CPack/cmCPackNSISGenerator.h @@ -27,10 +27,13 @@ class cmCPackNSISGenerator : public cmCPackGenerator public: cmCPackTypeMacro(cmCPackNSISGenerator, cmCPackGenerator); + static cmCPackGenerator* CreateGenerator64() + { return new cmCPackNSISGenerator(true); } + /** * Construct generator */ - cmCPackNSISGenerator(); + cmCPackNSISGenerator(bool nsis64 = false); virtual ~cmCPackNSISGenerator(); protected: @@ -77,6 +80,8 @@ protected: /// Translations any newlines found in the string into \\r\\n, so that the /// resulting string can be used within NSIS. static std::string TranslateNewlines(std::string str); + + bool Nsis64; }; #endif diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index b603585..0ba7322 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -27,7 +27,6 @@ #include <cmsys/CommandLineArguments.hxx> #include <cmsys/SystemTools.hxx> -#include <memory> // auto_ptr //---------------------------------------------------------------------------- static const char * cmDocumentationName[][3] = @@ -276,7 +275,7 @@ int main (int argc, char *argv[]) cminst.RemoveUnscriptableCommands(); cmGlobalGenerator cmgg; cmgg.SetCMakeInstance(&cminst); - std::auto_ptr<cmLocalGenerator> cmlg(cmgg.CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> cmlg(cmgg.CreateLocalGenerator()); cmMakefile* globalMF = cmlg->GetMakefile(); bool cpackConfigFileSpecified = true; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index b796b83..e7491bb 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -32,7 +32,6 @@ #include <math.h> #include <float.h> -#include <memory> // auto_ptr #include <set> //---------------------------------------------------------------------- @@ -1547,7 +1546,7 @@ void cmCTestTestHandler::GetListOfTests() cmake cm; cmGlobalGenerator gg; gg.SetCMakeInstance(&cm); - std::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator()); cmMakefile *mf = lg->GetMakefile(); mf->AddDefinition("CTEST_CONFIGURATION_TYPE", this->CTest->GetConfigType().c_str()); diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 7d8df37..32bf941 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -68,7 +68,7 @@ cmGeneratorExpression::~cmGeneratorExpression() //---------------------------------------------------------------------------- const char *cmCompiledGeneratorExpression::Evaluate( cmMakefile* mf, const char* config, bool quiet, - cmGeneratorTarget *target, + cmTarget *target, cmGeneratorExpressionDAGChecker *dagChecker) const { if (!this->NeedsParsing) diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 29d3f44..ea3e7d0 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -20,7 +20,6 @@ #include <cmsys/RegularExpression.hxx> class cmTarget; -class cmGeneratorTarget; class cmMakefile; class cmListFileBacktrace; @@ -68,7 +67,7 @@ class cmCompiledGeneratorExpression public: const char* Evaluate(cmMakefile* mf, const char* config, bool quiet = false, - cmGeneratorTarget *target = 0, + cmTarget *target = 0, cmGeneratorExpressionDAGChecker *dagChecker = 0) const; /** Get set of targets found during evaluations. */ diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 3c2f7c5..102927e 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -289,7 +289,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode cmsys::RegularExpression propertyNameValidator; propertyNameValidator.compile("^[A-Za-z0-9_]+$"); - cmGeneratorTarget* target = context->Target; + cmTarget* target = context->Target; std::string propertyName = *parameters.begin(); if (parameters.size() == 2) { @@ -322,7 +322,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode "Target name not supported."); return std::string(); } - target = context->Makefile->FindGeneratorTargetToUse( + target = context->Makefile->FindTargetToUse( targetName.c_str()); if (!target) diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index 642a02e..d904b02 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -18,7 +18,6 @@ #include "cmListFileCache.h" class cmTarget; -class cmGeneratorTarget; //---------------------------------------------------------------------------- struct cmGeneratorExpressionContext @@ -27,7 +26,7 @@ struct cmGeneratorExpressionContext std::set<cmTarget*> Targets; cmMakefile *Makefile; const char *Config; - cmGeneratorTarget *Target; + cmTarget *Target; bool Quiet; bool HadError; }; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 19b55c6..de8b5e3 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -14,14 +14,11 @@ #include "cmTarget.h" #include "cmMakefile.h" #include "cmLocalGenerator.h" -#include "cmComputeLinkInformation.h" #include "cmGlobalGenerator.h" #include "cmSourceFile.h" #include "cmGeneratorExpression.h" #include "cmGeneratorExpressionDAGChecker.h" -#include <assert.h> - //---------------------------------------------------------------------------- cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t) { @@ -32,15 +29,6 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t) this->LookupObjectLibraries(); } -cmGeneratorTarget::~cmGeneratorTarget() -{ - for(std::map<cmStdString, cmComputeLinkInformation*>::iterator i - = LinkInformation.begin(); i != LinkInformation.end(); ++i) - { - delete i->second; - } -} - //---------------------------------------------------------------------------- int cmGeneratorTarget::GetType() const { @@ -221,32 +209,6 @@ void cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs) } //---------------------------------------------------------------------------- -cmComputeLinkInformation* -cmGeneratorTarget::GetLinkInformation(const char* config) -{ - // Lookup any existing information for this configuration. - std::map<cmStdString, cmComputeLinkInformation*>::iterator - i = this->LinkInformation.find(config?config:""); - if(i == this->LinkInformation.end()) - { - // Compute information for this configuration. - cmComputeLinkInformation* info = - new cmComputeLinkInformation(this->Target, config); - if(!info || !info->Compute()) - { - delete info; - info = 0; - } - - // Store the information for this configuration. - std::map<cmStdString, cmComputeLinkInformation*>::value_type - entry(config?config:"", info); - i = this->LinkInformation.insert(entry).first; - } - return i->second; -} - -//---------------------------------------------------------------------------- void cmGeneratorTarget::GetAppleArchs(const char* config, std::vector<std::string>& archVec) { @@ -308,7 +270,7 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories( .Evaluate(this->Makefile, config, false, - this, + this->Target, &dagChecker), includes); @@ -356,6 +318,6 @@ std::string cmGeneratorTarget::GetCompileDefinitions(const char *config) return ge.Parse(prop).Evaluate(this->Makefile, config, false, - this, + this->Target, &dagChecker); } diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index a29a9f9..6f5ecb7 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -14,7 +14,6 @@ #include "cmStandardIncludes.h" -class cmComputeLinkInformation; class cmCustomCommand; class cmGlobalGenerator; class cmLocalGenerator; @@ -26,7 +25,6 @@ class cmGeneratorTarget { public: cmGeneratorTarget(cmTarget*); - ~cmGeneratorTarget(); int GetType() const; const char *GetName() const; @@ -60,10 +58,6 @@ public: void UseObjectLibraries(std::vector<std::string>& objs); - std::map<cmStdString, cmComputeLinkInformation*> LinkInformation; - - cmComputeLinkInformation* GetLinkInformation(const char* config); - void GetAppleArchs(const char* config, std::vector<std::string>& archVec); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 4ef2f57..9bbeeaf 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2649,8 +2649,7 @@ void cmGlobalXCodeGenerator } // Compute the link library and directory information. - cmGeneratorTarget* gtgt = this->GetGeneratorTarget(cmtarget); - cmComputeLinkInformation* pcli = gtgt->GetLinkInformation(configName); + cmComputeLinkInformation* pcli = cmtarget->GetLinkInformation(configName); if(!pcli) { continue; diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 15bad52..4816da9 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -15,8 +15,6 @@ #include "cmGlobalGenerator.h" #include "cmGeneratedFileStream.h" -#include <memory> - static const char* getShapeForTarget(const cmTarget* target) @@ -67,7 +65,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, cmake cm; cmGlobalGenerator ggi; ggi.SetCMakeInstance(&cm); - std::auto_ptr<cmLocalGenerator> lg(ggi.CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lg(ggi.CreateLocalGenerator()); cmMakefile *mf = lg->GetMakefile(); const char* inFileName = settingsFileName; diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 347ad3e..5f9b658 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -16,7 +16,6 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmake.h" -#include "cmGeneratorTarget.h" #include <assert.h> @@ -27,8 +26,7 @@ cmInstallTargetGenerator std::vector<std::string> const& configurations, const char* component, bool optional): cmInstallGenerator(dest, configurations, component), Target(&t), - ImportLibrary(implib), FilePermissions(file_permissions), - Optional(optional), GeneratorTarget(0) + ImportLibrary(implib), FilePermissions(file_permissions), Optional(optional) { this->ActionsPerConfig = true; this->NamelinkMode = NamelinkModeNone; @@ -486,17 +484,6 @@ void cmInstallTargetGenerator::PostReplacementTweaks(std::ostream& os, this->AddStripRule(os, indent, file); } -void cmInstallTargetGenerator::CreateGeneratorTarget() -{ - if (!this->GeneratorTarget) - { - this->GeneratorTarget = this->Target->GetMakefile() - ->GetLocalGenerator() - ->GetGlobalGenerator() - ->GetGeneratorTarget(this->Target); - } -} - //---------------------------------------------------------------------------- void cmInstallTargetGenerator @@ -520,13 +507,10 @@ cmInstallTargetGenerator return; } - this->CreateGeneratorTarget(); - // Build a map of build-tree install_name to install-tree install_name for // shared libraries linked to this target. std::map<cmStdString, cmStdString> install_name_remap; - if(cmComputeLinkInformation* cli = - this->GeneratorTarget->GetLinkInformation(config)) + if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config)) { std::set<cmTarget*> const& sharedLibs = cli->GetSharedLibrariesLinked(); for(std::set<cmTarget*>::const_iterator j = sharedLibs.begin(); @@ -624,12 +608,9 @@ cmInstallTargetGenerator return; } - this->CreateGeneratorTarget(); - // Get the link information for this target. // It can provide the RPATH. - cmComputeLinkInformation* cli = - this->GeneratorTarget->GetLinkInformation(config); + cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config); if(!cli) { return; @@ -658,12 +639,9 @@ cmInstallTargetGenerator return; } - this->CreateGeneratorTarget(); - // Get the link information for this target. // It can provide the RPATH. - cmComputeLinkInformation* cli = - this->GeneratorTarget->GetLinkInformation(config); + cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config); if(!cli) { return; diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index cab3e90..8cf72f9 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -14,8 +14,7 @@ #include "cmInstallGenerator.h" #include "cmTarget.h" - -class cmGeneratorTarget; +#include "cmGeneratorTarget.h" /** \class cmInstallTargetGenerator * \brief Generate target installation rules. @@ -94,8 +93,6 @@ protected: void AddRanlibRule(std::ostream& os, Indent const& indent, const std::string& toDestDirPath); - void CreateGeneratorTarget(); - cmTarget* Target; bool ImportLibrary; std::string FilePermissions; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 4952a8c..6d396b3 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1671,7 +1671,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, { cmOStringStream fout; const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); - cmComputeLinkInformation* pcli = tgt.GetLinkInformation(config); + cmComputeLinkInformation* pcli = tgt.Target->GetLinkInformation(config); if(!pcli) { return; @@ -1875,6 +1875,14 @@ bool cmLocalGenerator::GetRealDependency(const char* inName, // modify the name so stripping down to just the file name should // produce the target name in this case. std::string name = cmSystemTools::GetFilenameName(inName); + + // If the input name is the empty string, there is no real + // dependency. Short-circuit the other checks: + if(name == "") + { + return false; + } + if(cmSystemTools::GetFilenameLastExtension(name) == ".exe") { name = cmSystemTools::GetFilenameWithoutLastExtension(name); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 820d25a..d629e71 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -32,7 +32,6 @@ #include <cmsys/auto_ptr.hxx> -#include <memory> // auto_ptr #include <queue> //---------------------------------------------------------------------------- diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 9497e31..6c78ac4 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1785,10 +1785,8 @@ void cmLocalVisualStudio6Generator const std::string extraOptions, std::string& options) { - cmGeneratorTarget* gt = - this->GlobalGenerator->GetGeneratorTarget(&target); // Compute the link information for this configuration. - cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName); + cmComputeLinkInformation* pcli = target.GetLinkInformation(configName); if(!pcli) { return; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index d954a52..afd30f3 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1076,9 +1076,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, targetNameImport, targetNamePDB, configName); // Compute the link library and directory information. - cmGeneratorTarget* gt = - this->GlobalGenerator->GetGeneratorTarget(&target); - cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName); + cmComputeLinkInformation* pcli = target.GetLinkInformation(configName); if(!pcli) { return; @@ -1163,9 +1161,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, targetNameImport, targetNamePDB, configName); // Compute the link library and directory information. - cmGeneratorTarget* gt = - this->GlobalGenerator->GetGeneratorTarget(&target); - cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName); + cmComputeLinkInformation* pcli = target.GetLinkInformation(configName); if(!pcli) { return; diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index e7004d6..5b4e4d7 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -19,8 +19,6 @@ #include "cmTarget.h" #include "cmake.h" -#include <memory> // auto_ptr - //---------------------------------------------------------------------------- cmMakefileLibraryTargetGenerator ::cmMakefileLibraryTargetGenerator(cmTarget* target): diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 3d02d6a..2b89c79 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1017,8 +1017,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() << "SET(CMAKE_TARGET_LINKED_INFO_FILES\n"; std::set<cmTarget const*> emitted; const char* cfg = this->LocalGenerator->ConfigurationName.c_str(); - if(cmComputeLinkInformation* cli = - this->GeneratorTarget->GetLinkInformation(cfg)) + if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg)) { cmComputeLinkInformation::ItemVector const& items = cli->GetItems(); for(cmComputeLinkInformation::ItemVector::const_iterator @@ -1594,8 +1593,7 @@ void cmMakefileTargetGenerator // Loop over all library dependencies. const char* cfg = this->LocalGenerator->ConfigurationName.c_str(); - if(cmComputeLinkInformation* cli = - this->GeneratorTarget->GetLinkInformation(cfg)) + if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg)) { std::vector<std::string> const& libDeps = cli->GetDepends(); for(std::vector<std::string>::const_iterator j = libDeps.begin(); diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 853bc12..65967a5 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -439,6 +439,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() this->GetGeneratorTarget()); this->AddModuleDefinitionFlag(vars["LINK_FLAGS"]); + vars["LINK_FLAGS"] = cmGlobalNinjaGenerator + ::EncodeLiteral(vars["LINK_FLAGS"]); + vars["LINK_PATH"] = frameworkPath + linkPath; // Compute architecture specific link flags. Yes, these go into a different diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 0f10152..5b1dfc8 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -257,7 +257,7 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const return cmNinjaDeps(); cmComputeLinkInformation* cli = - this->GeneratorTarget->GetLinkInformation(this->GetConfigName()); + this->Target->GetLinkInformation(this->GetConfigName()); if(!cli) return cmNinjaDeps(); diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx index 4fd9851..f09976f 100644 --- a/Source/cmSourceGroup.cxx +++ b/Source/cmSourceGroup.cxx @@ -182,10 +182,6 @@ cmSourceGroup *cmSourceGroup::MatchChildrenRegex(const char *name) std::vector<cmSourceGroup>::iterator end = this->Internal->GroupChildren.end(); - if(this->MatchesRegex(name)) - { - return this; - } for(;iter!=end; ++iter) { cmSourceGroup *result = iter->MatchChildrenRegex(name); @@ -194,6 +190,11 @@ cmSourceGroup *cmSourceGroup::MatchChildrenRegex(const char *name) return result; } } + if(this->MatchesRegex(name)) + { + return this; + } + return 0; } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 89f03f6..c2521d9 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -52,7 +52,6 @@ #endif #if defined(CMAKE_BUILD_WITH_CMAKE) -# include <memory> // auto_ptr # include <fcntl.h> # include "cmCryptoHash.h" #endif @@ -1932,6 +1931,7 @@ bool extract_tar(const char* outFileName, bool verbose, { cmSystemTools::Error("Problem with archive_read_next_header(): ", archive_error_string(a)); + break; } if (verbose && extract) { @@ -1954,6 +1954,7 @@ bool extract_tar(const char* outFileName, bool verbose, cmSystemTools::Error( "Problem with archive_write_disk_set_options(): ", archive_error_string(ext)); + break; } r = archive_write_header(ext, entry); @@ -1963,6 +1964,7 @@ bool extract_tar(const char* outFileName, bool verbose, archive_error_string(ext)); cmSystemTools::Error("Current file:", archive_entry_pathname(entry)); + break; } else { @@ -1972,6 +1974,7 @@ bool extract_tar(const char* outFileName, bool verbose, { cmSystemTools::Error("Problem with archive_write_finish_entry(): ", archive_error_string(ext)); + break; } } } @@ -1982,8 +1985,7 @@ bool extract_tar(const char* outFileName, bool verbose, } archive_read_close(a); archive_read_finish(a); - return true; - + return r == ARCHIVE_EOF || r == ARCHIVE_OK; } } #endif diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 7c62ea8..be20464 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -15,6 +15,7 @@ #include "cmSourceFile.h" #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" +#include "cmComputeLinkInformation.h" #include "cmDocumentCompileDefinitions.h" #include "cmDocumentGeneratorExpressions.h" #include "cmDocumentLocationUndefined.h" @@ -4707,14 +4708,24 @@ void cmTarget::ComputeLinkImplementation(const char* config, { continue; } - if(li->second == cmTarget::GENERAL || li->second == linkType) { // The entry is meant for this configuration. impl.Libraries.push_back(item); } - else + } + + LinkLibraryVectorType const& oldllibs = this->GetOriginalLinkLibraries(); + for(cmTarget::LinkLibraryVectorType::const_iterator li = oldllibs.begin(); + li != oldllibs.end(); ++li) + { + if(li->second != cmTarget::GENERAL && li->second != linkType) { + std::string item = this->CheckCMP0004(li->first); + if(item == this->GetName() || item.empty()) + { + continue; + } // Support OLD behavior for CMP0003. impl.WrongConfigLibraries.push_back(item); } @@ -4804,6 +4815,32 @@ std::string cmTarget::CheckCMP0004(std::string const& item) } //---------------------------------------------------------------------------- +cmComputeLinkInformation* +cmTarget::GetLinkInformation(const char* config) +{ + // Lookup any existing information for this configuration. + std::map<cmStdString, cmComputeLinkInformation*>::iterator + i = this->LinkInformation.find(config?config:""); + if(i == this->LinkInformation.end()) + { + // Compute information for this configuration. + cmComputeLinkInformation* info = + new cmComputeLinkInformation(this, config); + if(!info || !info->Compute()) + { + delete info; + info = 0; + } + + // Store the information for this configuration. + std::map<cmStdString, cmComputeLinkInformation*>::value_type + entry(config?config:"", info); + i = this->LinkInformation.insert(entry).first; + } + return i->second; +} + +//---------------------------------------------------------------------------- std::string cmTarget::GetFrameworkDirectory(const char* config) { std::string fpath; @@ -4861,6 +4898,29 @@ std::string cmTarget::GetMacContentDirectory(const char* config, } //---------------------------------------------------------------------------- +cmTargetLinkInformationMap +::cmTargetLinkInformationMap(cmTargetLinkInformationMap const& r): derived() +{ + // Ideally cmTarget instances should never be copied. However until + // we can make a sweep to remove that, this copy constructor avoids + // allowing the resources (LinkInformation) from getting copied. In + // the worst case this will lead to extra cmComputeLinkInformation + // instances. We also enforce in debug mode that the map be emptied + // when copied. + static_cast<void>(r); + assert(r.empty()); +} + +//---------------------------------------------------------------------------- +cmTargetLinkInformationMap::~cmTargetLinkInformationMap() +{ + for(derived::iterator i = this->begin(); i != this->end(); ++i) + { + delete i->second; + } +} + +//---------------------------------------------------------------------------- cmTargetInternalPointer::cmTargetInternalPointer() { this->Pointer = new cmTargetInternals; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index e442d25..9efd638 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -22,8 +22,18 @@ class cmake; class cmMakefile; class cmSourceFile; class cmGlobalGenerator; +class cmComputeLinkInformation; class cmListFileBacktrace; +struct cmTargetLinkInformationMap: + public std::map<cmStdString, cmComputeLinkInformation*> +{ + typedef std::map<cmStdString, cmComputeLinkInformation*> derived; + cmTargetLinkInformationMap() {} + cmTargetLinkInformationMap(cmTargetLinkInformationMap const& r); + ~cmTargetLinkInformationMap(); +}; + class cmTargetInternals; class cmTargetInternalPointer { @@ -392,6 +402,8 @@ public: std::string GetInstallNameDirForInstallTree(const char* config, bool for_xcode = false); + cmComputeLinkInformation* GetLinkInformation(const char* config); + // Get the properties cmPropertyMap &GetProperties() { return this->Properties; }; @@ -584,6 +596,8 @@ private: ImportInfo const* GetImportInfo(const char* config); void ComputeImportInfo(std::string const& desired_config, ImportInfo& info); + cmTargetLinkInformationMap LinkInformation; + bool ComputeLinkInterface(const char* config, LinkInterface& iface); void ComputeLinkImplementation(const char* config, diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index d3b3950..ec9c125 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1430,7 +1430,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) // Replace spaces in libs with ; cmSystemTools::ReplaceString(libs, " ", ";"); cmComputeLinkInformation* pcli = - this->GeneratorTarget->GetLinkInformation(config.c_str()); + this->Target->GetLinkInformation(config.c_str()); if(!pcli) { cmSystemTools::Error diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 1ec88fb..1424a11 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -110,8 +110,6 @@ #include <sys/stat.h> // struct stat -#include <memory> // auto_ptr - static bool cmakeCheckStampFile(const char* stampName); static bool cmakeCheckStampList(const char* stampName); @@ -519,7 +517,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args, // read in the list file to fill the cache if(path) { - std::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator()); lg->GetMakefile()->SetHomeOutputDirectory (cmSystemTools::GetCurrentWorkingDirectory().c_str()); lg->GetMakefile()->SetStartOutputDirectory @@ -558,7 +556,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args) this->SetGlobalGenerator(gg); // read in the list file to fill the cache - std::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator()); cmMakefile* mf = lg->GetMakefile(); mf->SetHomeOutputDirectory (cmSystemTools::GetCurrentWorkingDirectory().c_str()); @@ -1654,7 +1652,7 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args) if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen.c_str())) { cm.SetGlobalGenerator(ggd); - std::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator()); lgd->GetMakefile()->SetStartDirectory(startDir.c_str()); lgd->GetMakefile()->SetStartOutputDirectory(startOutDir.c_str()); lgd->GetMakefile()->MakeStartDirectoriesCurrent(); @@ -2794,7 +2792,7 @@ int cmake::CheckBuildSystem() cmake cm; cmGlobalGenerator gg; gg.SetCMakeInstance(&cm); - std::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator()); cmMakefile* mf = lg->GetMakefile(); if(!mf->ReadListFile(0, this->CheckBuildSystemArgument.c_str()) || cmSystemTools::GetErrorOccuredFlag()) @@ -2820,11 +2818,11 @@ int cmake::CheckBuildSystem() } // Create the generator and use it to clear the dependencies. - std::auto_ptr<cmGlobalGenerator> + cmsys::auto_ptr<cmGlobalGenerator> ggd(this->CreateGlobalGenerator(genName)); if(ggd.get()) { - std::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator()); + cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator()); lgd->ClearDependencies(mf, verbose); } } @@ -3067,7 +3065,7 @@ void cmake::MarkCliAsUsed(const std::string& variable) void cmake::GenerateGraphViz(const char* fileName) const { #ifdef CMAKE_BUILD_WITH_CMAKE - std::auto_ptr<cmGraphVizWriter> gvWriter( + cmsys::auto_ptr<cmGraphVizWriter> gvWriter( new cmGraphVizWriter(this->GetGlobalGenerator()->GetLocalGenerators())); std::string settingsFile = this->GetHomeOutputDirectory(); @@ -4466,7 +4464,7 @@ int cmake::Build(const std::string& dir, std::cerr << "Error: could find generator in Cache\n"; return 1; } - std::auto_ptr<cmGlobalGenerator> gen( + cmsys::auto_ptr<cmGlobalGenerator> gen( this->CreateGlobalGenerator(it.GetValue())); std::string output; std::string projName; diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index f2a198c..7dc2643 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -573,6 +573,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustomCommand") + ADD_TEST_MACRO(EmptyDepends ${CMAKE_CTEST_COMMAND}) + add_test(CustomCommandWorkingDirectory ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/CustomCommandWorkingDirectory" diff --git a/Tests/EmptyDepends/CMakeLists.txt b/Tests/EmptyDepends/CMakeLists.txt new file mode 100644 index 0000000..a24382c --- /dev/null +++ b/Tests/EmptyDepends/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 2.8) +project(EmptyDepends) + +include(CTest) + +set(extra_dep) + +add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/qrc_my.cxx + COMMAND ${CMAKE_COMMAND} -E touch "${CMAKE_BINARY_DIR}/qrc_my.cxx" + DEPENDS "${extra_dep}" "${CMAKE_BINARY_DIR}/my.qrc") + +add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/my.qrc + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_BINARY_DIR}/my.qrc) + +add_library(qrc SHARED ${CMAKE_BINARY_DIR}/qrc_my.cxx) |