From 131eed660716a2a8b52a6956f8e8a136425c404e Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Mon, 2 Jan 2012 11:07:43 -0700 Subject: cmake-gui: Improve interrupt granularity to fix bug 12649. Instead of enabling interrupt only when a progress or message callback is called, add a new callback specifically for interrupt. This new callback is called from GetFatalErrorOccured() so cmake-gui can immediately report interrupt status instead of calling queuing a call to cmSystemTools::SetFatalErrorOccured() and waiting for the progress or message callback to be called to process that queued call. --- Source/QtDialog/CMakeLists.txt | 4 ++-- Source/QtDialog/CMakeSetupDialog.cxx | 3 +-- Source/QtDialog/QCMake.cxx | 13 ++++++++++++- Source/QtDialog/QCMake.h | 5 ++++- Source/cmSystemTools.cxx | 16 ++++++++++++++++ Source/cmSystemTools.h | 9 ++++++++- 6 files changed, 43 insertions(+), 7 deletions(-) diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 4785188..056e48e 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -10,11 +10,11 @@ # See the License for more information. #============================================================================= PROJECT(QtDialog) -SET(QT_MIN_VERSION "4.3.0") +SET(QT_MIN_VERSION "4.4.0") FIND_PACKAGE(Qt4 REQUIRED) IF(NOT QT4_FOUND) - MESSAGE(SEND_ERROR "Failed to find Qt 4.3 or greater.") + MESSAGE(SEND_ERROR "Failed to find Qt 4.4 or greater.") ELSE(NOT QT4_FOUND) INCLUDE(${QT_USE_FILE}) diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 338eaff..45b4cd3 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -554,8 +554,7 @@ void CMakeSetupDialog::doHelp() void CMakeSetupDialog::doInterrupt() { this->enterState(Interrupting); - QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), - "interrupt", Qt::QueuedConnection); + this->CMakeThread->cmakeInstance()->interrupt(); } void CMakeSetupDialog::doSourceBrowse() diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index a40a175..73050f3 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -63,6 +63,8 @@ QCMake::QCMake(QObject* p) #endif this->CMakeInstance->SetProgressCallback(QCMake::progressCallback, this); + cmSystemTools::SetInterruptCallback(QCMake::interruptCallback, this); + std::vector generators; this->CMakeInstance->GetRegisteredGenerators(generators); std::vector::iterator iter; @@ -170,6 +172,7 @@ void QCMake::configure() this->CMakeInstance->SetWarnUnused(this->WarnUnusedMode); this->CMakeInstance->PreLoadCMakeFiles(); + InterruptFlag = 0; cmSystemTools::ResetErrorOccuredFlag(); int err = this->CMakeInstance->Configure(); @@ -188,7 +191,9 @@ void QCMake::generate() UINT lastErrorMode = SetErrorMode(0); #endif + InterruptFlag = 0; cmSystemTools::ResetErrorOccuredFlag(); + int err = this->CMakeInstance->Generate(); #ifdef Q_OS_WIN @@ -337,7 +342,13 @@ QCMakePropertyList QCMake::properties() const void QCMake::interrupt() { - cmSystemTools::SetFatalErrorOccured(); + this->InterruptFlag.ref(); +} + +bool QCMake::interruptCallback(void* cd) +{ + QCMake* self = reinterpret_cast(cd); + return self->InterruptFlag; } void QCMake::progressCallback(const char* msg, float percent, void* cd) diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h index 0d10823..0d68586 100644 --- a/Source/QtDialog/QCMake.h +++ b/Source/QtDialog/QCMake.h @@ -23,6 +23,7 @@ #include #include #include +#include class cmake; @@ -78,7 +79,7 @@ public slots: void generate(); /// set the property values void setProperties(const QCMakePropertyList&); - /// interrupt the configure or generate process + /// interrupt the configure or generate process (if connecting, make a direct connection) void interrupt(); /// delete the cache in binary directory void deleteCache(); @@ -133,6 +134,7 @@ signals: protected: cmake* CMakeInstance; + static bool interruptCallback(void*); static void progressCallback(const char* msg, float percent, void* cd); static void errorCallback(const char* msg, const char* title, bool&, void* cd); @@ -145,6 +147,7 @@ protected: QString Generator; QStringList AvailableGenerators; QString CMakeExecutable; + QAtomicInt InterruptFlag; }; #endif // __QCMake_h diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 8eec1e2..920a84a 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -131,6 +131,8 @@ void (*cmSystemTools::s_ErrorCallback)(const char*, const char*, void (*cmSystemTools::s_StdoutCallback)(const char*, int len, void*); void* cmSystemTools::s_ErrorCallbackClientData = 0; void* cmSystemTools::s_StdoutCallbackClientData = 0; +bool (*cmSystemTools::s_InterruptCallback)(void*); +void* cmSystemTools::s_InterruptCallbackClientData = 0; // replace replace with with as many times as it shows up in source. // write the result into source. @@ -220,6 +222,20 @@ void cmSystemTools::Error(const char* m1, const char* m2, cmSystemTools::Message(message.c_str(),"Error"); } +void cmSystemTools::SetInterruptCallback(InterruptCallback f, void* clientData) +{ + s_InterruptCallback = f; + s_InterruptCallbackClientData = clientData; +} + +bool cmSystemTools::GetInterruptFlag() +{ + if(s_InterruptCallback) + { + return (*s_InterruptCallback)(s_InterruptCallbackClientData); + } + return false; +} void cmSystemTools::SetErrorCallback(ErrorCallback f, void* clientData) { diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 641c89f..02203a1 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -78,6 +78,11 @@ public: ///! Send a string to stderr. Stdout callbacks will not be invoced. static void Stderr(const char* s, int length); + + typedef bool (*InterruptCallback)(void*); + static void SetInterruptCallback(InterruptCallback f, void* clientData=0); + static bool GetInterruptFlag(); + ///! Return true if there was an error at any point. static bool GetErrorOccuredFlag() { @@ -96,7 +101,7 @@ public: ///! Return true if there was an error at any point. static bool GetFatalErrorOccured() { - return cmSystemTools::s_FatalErrorOccured; + return cmSystemTools::s_FatalErrorOccured || GetInterruptFlag(); } ///! Set the error occured flag and fatal error back to false @@ -467,8 +472,10 @@ private: static bool s_DisableRunCommandOutput; static ErrorCallback s_ErrorCallback; static StdoutCallback s_StdoutCallback; + static InterruptCallback s_InterruptCallback; static void* s_ErrorCallbackClientData; static void* s_StdoutCallbackClientData; + static void* s_InterruptCallbackClientData; static std::string s_Windows9xComspecSubstitute; }; -- cgit v0.12 From 3cab24a9740ad1d35e548629f6dda12e166ef49e Mon Sep 17 00:00:00 2001 From: Daniel Nelson Date: Fri, 13 Jan 2012 22:01:53 +0100 Subject: CPack Add top level directory in component install for Archive Generators This patch fixes bug #0012129 Signed-off-by: Eric NOULARD --- Source/CPack/cmCPackArchiveGenerator.cxx | 11 +++++++++-- Source/CPack/cmCPackGenerator.cxx | 5 +++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 0ce5b01..12d1796 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -57,13 +57,20 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(cmArchiveWrite& archive, std::string dir = cmSystemTools::GetCurrentWorkingDirectory(); // Change to local toplevel cmSystemTools::ChangeDirectory(localToplevel.c_str()); + std::string filePrefix; + if (this->IsOn("CPACK_INCLUDE_TOPLEVEL_DIRECTORY")) + { + filePrefix = this->GetOption("CPACK_PACKAGE_FILE_NAME"); + filePrefix += "/"; + } std::vector::const_iterator fileIt; for (fileIt = component->Files.begin(); fileIt != component->Files.end(); ++fileIt ) { + std::string rp = filePrefix + *fileIt; cmCPackLogger(cmCPackLog::LOG_DEBUG,"Adding file: " - << (*fileIt) << std::endl); - archive.Add(*fileIt); + << rp << std::endl); + archive.Add(rp); if (!archive) { cmCPackLogger(cmCPackLog::LOG_ERROR, "ERROR while packaging files: " diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 083279f..01ed4df 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -691,6 +691,11 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( // one install directory for each component. tempInstallDirectory += GetComponentInstallDirNameSuffix(installComponent); + if (this->IsOn("CPACK_INCLUDE_TOPLEVEL_DIRECTORY")) + { + tempInstallDirectory += "/"; + tempInstallDirectory += this->GetOption("CPACK_PACKAGE_FILE_NAME"); + } } if (!setDestDir) -- cgit v0.12 From c6a016944211b737c45385423fc7df10462e34ab Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sun, 13 Nov 2011 22:44:53 +0100 Subject: CPack begin the implementation of --help-command* and --help-variables* This modifications set tries to keep the unified doc for cmake/ctest/cpack while introducing tool specific documentation separated. Some documentation sections for CMake do not fit well to CPack. --- Source/CMakeLists.txt | 2 + Source/CPack/cmCPackDocumentMacros.cxx | 78 ++++++++++++++++++ Source/CPack/cmCPackDocumentMacros.h | 21 +++++ Source/CPack/cmCPackDocumentVariables.cxx | 30 +++++++ Source/CPack/cmCPackDocumentVariables.h | 21 +++++ Source/CPack/cpack.cxx | 66 +++++++++++++-- Source/CursesDialog/ccmake.cxx | 1 + Source/QtDialog/CMakeSetup.cxx | 1 + Source/cmDocumentation.cxx | 132 +++++++++++++++++++----------- Source/cmDocumentation.h | 12 +++ Source/cmakemain.cxx | 1 + Source/ctest.cxx | 1 + 12 files changed, 312 insertions(+), 54 deletions(-) create mode 100644 Source/CPack/cmCPackDocumentMacros.cxx create mode 100644 Source/CPack/cmCPackDocumentMacros.h create mode 100644 Source/CPack/cmCPackDocumentVariables.cxx create mode 100644 Source/CPack/cmCPackDocumentVariables.h diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index b5115b7..0c420b9 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -449,6 +449,8 @@ SET(CPACK_SRCS CPack/cmCPackTarBZip2Generator.cxx CPack/cmCPackTarCompressGenerator.cxx CPack/cmCPackZIPGenerator.cxx + CPack/cmCPackDocumentVariables.cxx + CPack/cmCPackDocumentMacros.cxx ) IF(CYGWIN) diff --git a/Source/CPack/cmCPackDocumentMacros.cxx b/Source/CPack/cmCPackDocumentMacros.cxx new file mode 100644 index 0000000..0dd51a9 --- /dev/null +++ b/Source/CPack/cmCPackDocumentMacros.cxx @@ -0,0 +1,78 @@ +#include "cmCPackDocumentMacros.h" + +void cmCPackDocumentMacros::GetMacrosDocumentation( + std::vector& v) +{ + cmDocumentationEntry e("cpack_add_component", + "Describes a CPack installation component " + "named by the COMPONENT argument to a CMake INSTALL command.", + " cpack_add_component(compname\n" + " [DISPLAY_NAME name]\n" + " [DESCRIPTION description]\n" + " [HIDDEN | REQUIRED | DISABLED ]\n" + " [GROUP group]\n" + " [DEPENDS comp1 comp2 ... ]\n" + " [INSTALL_TYPES type1 type2 ... ]\n" + " [DOWNLOADED]\n" + " [ARCHIVE_FILE filename])\n" + "\n" + "The cmake_add_component command describes an installation" + "component, which the user can opt to install or remove as part of" + " the graphical installation process. compname is the name of the " + "component, as provided to the COMPONENT argument of one or more " + "CMake INSTALL commands." + "\n" + "DISPLAY_NAME is the displayed name of the component, used in " + "graphical installers to display the component name. This value " + "can be any string." + "\n" + "DESCRIPTION is an extended description of the component, used in " + "graphical installers to give the user additional information about " + "the component. Descriptions can span multiple lines using \"\\n\" " + " as the line separator. Typically, these descriptions should be no " + "more than a few lines long." + "\n" + "HIDDEN indicates that this component will be hidden in the " + "graphical installer, so that the user cannot directly change " + "whether it is installed or not." + "\n" + "REQUIRED indicates that this component is required, and therefore " + "will always be installed. It will be visible in the graphical " + "installer, but it cannot be unselected. (Typically, required " + "components are shown greyed out)." + "\n" + "DISABLED indicates that this component should be disabled " + "(unselected) by default. The user is free to select this component " + "for installation, unless it is also HIDDEN." + "\n" + "DEPENDS lists the components on which this component depends. If " + "this component is selected, then each of the components listed " + "must also be selected. The dependency information is encoded " + "within the installer itself, so that users cannot install " + "inconsistent sets of components." + "\n" + "GROUP names the component group of which this component is a " + "part. If not provided, the component will be a standalone " + "component, not part of any component group. Component groups are " + "described with the cpack_add_component_group command, detailed" + "below." + "\n" + "INSTALL_TYPES lists the installation types of which this component " + "is a part. When one of these installations types is selected, this " + "component will automatically be selected. Installation types are" + "described with the cpack_add_install_type command, detailed below." + "\n" + "DOWNLOADED indicates that this component should be downloaded " + "on-the-fly by the installer, rather than packaged in with the " + "installer itself. For more information, see the " + "cpack_configure_downloads command." + "\n" + "ARCHIVE_FILE provides a name for the archive file created by CPack " + "to be used for downloaded components. If not supplied, CPack will " + "create a file with some name based on CPACK_PACKAGE_FILE_NAME and " + "the name of the component. See cpack_configure_downloads for more " + "information." +); + + v.push_back(e); +} diff --git a/Source/CPack/cmCPackDocumentMacros.h b/Source/CPack/cmCPackDocumentMacros.h new file mode 100644 index 0000000..544f74f --- /dev/null +++ b/Source/CPack/cmCPackDocumentMacros.h @@ -0,0 +1,21 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmCPackDocumentMacros_h +#define cmCPackDocumentMacros_h +#include "cmStandardIncludes.h" +class cmCPackDocumentMacros +{ +public: + static void GetMacrosDocumentation(std::vector& v); +}; + +#endif diff --git a/Source/CPack/cmCPackDocumentVariables.cxx b/Source/CPack/cmCPackDocumentVariables.cxx new file mode 100644 index 0000000..1c98e7c --- /dev/null +++ b/Source/CPack/cmCPackDocumentVariables.cxx @@ -0,0 +1,30 @@ +#include "cmCPackDocumentVariables.h" +#include "cmake.h" + +void cmCPackDocumentVariables::DefineVariables(cmake* cm) +{ + // Subsection: variables defined/used by cpack, + // which are common to all CPack generators + cm->DefineProperty + ("CPACK_PACKAGE_NAME", cmProperty::VARIABLE, + "The name of the package (or application).", + "If not specified, defaults to the project name." + "", false, + "Variables common to all CPack generators"); + + cm->DefineProperty + ("CPACK_PACKAGE_VENDOR", cmProperty::VARIABLE, + "The name of the package vendor.", + "If not specified, defaults to \"Humanity\"." + "", false, + "Variables common to all CPack generators"); + + // Subsection: variables defined/used by cpack, + // which are specific to one CPack generator + cm->DefineProperty + ("CPACK_RPM_PACKAGE_NAME", cmProperty::VARIABLE, + "RPM specific package name.", + "If not specified, defaults to CPACK_PACKAGE_NAME." + "", false, + "Variables specific to a CPack generator"); +} diff --git a/Source/CPack/cmCPackDocumentVariables.h b/Source/CPack/cmCPackDocumentVariables.h new file mode 100644 index 0000000..e7971be --- /dev/null +++ b/Source/CPack/cmCPackDocumentVariables.h @@ -0,0 +1,21 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmCPackDocumentVariables_h +#define cmCPackDocumentVariables_h +class cmake; +class cmCPackDocumentVariables +{ +public: + static void DefineVariables(cmake* cm); +}; + +#endif diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 163f744..2cfbf12 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -14,6 +14,8 @@ // Need these for documentation support. #include "cmake.h" #include "cmDocumentation.h" +#include "cmCPackDocumentVariables.h" +#include "cmCPackDocumentMacros.h" #include "cmCPackGeneratorFactory.h" #include "cmCPackGenerator.h" #include "cmake.h" @@ -90,6 +92,40 @@ static const char * cmDocumentationOptions[][3] = "If vendor is not specified on cpack command line " "(or inside CMakeLists.txt) then" "CPack.cmake defines it with a default value"}, + {"--help-command cmd [file]", "Print help for a single command and exit.", + "Full documentation specific to the given command is displayed. " + "If a file is specified, the documentation is written into and the output " + "format is determined depending on the filename suffix. Supported are man " + "page, HTML, DocBook and plain text."}, + {"--help-command-list [file]", "List available commands and exit.", + "The list contains all commands for which help may be obtained by using " + "the --help-command argument followed by a command name. " + "If a file is specified, the documentation is written into and the output " + "format is determined depending on the filename suffix. Supported are man " + "page, HTML, DocBook and plain text."}, + {"--help-commands [file]", "Print help for all commands and exit.", + "Full documentation specific for all current command is displayed." + "If a file is specified, the documentation is written into and the output " + "format is determined depending on the filename suffix. Supported are man " + "page, HTML, DocBook and plain text."}, + {"--help-variable var [file]", + "Print help for a single variable and exit.", + "Full documentation specific to the given variable is displayed." + "If a file is specified, the documentation is written into and the output " + "format is determined depending on the filename suffix. Supported are man " + "page, HTML, DocBook and plain text."}, + {"--help-variable-list [file]", "List documented variables and exit.", + "The list contains all variables for which help may be obtained by using " + "the --help-variable argument followed by a variable name. If a file is " + "specified, the help is written into it." + "If a file is specified, the documentation is written into and the output " + "format is determined depending on the filename suffix. Supported are man " + "page, HTML, DocBook and plain text."}, + {"--help-variables [file]", "Print help for all variables and exit.", + "Full documentation for all variables is displayed." + "If a file is specified, the documentation is written into and the output " + "format is determined depending on the filename suffix. Supported are man " + "page, HTML, DocBook and plain text."}, {0,0,0} }; @@ -137,12 +173,15 @@ int cpackDefinitionArgument(const char* argument, const char* cValue, return 1; } + //---------------------------------------------------------------------------- // this is CPack. int main (int argc, char *argv[]) { cmSystemTools::FindExecutableDirectory(argv[0]); cmCPackLog log; + int nocwd = 0; + log.SetErrorPrefix("CPack Error: "); log.SetWarningPrefix("CPack Warning: "); log.SetOutputPrefix("CPack: "); @@ -154,6 +193,7 @@ int main (int argc, char *argv[]) { cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "Current working directory cannot be established." << std::endl); + nocwd = 1; } std::string generator; @@ -179,7 +219,6 @@ int main (int argc, char *argv[]) cpackConfigFile = ""; - cmDocumentation doc; cmsys::CommandLineArguments arg; arg.Initialize(argc, argv); typedef cmsys::CommandLineArguments argT; @@ -252,10 +291,16 @@ int main (int argc, char *argv[]) generators.SetLogger(&log); cmCPackGenerator* cpackGenerator = 0; - if ( !helpFull.empty() || !helpMAN.empty() || - !helpHTML.empty() || helpVersion ) + cmDocumentation doc; + doc.addCPackStandardDocSections(); + /* Were we invoked to display doc or to do some work ? */ + if(doc.CheckOptions(argc, argv,"-G") || nocwd) { - help = true; + help = true; + } + else + { + help = false; } if ( parsed && !help ) @@ -465,14 +510,25 @@ int main (int argc, char *argv[]) */ if ( help ) { - doc.CheckOptions(argc, argv); // Construct and print requested documentation. + std::vector variables; + doc.SetName("cpack"); doc.SetSection("Name",cmDocumentationName); doc.SetSection("Usage",cmDocumentationUsage); doc.SetSection("Description",cmDocumentationDescription); doc.PrependSection("Options",cmDocumentationOptions); + cmCPackDocumentVariables::DefineVariables(&cminst); + std::map propDocs; + cminst.GetPropertiesDocumentation(propDocs); + doc.SetSections(propDocs); + + std::vector commands; + cminst.GetCommandDocumentation(commands); + cmCPackDocumentMacros::GetMacrosDocumentation(commands); + doc.SetSection("Commands",commands); + std::vector v; cmCPackGeneratorFactory::DescriptionsMap::const_iterator generatorIt; for( generatorIt = generators.GetGeneratorsList().begin(); diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index b1a72af..623d7d3 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -102,6 +102,7 @@ int main(int argc, char** argv) { cmSystemTools::FindExecutableDirectory(argv[0]); cmDocumentation doc; + doc.addCMakeStandardDocSections(); if(doc.CheckOptions(argc, argv)) { cmake hcm; diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 7ba7f51..b4f3d72 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -64,6 +64,7 @@ int main(int argc, char** argv) // check docs first so that X is not need to get docs // do docs, if args were given cmDocumentation doc; + doc.addCMakeStandardDocSections(); if(argc >1 && doc.CheckOptions(argc, argv)) { // Construct and print requested documentation. diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 07683d0..8f603f2 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -220,55 +220,7 @@ cmDocumentation::cmDocumentation() :CurrentFormatter(0) { this->SetForm(TextForm); - - cmDocumentationSection *sec; - - sec = new cmDocumentationSection("Author","AUTHOR"); - sec->Append(cmDocumentationEntry - (0, - "This manual page was generated by the \"--help-man\" option.", - 0)); - this->AllSections["Author"] = sec; - - sec = new cmDocumentationSection("Copyright","COPYRIGHT"); - sec->Append(cmDocumentationCopyright); - this->AllSections["Copyright"] = sec; - - sec = new cmDocumentationSection("See Also","SEE ALSO"); - sec->Append(cmDocumentationStandardSeeAlso); - this->AllSections["Standard See Also"] = sec; - - sec = new cmDocumentationSection("Options","OPTIONS"); - sec->Append(cmDocumentationStandardOptions); - this->AllSections["Options"] = sec; - - sec = new cmDocumentationSection("Properties","PROPERTIES"); - sec->Append(cmPropertiesDocumentationDescription); - this->AllSections["Properties Description"] = sec; - - sec = new cmDocumentationSection("Generators","GENERATORS"); - sec->Append(cmDocumentationGeneratorsHeader); - this->AllSections["Generators"] = sec; - - sec = new cmDocumentationSection("Compatibility Commands", - "COMPATIBILITY COMMANDS"); - sec->Append(cmCompatCommandsDocumentationDescription); - this->AllSections["Compatibility Commands"] = sec; - - - this->PropertySections.push_back("Properties of Global Scope"); - this->PropertySections.push_back("Properties on Directories"); - this->PropertySections.push_back("Properties on Targets"); - this->PropertySections.push_back("Properties on Tests"); - this->PropertySections.push_back("Properties on Source Files"); - this->PropertySections.push_back("Properties on Cache Entries"); - - this->VariableSections.push_back("Variables that Provide Information"); - this->VariableSections.push_back("Variables That Change Behavior"); - this->VariableSections.push_back("Variables That Describe the System"); - this->VariableSections.push_back("Variables that Control the Build"); - this->VariableSections.push_back("Variables for Languages"); - + this->addCommonStandardDocSections(); this->ShowGenerators = true; } @@ -710,6 +662,88 @@ cmDocumentation::Form cmDocumentation::GetFormFromFilename( } //---------------------------------------------------------------------------- +void cmDocumentation::addCommonStandardDocSections() +{ + cmDocumentationSection *sec; + + sec = new cmDocumentationSection("Author","AUTHOR"); + sec->Append(cmDocumentationEntry + (0, + "This manual page was generated by the \"--help-man\" option.", + 0)); + this->AllSections["Author"] = sec; + + sec = new cmDocumentationSection("Copyright","COPYRIGHT"); + sec->Append(cmDocumentationCopyright); + this->AllSections["Copyright"] = sec; + + sec = new cmDocumentationSection("See Also","SEE ALSO"); + sec->Append(cmDocumentationStandardSeeAlso); + this->AllSections["Standard See Also"] = sec; + + sec = new cmDocumentationSection("Options","OPTIONS"); + sec->Append(cmDocumentationStandardOptions); + this->AllSections["Options"] = sec; + + sec = new cmDocumentationSection("Compatibility Commands", + "COMPATIBILITY COMMANDS"); + sec->Append(cmCompatCommandsDocumentationDescription); + this->AllSections["Compatibility Commands"] = sec; +} + +//---------------------------------------------------------------------------- +void cmDocumentation::addCMakeStandardDocSections() +{ + cmDocumentationSection *sec; + + sec = new cmDocumentationSection("Properties","PROPERTIES"); + sec->Append(cmPropertiesDocumentationDescription); + this->AllSections["Properties Description"] = sec; + + sec = new cmDocumentationSection("Generators","GENERATORS"); + sec->Append(cmDocumentationGeneratorsHeader); + this->AllSections["Generators"] = sec; + + this->PropertySections.push_back("Properties of Global Scope"); + this->PropertySections.push_back("Properties on Directories"); + this->PropertySections.push_back("Properties on Targets"); + this->PropertySections.push_back("Properties on Tests"); + this->PropertySections.push_back("Properties on Source Files"); + this->PropertySections.push_back("Properties on Cache Entries"); + + this->VariableSections.push_back("Variables that Provide Information"); + this->VariableSections.push_back("Variables That Change Behavior"); + this->VariableSections.push_back("Variables That Describe the System"); + this->VariableSections.push_back("Variables that Control the Build"); + this->VariableSections.push_back("Variables for Languages"); + +} + +//---------------------------------------------------------------------------- +void cmDocumentation::addCTestStandardDocSections() +{ + cmDocumentationSection *sec; + // This is currently done for backward compatibility reason + // We may suppress some of these. + addCMakeStandardDocSections(); +} + +//---------------------------------------------------------------------------- +void cmDocumentation::addCPackStandardDocSections() +{ + cmDocumentationSection *sec; + + sec = new cmDocumentationSection("Generators","GENERATORS"); + sec->Append(cmDocumentationGeneratorsHeader); + this->AllSections["Generators"] = sec; + + this->VariableSections.push_back( + "Variables common to all CPack generators"); + this->VariableSections.push_back( + "Variables specific to a CPack generator"); +} + +//---------------------------------------------------------------------------- bool cmDocumentation::CheckOptions(int argc, const char* const* argv, const char* exitOpt) { diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index 34b83b1..a7a7a1f 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -119,6 +119,18 @@ public: static Form GetFormFromFilename(const std::string& filename); + /** Add common (to all tools) documentation section(s) */ + void addCommonStandardDocSections(); + + /** Add the CMake standard documentation section(s) */ + void addCMakeStandardDocSections(); + + /** Add the CTest standard documentation section(s) */ + void addCTestStandardDocSections(); + + /** Add the CPack standard documentation section(s) */ + void addCPackStandardDocSections(); + private: void SetForm(Form f); void SetDocName(const char* docname); diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 436236d..c3de8ca 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -355,6 +355,7 @@ int do_cmake(int ac, char** av) #ifdef CMAKE_BUILD_WITH_CMAKE cmDocumentation doc; + doc.addCMakeStandardDocSections(); if(doc.CheckOptions(ac, av, "-E") || nocwd) { // Construct and print requested documentation. diff --git a/Source/ctest.cxx b/Source/ctest.cxx index 85cecea..d41627e 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -291,6 +291,7 @@ int main (int argc, char *argv[]) << "*********************************" << std::endl); } cmDocumentation doc; + doc.addCTestStandardDocSections(); if(doc.CheckOptions(argc, argv) || nocwd) { // Construct and print requested documentation. -- cgit v0.12 From 83e34dd9e688b4721c70c56e66629bdc2768fa77 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Tue, 15 Nov 2011 20:24:38 +0100 Subject: Implement simple CMake script comment markup language. The language is very simple. It use ## special comment which opens a structured documentation block and ##end closes it. This may be used to extract documentation for macro as 'command' and 'variables' such that cpack --help-command and --help-variable does parse builtin modules files (CPack.cmake, CPackComponent.cmake, ...) in order to extract the corresponding doc. --- Modules/CPack.cmake | 12 +++ Modules/CPackComponent.cmake | 8 ++ Source/CPack/cmCPackDocumentMacros.cxx | 2 +- Source/CPack/cmCPackDocumentVariables.cxx | 6 -- Source/CPack/cpack.cxx | 34 +++++- Source/cmDocumentation.cxx | 171 ++++++++++++++++++++++++++++++ Source/cmDocumentation.h | 23 ++++ 7 files changed, 247 insertions(+), 9 deletions(-) diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 2cc27cf..ce59693 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -49,21 +49,33 @@ # there are a variety of variables that can be set to customize # the resulting installers. The most commonly-used variables are: # +##variable # CPACK_PACKAGE_NAME - The name of the package (or application). If # not specified, defaults to the project name. +##end # +##variable # CPACK_PACKAGE_VENDOR - The name of the package vendor (e.g., # "Kitware"). +##end # +##variable # CPACK_PACKAGE_VERSION_MAJOR - Package major Version +##end # +##variable # CPACK_PACKAGE_VERSION_MINOR - Package minor Version +##end # +##variable # CPACK_PACKAGE_VERSION_PATCH - Package patch Version +##end # +##variable # CPACK_PACKAGE_DESCRIPTION_FILE - A text file used to describe the # project. Used, for example, the introduction screen of a # CPack-generated Windows installer to describe the project. +##end # # CPACK_PACKAGE_DESCRIPTION_SUMMARY - Short description of the # project (only a few words). diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake index 1c10372..a0e0667 100644 --- a/Modules/CPackComponent.cmake +++ b/Modules/CPackComponent.cmake @@ -21,6 +21,7 @@ # INSTALL commands, and should be further described by the following # CPack commands: # +##macro # cpack_add_component - Describes a CPack installation component # named by the COMPONENT argument to a CMake INSTALL command. # @@ -90,7 +91,9 @@ # create a file with some name based on CPACK_PACKAGE_FILE_NAME and # the name of the component. See cpack_configure_downloads for more # information. +##end # +##macro # cpack_add_component_group - Describes a group of related CPack # installation components. # @@ -134,7 +137,9 @@ # # BOLD_TITLE indicates that the group title should appear in bold, # to call the user's attention to the group. +##end # +##macro # cpack_add_install_type - Add a new installation type containing a # set of predefined component selections to the graphical installer. # @@ -153,7 +158,9 @@ # DISPLAY_NAME is the displayed name of the install type, which will # typically show up in a drop-down box within a graphical # installer. This value can be any string. +##end # +##macro # cpack_configure_downloads - Configure CPack to download selected # components on-the-fly as part of the installation process. # @@ -203,6 +210,7 @@ # that can be called from Windows' Add/Remove Programs dialog (via the # "Modify" button) to change the set of installed components. NO_ADD_REMOVE # turns off this behavior. This option is ignored on Mac OS X. +##endmacro #============================================================================= # Copyright 2006-2009 Kitware, Inc. diff --git a/Source/CPack/cmCPackDocumentMacros.cxx b/Source/CPack/cmCPackDocumentMacros.cxx index 0dd51a9..1ff0351 100644 --- a/Source/CPack/cmCPackDocumentMacros.cxx +++ b/Source/CPack/cmCPackDocumentMacros.cxx @@ -74,5 +74,5 @@ void cmCPackDocumentMacros::GetMacrosDocumentation( "information." ); - v.push_back(e); + //v.push_back(e); } diff --git a/Source/CPack/cmCPackDocumentVariables.cxx b/Source/CPack/cmCPackDocumentVariables.cxx index 1c98e7c..ab806d2 100644 --- a/Source/CPack/cmCPackDocumentVariables.cxx +++ b/Source/CPack/cmCPackDocumentVariables.cxx @@ -5,12 +5,6 @@ void cmCPackDocumentVariables::DefineVariables(cmake* cm) { // Subsection: variables defined/used by cpack, // which are common to all CPack generators - cm->DefineProperty - ("CPACK_PACKAGE_NAME", cmProperty::VARIABLE, - "The name of the package (or application).", - "If not specified, defaults to the project name." - "", false, - "Variables common to all CPack generators"); cm->DefineProperty ("CPACK_PACKAGE_VENDOR", cmProperty::VARIABLE, diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 2cfbf12..8e59fa0 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -520,11 +520,41 @@ int main (int argc, char *argv[]) doc.PrependSection("Options",cmDocumentationOptions); cmCPackDocumentVariables::DefineVariables(&cminst); + + std::vector commands; + + cminst.AddCMakePaths(); + std::string systemFile = + globalMF->GetModulesFile("CMakeDetermineSystem.cmake"); + if (!globalMF->ReadListFile(0, systemFile.c_str())) + { + cmCPack_Log(&log, cmCPackLog::LOG_ERROR, + "Error reading CMakeDetermineSystem.cmake" << std::endl); + return 1; + } + + systemFile = + globalMF->GetModulesFile("CMakeSystemSpecificInformation.cmake"); + if (!globalMF->ReadListFile(0, systemFile.c_str())) + { + cmCPack_Log(&log, cmCPackLog::LOG_ERROR, + "Error reading CMakeSystemSpecificInformation.cmake" + << std::endl); + return 1; + } + std::string cpFile = globalMF->GetModulesFile("CPack.cmake"); + doc.getStructuredDocFromFile(cpFile.c_str(), + commands,&cminst,"Variables common to all CPack generators"); + cpFile = globalMF->GetModulesFile("CPackComponent.cmake"); + doc.getStructuredDocFromFile(cpFile.c_str(), + commands,&cminst,"Variables common to all CPack generators"); + cpFile = globalMF->GetModulesFile("CPackRPM.cmake"); + doc.getStructuredDocFromFile(cpFile.c_str(), + commands,&cminst,"Variables specific to a CPack generator"); + std::map propDocs; cminst.GetPropertiesDocumentation(propDocs); doc.SetSections(propDocs); - - std::vector commands; cminst.GetCommandDocumentation(commands); cmCPackDocumentMacros::GetMacrosDocumentation(commands); doc.SetSection("Commands",commands); diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 8f603f2..b7b8e37 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -511,6 +511,8 @@ bool cmDocumentation::CreateSingleModule(const char* fname, { if(line.size() && line[0] == '#') { + /* line beginnings with ## are mark-up ignore them */ + if (line[1] == '#') continue; // blank line if(line.size() <= 2) { @@ -744,6 +746,175 @@ void cmDocumentation::addCPackStandardDocSections() } //---------------------------------------------------------------------------- +static void trim(std::string& s) +{ + std::string::size_type pos = s.find_last_not_of(' '); + if(pos != std::string::npos) { + s.erase(pos + 1); + pos = s.find_first_not_of(' '); + if(pos != std::string::npos) s.erase(0, pos); + } + else s.erase(s.begin(), s.end()); +} + +int cmDocumentation::getStructuredDocFromFile( + const char* fname, + std::vector& commands, + cmake* cm, + const char *docSection) +{ + typedef enum sdoce { + SDOC_NONE, SDOC_MACRO, + SDOC_PARAM, SDOC_VARIABLE, + SDOC_UNKNOWN} sdoc_t; + int nbDocItemFound = 0; + int docCtxIdx = 0; + std::vector docContextStack(60); + docContextStack[docCtxIdx]=SDOC_NONE; + cmDocumentationEntry e; + std::ifstream fin(fname); + if(!fin) + { + //std::cerr << "Internal error: can not open script file: <" << fname <<">."<< std::endl; + return nbDocItemFound; + } + std::string name; + std::string full; + std::string brief; + std::string line; + bool newCtx = false; + bool inBrief = false; + brief = ""; + full = ""; + bool newParagraph = true; + while ( fin && cmSystemTools::GetLineFromStream(fin, line) ) + { + if(line.size() && line[0] == '#') + { + /* handle structured doc context */ + if (line[1]=='#') { + std::string mkword = line.substr(2,std::string::npos); + if (mkword=="macro") + { + docCtxIdx++; + docContextStack[docCtxIdx]=SDOC_MACRO; + newCtx = true; + } + else if (mkword=="variable") + { + docCtxIdx++; + docContextStack[docCtxIdx]=SDOC_VARIABLE; + newCtx = true; + } + else if (mkword.substr(0,3)=="end") + { + ; + switch (docContextStack[docCtxIdx]) { + case SDOC_MACRO: + commands.push_back(cmDocumentationEntry(name.c_str(), + brief.c_str(),full.c_str())); + break; + case SDOC_VARIABLE: + cm->DefineProperty + (name.c_str(), cmProperty::VARIABLE, + brief.c_str(), + full.c_str(),false, + docSection); + break; + } + docCtxIdx--; + newCtx = false; + } + else + { + // error out unhandled context + std::cerr << "Internal error: unknown markup context <" + << mkword <<"> found in:" << fname << std::endl; + return nbDocItemFound; + } + /* context is set go to next doc line */ + continue; + } + + // Now parse the text attached to the context + + // The first line after the context mark-up contains:: + // name - brief until. (brief is dot terminated or + // followed by a blank line) + if (newCtx) + { + name = line.substr(1,line.find("-")-1); + trim(name); + brief = ""; + line = line.substr(line.find("- ")+1,std::string::npos); + inBrief = true; + full = ""; + } + // blank line + if(line.size() <= 2) + { + inBrief = false; + full += "\n"; + newParagraph = true; + } + // brief terminated by . + else if (inBrief && line[line.length()-1]=='.') + { + inBrief = false; + brief += line.c_str()+1; + } + // we handle full text or multi-line brief. + else + { + std::string* text; + if (inBrief) { + text = &brief; + } else { + text = &full; + } + // two spaces + if(line[1] == ' ' && line[2] == ' ') + { + if(!newParagraph) + { + + *text += "\n"; + newParagraph = true; + } + // Skip #, and leave space for preformatted + *text += line.c_str()+1; + *text += "\n"; + } + else if(line[1] == ' ') + { + if(!newParagraph) + { + *text += " "; + } + newParagraph = false; + // skip # and space + *text += line.c_str()+2; + } + else + { + if(!newParagraph) + { + *text += " "; + } + newParagraph = false; + // skip # + *text += line.c_str()+1; + } + } + } + /* next line is not the first context line */ + newCtx = false; + } + + return nbDocItemFound; +} + +//---------------------------------------------------------------------------- bool cmDocumentation::CheckOptions(int argc, const char* const* argv, const char* exitOpt) { diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index a7a7a1f..2f6e09e 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -21,6 +21,7 @@ #include "cmDocumentationFormatterText.h" #include "cmDocumentationFormatterUsage.h" #include "cmDocumentationSection.h" +#include "cmake.h" namespace cmsys { @@ -131,6 +132,28 @@ public: /** Add the CPack standard documentation section(s) */ void addCPackStandardDocSections(); + /** + * Get the documentation of macros and variable documented + * with CMake structured documentation in a CMake script. + * Structured documentation begin with + * ## (double sharp) in column 1 & 2 immediately followed + * by a markup. Those ## are ignored by the legacy module + * documentation parser @see CreateSingleModule. + * Current markup are ##macro, ##param, ##variable and ##end + * which is closing either of the previous ones. + * @param[in] fname the script file name to be parsed for documentation + * @param[in,out] commands the vector of command/macros documentation + * entry found in the script file. + * @param[in,out] the cmake object instance to which variable documentation + * will be attached (using @see cmake::DefineProperty) + * @return the number of documented items (command and variable) + * found in the file. + */ + int getStructuredDocFromFile(const char* fname, + std::vector& commands, + cmake* cm, + const char *docSection); + ; private: void SetForm(Form f); void SetDocName(const char* docname); -- cgit v0.12 From 1629615a10df10296ba6588f66a680eed424f9ba Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Tue, 3 Jan 2012 00:54:08 +0100 Subject: CPack Documentation extraction from CMake script begins to work - Enhance extract doc parser. Seems robust now. The legacy module documentation parser works as before ignoring the new markup. - Proof of concept for CPack (generic), CPack RPM and CPack Deb generator for macro and variables. Try cpack --help-command and cpack --help-variables --- Modules/CPack.cmake | 55 +++++++++++- Modules/CPackDeb.cmake | 34 ++++++++ Modules/CPackRPM.cmake | 107 ++++++++++++++++------- Source/CPack/cmCPackDocumentMacros.cxx | 80 ++--------------- Source/CPack/cmCPackDocumentVariables.cxx | 24 ++--- Source/CPack/cpack.cxx | 103 +++++++++++----------- Source/cmCommand.h | 11 +++ Source/cmDocumentation.cxx | 140 +++++++++++++++++++++++------- Source/cmDocumentation.h | 11 ++- Source/cmFunctionCommand.cxx | 11 +++ Source/cmMacroCommand.cxx | 11 +++ Source/cmake.cxx | 4 +- 12 files changed, 387 insertions(+), 204 deletions(-) diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index ce59693..1718008 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -1,5 +1,4 @@ -# - Build binary and source package installers -# +# - Build binary and source package installers. # The CPack module generates binary and source installers in a variety # of formats using the cpack program. Inclusion of the CPack module # adds two new targets to the resulting makefiles, package and @@ -55,7 +54,7 @@ ##end # ##variable -# CPACK_PACKAGE_VENDOR - The name of the package vendor (e.g., +# CPACK_PACKAGE_VENDOR - The name of the package vendor. (e.g., # "Kitware"). ##end # @@ -77,78 +76,112 @@ # CPack-generated Windows installer to describe the project. ##end # +##variable # CPACK_PACKAGE_DESCRIPTION_SUMMARY - Short description of the # project (only a few words). +##end # +##variable # CPACK_PACKAGE_FILE_NAME - The name of the package file to generate, # not including the extension. For example, cmake-2.6.1-Linux-i686. +##end # +##variable # CPACK_PACKAGE_INSTALL_DIRECTORY - Installation directory on the # target system, e.g., "CMake 2.5". +##end # +##variable # CPACK_PROJECT_CONFIG_FILE - File included at cpack time, once per # generator after setting CPACK_GENERATOR to the actual generator # being used. Allows per-generator setting of CPACK_* variables at # cpack time. +##end # +##variable # CPACK_RESOURCE_FILE_LICENSE - License file for the project, which # will typically be displayed to the user (often with an explicit # "Accept" button, for graphical installers) prior to installation. +##end # +##variable # CPACK_RESOURCE_FILE_README - ReadMe file for the project, which # typically describes in some detail +##end # +##variable # CPACK_RESOURCE_FILE_WELCOME - Welcome file for the project, which # welcomes users to this installer. Typically used in the graphical # installers on Windows and Mac OS X. +##end # +##variable # CPACK_MONOLITHIC_INSTALL - Disables the component-based # installation mechanism, so that all components are always installed. +##end # +##variable # CPACK_GENERATOR - List of CPack generators to use. If not # specified, CPack will create a set of options (e.g., # CPACK_BINARY_NSIS) allowing the user to enable/disable individual # generators. +##end # +##variable # CPACK_OUTPUT_CONFIG_FILE - The name of the CPack configuration file # for binary installers that will be generated by the CPack # module. Defaults to CPackConfig.cmake. +##end # +##variable # CPACK_PACKAGE_EXECUTABLES - Lists each of the executables along # with a text label, to be used to create Start Menu shortcuts on # Windows. For example, setting this to the list ccmake;CMake will # create a shortcut named "CMake" that will execute the installed # executable ccmake. +##end # +##variable # CPACK_STRIP_FILES - List of files to be stripped. Starting with # CMake 2.6.0 CPACK_STRIP_FILES will be a boolean variable which # enables stripping of all files (a list of files evaluates to TRUE # in CMake, so this change is compatible). +##end # # The following CPack variables are specific to source packages, and # will not affect binary packages: # +##variable # CPACK_SOURCE_PACKAGE_FILE_NAME - The name of the source package, # e.g., cmake-2.6.1 +##end # +##variable # CPACK_SOURCE_STRIP_FILES - List of files in the source tree that # will be stripped. Starting with CMake 2.6.0 # CPACK_SOURCE_STRIP_FILES will be a boolean variable which enables # stripping of all files (a list of files evaluates to TRUE in CMake, # so this change is compatible). +##end # +##variable # CPACK_SOURCE_GENERATOR - List of generators used for the source # packages. As with CPACK_GENERATOR, if this is not specified then # CPack will create a set of options (e.g., CPACK_SOURCE_ZIP) # allowing users to select which packages will be generated. +##end # +##variable # CPACK_SOURCE_OUTPUT_CONFIG_FILE - The name of the CPack # configuration file for source installers that will be generated by # the CPack module. Defaults to CPackSourceConfig.cmake. +##end # +##variable # CPACK_SOURCE_IGNORE_FILES - Pattern of files in the source tree # that won't be packaged when building a source package. This is a # list of patterns, e.g., /CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~;cscope.* +##end # # The following variables are specific to the DragNDrop installers # built on Mac OS X: @@ -207,27 +240,41 @@ # # The following variables are for advanced uses of CPack: # +##variable # CPACK_CMAKE_GENERATOR - What CMake generator should be used if the # project is CMake project. Defaults to the value of CMAKE_GENERATOR; # few users will want to change this setting. +##end # +##variable # CPACK_INSTALL_CMAKE_PROJECTS - List of four values that specify # what project to install. The four values are: Build directory, # Project Name, Project Component, Directory. If omitted, CPack will # build an installer that installers everything. +##end # +##variable # CPACK_SYSTEM_NAME - System name, defaults to the value of # ${CMAKE_SYSTEM_NAME}. +##end # +##variable # CPACK_PACKAGE_VERSION - Package full version, used internally. By # default, this is built from CPACK_PACKAGE_VERSION_MAJOR, # CPACK_PACKAGE_VERSION_MINOR, and CPACK_PACKAGE_VERSION_PATCH. +##end # +##variable # CPACK_TOPLEVEL_TAG - Directory for the installed files. +##end # +##variable # CPACK_INSTALL_COMMANDS - Extra commands to install components. +##end # +##variable # CPACK_INSTALLED_DIRECTORIES - Extra directories to install. +##end # #============================================================================= @@ -271,7 +318,7 @@ MACRO(cpack_set_if_not_set name value) ENDIF(NOT DEFINED "${name}") ENDMACRO(cpack_set_if_not_set) -# Macro to encode variables for the configuration file +# cpack_encode_variables - Macro to encode variables for the configuration file # find any variable that starts with CPACK and create a variable # _CPACK_OTHER_VARIABLES_ that contains SET commands for # each cpack variable. _CPACK_OTHER_VARIABLES_ is then diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 26433bb..fc7f992 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -12,42 +12,61 @@ # http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29 # However as a handy reminder here comes the list of specific variables: # +##variable # CPACK_DEBIAN_PACKAGE_NAME # Mandatory : YES # Default : CPACK_PACKAGE_NAME (lower case) # The debian package summary +##end +##variable # CPACK_DEBIAN_PACKAGE_VERSION # Mandatory : YES # Default : CPACK_PACKAGE_VERSION # The debian package version +##end +##variable # CPACK_DEBIAN_PACKAGE_ARCHITECTURE # Mandatory : YES # Default : Output of dpkg --print-architecture (or i386 if dpkg is not found) # The debian package architecture +##end +##variable # CPACK_DEBIAN_PACKAGE_DEPENDS # Mandatory : NO # Default : - # May be used to set deb dependencies. +##end +##variable # CPACK_DEBIAN_PACKAGE_MAINTAINER # Mandatory : YES # Default : CPACK_PACKAGE_CONTACT # The debian package maintainer +##end +##variable # CPACK_DEBIAN_PACKAGE_DESCRIPTION # Mandatory : YES # Default : CPACK_PACKAGE_DESCRIPTION_SUMMARY # The debian package description +##end +##variable # CPACK_DEBIAN_PACKAGE_SECTION # Mandatory : YES # Default : 'devel' # The debian package section +##end +##variable # CPACK_DEBIAN_PACKAGE_PRIORITY # Mandatory : YES # Default : 'optional' # The debian package priority +##end +##variable # CPACK_DEBIAN_PACKAGE_HOMEPAGE # Mandatory : NO # Default : - # The URL of the web site for this package +##end +##variable # CPACK_DEBIAN_PACKAGE_SHLIBDEPS # Mandatory : NO # Default : OFF @@ -57,11 +76,15 @@ # if you use this feature, because if you don't dpkg-shlibdeps # may fail to find your own shared libs. # See http://www.cmake.org/Wiki/CMake_RPATH_handling. +##end +##variable # CPACK_DEBIAN_PACKAGE_DEBUG # Mandatory : NO # Default : - # May be set when invoking cpack in order to trace debug information # during CPackDeb run. +##end +##variable # CPACK_DEBIAN_PACKAGE_PREDEPENDS # Mandatory : NO # Default : - @@ -69,12 +92,16 @@ # This field is like Depends, except that it also forces dpkg to complete installation of # the packages named before even starting the installation of the package which declares # the pre-dependency. +##end +##variable # CPACK_DEBIAN_PACKAGE_ENHANCES # Mandatory : NO # Default : - # see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps # This field is similar to Suggests but works in the opposite direction. # It is used to declare that a package can enhance the functionality of another package. +##end +##variable # CPACK_DEBIAN_PACKAGE_BREAKS # Mandatory : NO # Default : - @@ -82,23 +109,30 @@ # When one binary package declares that it breaks another, dpkg will refuse to allow the # package which declares Breaks be installed unless the broken package is deconfigured first, # and it will refuse to allow the broken package to be reconfigured. +##end +##variable # CPACK_DEBIAN_PACKAGE_CONFLICTS # Mandatory : NO # Default : - # see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps # When one binary package declares a conflict with another using a Conflicts field, # dpkg will refuse to allow them to be installed on the system at the same time. +##end +##variable # CPACK_DEBIAN_PACKAGE_PROVIDES # Mandatory : NO # Default : - # see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps # A virtual package is one which appears in the Provides control field of another package. +##end +##variable # CPACK_DEBIAN_PACKAGE_REPLACES # Mandatory : NO # Default : - # see http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps # Packages can declare in their control file that they should overwrite # files in certain other packages, or completely replace other packages. +##end #============================================================================= # Copyright 2007-2009 Kitware, Inc. diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index e1e76ed..de06fef 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -1,4 +1,5 @@ # - The builtin (binary) CPack RPM generator (Unix only) +##module # CPackRPM may be used to create RPM package using CPack. # CPackRPM is a CPack generator thus it uses the CPACK_XXX variables # used by CPack : http://www.cmake.org/Wiki/CMake:CPackConfiguration @@ -15,52 +16,67 @@ # You'll find a detailed usage of CPackRPM on the wiki: # http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#RPM_.28Unix_Only.29 # However as a handy reminder here comes the list of specific variables: +##end # -# CPACK_RPM_PACKAGE_SUMMARY +##variable +# CPACK_RPM_PACKAGE_SUMMARY - The RPM package summary. # Mandatory : YES # Default : CPACK_PACKAGE_DESCRIPTION_SUMMARY -# The RPM package summary -# CPACK_RPM_PACKAGE_NAME +##end +##variable +# CPACK_RPM_PACKAGE_NAME - The RPM package name. # Mandatory : YES # Default : CPACK_PACKAGE_NAME -# The RPM package name -# CPACK_RPM_PACKAGE_VERSION +##end +##variable +# CPACK_RPM_PACKAGE_VERSION - The RPM package version. # Mandatory : YES # Default : CPACK_PACKAGE_VERSION -# The RPM package version -# CPACK_RPM_PACKAGE_ARCHITECTURE +##end +##variable +# CPACK_RPM_PACKAGE_ARCHITECTURE - The RPM package architecture. # Mandatory : NO # Default : - -# The RPM package architecture. This may be set to "noarch" if you +# This may be set to "noarch" if you # know you are building a noarch package. -# CPACK_RPM_PACKAGE_RELEASE +##end +##variable +# CPACK_RPM_PACKAGE_RELEASE - The RPM package release. # Mandatory : YES # Default : 1 -# The RPM package release. This is the numbering of the RPM package +# This is the numbering of the RPM package # itself, i.e. the version of the packaging and not the version of the # content (see CPACK_RPM_PACKAGE_VERSION). One may change the default # value if the previous packaging was buggy and/or you want to put here # a fancy Linux distro specific numbering. -# CPACK_RPM_PACKAGE_LICENSE +##end +##variable +# CPACK_RPM_PACKAGE_LICENSE - The RPM package license policy. # Mandatory : YES # Default : "unknown" -# The RPM package license policy. -# CPACK_RPM_PACKAGE_GROUP +##end +##variable +# CPACK_RPM_PACKAGE_GROUP - The RPM package group. # Mandatory : YES # Default : "unknown" -# The RPM package group. -# CPACK_RPM_PACKAGE_VENDOR +##end +##variable +# CPACK_RPM_PACKAGE_VENDOR - The RPM package vendor. # Mandatory : YES # Default : CPACK_PACKAGE_VENDOR if set or "unknown" -# The RPM package vendor. -# CPACK_RPM_PACKAGE_URL +##end +##variable +# CPACK_RPM_PACKAGE_URL - The projects URL. # Mandatory : NO # Default : - -# The projects URL. -# CPACK_RPM_PACKAGE_DESCRIPTION +##end +##variable +# CPACK_RPM_PACKAGE_DESCRIPTION - RPM package description. # Mandatory : YES # Default : CPACK_PACKAGE_DESCRIPTION_FILE if set or "no package description available" -# CPACK_RPM_COMPRESSION_TYPE +##end +##variable +# CPACK_RPM_COMPRESSION_TYPE - RPM compression type. # Mandatory : NO # Default : - # May be used to override RPM compression type to be used @@ -68,7 +84,9 @@ # to lzma or xz compression whereas older cannot use such RPM. # Using this one can enforce compression type to be used. # Possible value are: lzma, xz, bzip2 and gzip. -# CPACK_RPM_PACKAGE_REQUIRES +##end +##variable +# CPACK_RPM_PACKAGE_REQUIRES - RPM spec requires field. # Mandatory : NO # Default : - # May be used to set RPM dependencies (requires). @@ -77,22 +95,30 @@ # set(CPACK_RPM_PACKAGE_REQUIRES "python >= 2.5.0, cmake >= 2.8") # The required package list of an RPM file could be printed with # rpm -qp --requires file.rpm -# CPACK_RPM_PACKAGE_SUGGESTS +##end +##variable +# CPACK_RPM_PACKAGE_SUGGESTS - RPM spec suggest field. # Mandatory : NO # Default : - # May be used to set weak RPM dependencies (suggests). # Note that you must enclose the complete requires string between quotes. -# CPACK_RPM_PACKAGE_PROVIDES +##end +##variable +# CPACK_RPM_PACKAGE_PROVIDES - RPM spec provides field. # Mandatory : NO # Default : - # May be used to set RPM dependencies (provides). # The provided package list of an RPM file could be printed with # rpm -qp --provides file.rpm -# CPACK_RPM_PACKAGE_OBSOLETES +##end +##variable +# CPACK_RPM_PACKAGE_OBSOLETES - RPM spec obsoletes field. # Mandatory : NO # Default : - # May be used to set RPM packages that are obsoleted by this one. -# CPACK_RPM_PACKAGE_RELOCATABLE +##end +##variable +# CPACK_RPM_PACKAGE_RELOCATABLE - build a relocatable RPM. # Mandatory : NO # Default : CPACK_PACKAGE_RELOCATABLE # If this variable is set to TRUE or ON CPackRPM will try @@ -103,7 +129,9 @@ # If CPACK_SET_DESTDIR is set then you will get a warning message # but if there is file installed with absolute path you'll get # unexpected behavior. -# CPACK_RPM_SPEC_INSTALL_POST [deprecated] +##end +##variable +# CPACK_RPM_SPEC_INSTALL_POST - [deprecated]. # Mandatory : NO # Default : - # This way of specifying post-install script is deprecated use @@ -111,23 +139,31 @@ # May be used to set an RPM post-install command inside the spec file. # For example setting it to "/bin/true" may be used to prevent # rpmbuild to strip binaries. -# CPACK_RPM_SPEC_MORE_DEFINE +##end +##variable +# CPACK_RPM_SPEC_MORE_DEFINE - RPM extended spec definitions lines. # Mandatory : NO # Default : - # May be used to add any %define lines to the generated spec file. -# CPACK_RPM_PACKAGE_DEBUG +##end +##variable +# CPACK_RPM_PACKAGE_DEBUG - Toggle CPackRPM debug output. # Mandatory : NO # Default : - # May be set when invoking cpack in order to trace debug information # during CPack RPM run. For example you may launch CPack like this # cpack -D CPACK_RPM_PACKAGE_DEBUG=1 -G RPM -# CPACK_RPM_USER_BINARY_SPECFILE +##end +##variable +# CPACK_RPM_USER_BINARY_SPECFILE - A user provided spec file. # Mandatory : NO # Default : - # May be set by the user in order to specify a USER binary spec file # to be used by CPackRPM instead of generating the file. # The specified file will be processed by CONFIGURE_FILE( @ONLY). -# CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE +##end +##variable +# CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE - Spec file template. # Mandatory : NO # Default : - # If set CPack will generate a template for USER specified binary @@ -135,6 +171,8 @@ # cpack -D CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE=1 -G RPM # The user may then use this file in order to hand-craft is own # binary spec file which may be used with CPACK_RPM_USER_BINARY_SPECFILE. +##end +##variable # CPACK_RPM_PRE_INSTALL_SCRIPT_FILE # CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE # Mandatory : NO @@ -148,6 +186,8 @@ # CPACK_RPM__PRE_UNINSTALL_SCRIPT_FILE # One may verify which scriptlet has been included with # rpm -qp --scripts package.rpm +##end +##variable # CPACK_RPM_POST_INSTALL_SCRIPT_FILE # CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE # Mandatory : NO @@ -161,6 +201,8 @@ # CPACK_RPM__POST_UNINSTALL_SCRIPT_FILE # One may verify which scriptlet has been included with # rpm -qp --scripts package.rpm +##end +##variable # CPACK_RPM_USER_FILELIST # CPACK_RPM__USER_FILELIST # Mandatory : NO @@ -170,12 +212,15 @@ # that be found in the %files section. Since CPackRPM is generating # the list of files (and directories) the user specified files of # the CPACK_RPM__USER_FILELIST list will be removed from the generated list. -# CPACK_RPM_CHANGELOG_FILE +##end +##variable +# CPACK_RPM_CHANGELOG_FILE - RPM changelog file. # Mandatory : NO # Default : - # May be used to embed a changelog in the spec file. # The refered file will be read and directly put after the %changelog # section. +##end #============================================================================= # Copyright 2007-2009 Kitware, Inc. diff --git a/Source/CPack/cmCPackDocumentMacros.cxx b/Source/CPack/cmCPackDocumentMacros.cxx index 1ff0351..8752e56 100644 --- a/Source/CPack/cmCPackDocumentMacros.cxx +++ b/Source/CPack/cmCPackDocumentMacros.cxx @@ -3,76 +3,14 @@ void cmCPackDocumentMacros::GetMacrosDocumentation( std::vector& v) { - cmDocumentationEntry e("cpack_add_component", - "Describes a CPack installation component " - "named by the COMPONENT argument to a CMake INSTALL command.", - " cpack_add_component(compname\n" - " [DISPLAY_NAME name]\n" - " [DESCRIPTION description]\n" - " [HIDDEN | REQUIRED | DISABLED ]\n" - " [GROUP group]\n" - " [DEPENDS comp1 comp2 ... ]\n" - " [INSTALL_TYPES type1 type2 ... ]\n" - " [DOWNLOADED]\n" - " [ARCHIVE_FILE filename])\n" - "\n" - "The cmake_add_component command describes an installation" - "component, which the user can opt to install or remove as part of" - " the graphical installation process. compname is the name of the " - "component, as provided to the COMPONENT argument of one or more " - "CMake INSTALL commands." - "\n" - "DISPLAY_NAME is the displayed name of the component, used in " - "graphical installers to display the component name. This value " - "can be any string." - "\n" - "DESCRIPTION is an extended description of the component, used in " - "graphical installers to give the user additional information about " - "the component. Descriptions can span multiple lines using \"\\n\" " - " as the line separator. Typically, these descriptions should be no " - "more than a few lines long." - "\n" - "HIDDEN indicates that this component will be hidden in the " - "graphical installer, so that the user cannot directly change " - "whether it is installed or not." - "\n" - "REQUIRED indicates that this component is required, and therefore " - "will always be installed. It will be visible in the graphical " - "installer, but it cannot be unselected. (Typically, required " - "components are shown greyed out)." - "\n" - "DISABLED indicates that this component should be disabled " - "(unselected) by default. The user is free to select this component " - "for installation, unless it is also HIDDEN." - "\n" - "DEPENDS lists the components on which this component depends. If " - "this component is selected, then each of the components listed " - "must also be selected. The dependency information is encoded " - "within the installer itself, so that users cannot install " - "inconsistent sets of components." - "\n" - "GROUP names the component group of which this component is a " - "part. If not provided, the component will be a standalone " - "component, not part of any component group. Component groups are " - "described with the cpack_add_component_group command, detailed" - "below." - "\n" - "INSTALL_TYPES lists the installation types of which this component " - "is a part. When one of these installations types is selected, this " - "component will automatically be selected. Installation types are" - "described with the cpack_add_install_type command, detailed below." - "\n" - "DOWNLOADED indicates that this component should be downloaded " - "on-the-fly by the installer, rather than packaged in with the " - "installer itself. For more information, see the " - "cpack_configure_downloads command." - "\n" - "ARCHIVE_FILE provides a name for the archive file created by CPack " - "to be used for downloaded components. If not supplied, CPack will " - "create a file with some name based on CPACK_PACKAGE_FILE_NAME and " - "the name of the component. See cpack_configure_downloads for more " - "information." -); - + // Commented-out example of use + // + // cmDocumentationEntry e("cpack_", + // "Brief Description" + // "which may be on several lines.", + // "Long description in pre-formatted format" + // " blah\n" + // " blah\n" + //); //v.push_back(e); } diff --git a/Source/CPack/cmCPackDocumentVariables.cxx b/Source/CPack/cmCPackDocumentVariables.cxx index ab806d2..8b60d5f 100644 --- a/Source/CPack/cmCPackDocumentVariables.cxx +++ b/Source/CPack/cmCPackDocumentVariables.cxx @@ -6,19 +6,19 @@ void cmCPackDocumentVariables::DefineVariables(cmake* cm) // Subsection: variables defined/used by cpack, // which are common to all CPack generators - cm->DefineProperty - ("CPACK_PACKAGE_VENDOR", cmProperty::VARIABLE, - "The name of the package vendor.", - "If not specified, defaults to \"Humanity\"." - "", false, - "Variables common to all CPack generators"); +// cm->DefineProperty +// ("CPACK_PACKAGE_VENDOR", cmProperty::VARIABLE, +// "The name of the package vendor.", +// "If not specified, defaults to \"Humanity\"." +// "", false, +// "Variables common to all CPack generators"); // Subsection: variables defined/used by cpack, // which are specific to one CPack generator - cm->DefineProperty - ("CPACK_RPM_PACKAGE_NAME", cmProperty::VARIABLE, - "RPM specific package name.", - "If not specified, defaults to CPACK_PACKAGE_NAME." - "", false, - "Variables specific to a CPack generator"); +// cm->DefineProperty +// ("CPACK_RPM_PACKAGE_NAME", cmProperty::VARIABLE, +// "RPM specific package name.", +// "If not specified, defaults to CPACK_PACKAGE_NAME." +// "", false, +// "Variables specific to a CPack generator"); } diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 8e59fa0..4117971 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -303,29 +303,30 @@ int main (int argc, char *argv[]) help = false; } - if ( parsed && !help ) + // find out which system cpack is running on, so it can setup the search + // paths, so FIND_XXX() commands can be used in scripts + // This part is used for cpack documentation lookup as well. + cminst.AddCMakePaths(); + std::string systemFile = + globalMF->GetModulesFile("CMakeDetermineSystem.cmake"); + if (!globalMF->ReadListFile(0, systemFile.c_str())) { - // find out which system cpack is running on, so it can setup the search - // paths, so FIND_XXX() commands can be used in scripts - cminst.AddCMakePaths(); - std::string systemFile = - globalMF->GetModulesFile("CMakeDetermineSystem.cmake"); - if (!globalMF->ReadListFile(0, systemFile.c_str())) - { - cmCPack_Log(&log, cmCPackLog::LOG_ERROR, - "Error reading CMakeDetermineSystem.cmake" << std::endl); - return 1; - } + cmCPack_Log(&log, cmCPackLog::LOG_ERROR, + "Error reading CMakeDetermineSystem.cmake" << std::endl); + return 1; + } - systemFile = - globalMF->GetModulesFile("CMakeSystemSpecificInformation.cmake"); - if (!globalMF->ReadListFile(0, systemFile.c_str())) - { - cmCPack_Log(&log, cmCPackLog::LOG_ERROR, - "Error reading CMakeSystemSpecificInformation.cmake" << std::endl); - return 1; - } + systemFile = + globalMF->GetModulesFile("CMakeSystemSpecificInformation.cmake"); + if (!globalMF->ReadListFile(0, systemFile.c_str())) + { + cmCPack_Log(&log, cmCPackLog::LOG_ERROR, + "Error reading CMakeSystemSpecificInformation.cmake" << std::endl); + return 1; + } + if ( parsed && !help ) + { if ( cmSystemTools::FileExists(cpackConfigFile.c_str()) ) { cpackConfigFile = @@ -519,43 +520,47 @@ int main (int argc, char *argv[]) doc.SetSection("Description",cmDocumentationDescription); doc.PrependSection("Options",cmDocumentationOptions); + // statically (in C++ code) defined variables cmCPackDocumentVariables::DefineVariables(&cminst); std::vector commands; - cminst.AddCMakePaths(); - std::string systemFile = - globalMF->GetModulesFile("CMakeDetermineSystem.cmake"); - if (!globalMF->ReadListFile(0, systemFile.c_str())) - { - cmCPack_Log(&log, cmCPackLog::LOG_ERROR, - "Error reading CMakeDetermineSystem.cmake" << std::endl); - return 1; - } - - systemFile = - globalMF->GetModulesFile("CMakeSystemSpecificInformation.cmake"); - if (!globalMF->ReadListFile(0, systemFile.c_str())) - { - cmCPack_Log(&log, cmCPackLog::LOG_ERROR, - "Error reading CMakeSystemSpecificInformation.cmake" - << std::endl); - return 1; - } - std::string cpFile = globalMF->GetModulesFile("CPack.cmake"); - doc.getStructuredDocFromFile(cpFile.c_str(), - commands,&cminst,"Variables common to all CPack generators"); - cpFile = globalMF->GetModulesFile("CPackComponent.cmake"); - doc.getStructuredDocFromFile(cpFile.c_str(), - commands,&cminst,"Variables common to all CPack generators"); - cpFile = globalMF->GetModulesFile("CPackRPM.cmake"); - doc.getStructuredDocFromFile(cpFile.c_str(), - commands,&cminst,"Variables specific to a CPack generator"); + typedef std::pair docModuleSectionPair_t; + typedef std::list docedModulesList_t; + docedModulesList_t docedModList; + docModuleSectionPair_t docPair; + std::string docedFile; + + // build the list of files to be parsed for documentation + // extraction + docPair.first = "CPack.cmake"; + docPair.second = "Variables common to all CPack generators"; + docedModList.push_back(docPair); + docPair.first = "CPackComponent.cmake"; + docedModList.push_back(docPair); + docPair.first = "CPackRPM.cmake"; + docPair.second = "Variables specific to a CPack generator"; + docedModList.push_back(docPair); + docPair.first = "CPackDeb.cmake"; + docedModList.push_back(docPair); + + // parse the files for documentation. + for (docedModulesList_t::iterator it = docedModList.begin(); + it!= docedModList.end(); ++it) + { + docedFile = globalMF->GetModulesFile((it->first).c_str()); + if (docedFile.length()!=0) + { + doc.GetStructuredDocFromFile(docedFile.c_str(), + commands,&cminst,(it->second).c_str()); + } + } std::map propDocs; cminst.GetPropertiesDocumentation(propDocs); doc.SetSections(propDocs); - cminst.GetCommandDocumentation(commands); + cminst.GetCommandDocumentation(commands,true,false); + // statically (in C++ code) defined macros/commands cmCPackDocumentMacros::GetMacrosDocumentation(commands); doc.SetSection("Commands",commands); diff --git a/Source/cmCommand.h b/Source/cmCommand.h index 7817eb3..e046096 100644 --- a/Source/cmCommand.h +++ b/Source/cmCommand.h @@ -111,6 +111,17 @@ public: } /** + * This is used to avoid including this command + * in documentation. This is mainly used by + * cmMacroHelperCommand and cmFunctionHelperCommand + * which cannot provide appropriate documentation. + */ + virtual bool ShouldAppearInDocumentation() + { + return true; + } + + /** * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() = 0; diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index b7b8e37..f032592 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -757,15 +757,14 @@ static void trim(std::string& s) else s.erase(s.begin(), s.end()); } -int cmDocumentation::getStructuredDocFromFile( +int cmDocumentation::GetStructuredDocFromFile( const char* fname, std::vector& commands, cmake* cm, const char *docSection) { typedef enum sdoce { - SDOC_NONE, SDOC_MACRO, - SDOC_PARAM, SDOC_VARIABLE, + SDOC_NONE, SDOC_MODULE, SDOC_MACRO, SDOC_FUNCTION, SDOC_VARIABLE, SDOC_UNKNOWN} sdoc_t; int nbDocItemFound = 0; int docCtxIdx = 0; @@ -775,15 +774,16 @@ int cmDocumentation::getStructuredDocFromFile( std::ifstream fin(fname); if(!fin) { - //std::cerr << "Internal error: can not open script file: <" << fname <<">."<< std::endl; return nbDocItemFound; } std::string name; std::string full; std::string brief; std::string line; - bool newCtx = false; - bool inBrief = false; + bool newCtx = false; /* we've just entered ## context */ + bool inBrief = false; /* we are currently parsing brief desc. */ + bool inFullFirstParagraph = false; /* we are currently parsing full + desc. first paragraph */ brief = ""; full = ""; bool newParagraph = true; @@ -806,11 +806,24 @@ int cmDocumentation::getStructuredDocFromFile( docContextStack[docCtxIdx]=SDOC_VARIABLE; newCtx = true; } + else if (mkword=="function") + { + docCtxIdx++; + docContextStack[docCtxIdx]=SDOC_FUNCTION; + newCtx = true; + } + else if (mkword=="module") + { + docCtxIdx++; + docContextStack[docCtxIdx]=SDOC_MODULE; + newCtx = true; + } else if (mkword.substr(0,3)=="end") { - ; switch (docContextStack[docCtxIdx]) { case SDOC_MACRO: + /* for now MACRO and FUNCTION are handled in the same way */ + case SDOC_FUNCTION: commands.push_back(cmDocumentationEntry(name.c_str(), brief.c_str(),full.c_str())); break; @@ -821,15 +834,20 @@ int cmDocumentation::getStructuredDocFromFile( full.c_str(),false, docSection); break; + case SDOC_MODULE: + /* not implemented */ + break; + default: + /* ignore other cases */ + break; } docCtxIdx--; newCtx = false; + ++nbDocItemFound; } else { // error out unhandled context - std::cerr << "Internal error: unknown markup context <" - << mkword <<"> found in:" << fname << std::endl; return nbDocItemFound; } /* context is set go to next doc line */ @@ -843,47 +861,106 @@ int cmDocumentation::getStructuredDocFromFile( // followed by a blank line) if (newCtx) { - name = line.substr(1,line.find("-")-1); - trim(name); - brief = ""; - line = line.substr(line.find("- ")+1,std::string::npos); - inBrief = true; - full = ""; + // no brief (for easy variable definition) + if (line.find("-")==std::string::npos) + { + name = line.substr(1,std::string::npos); + trim(name); + brief = ""; + inBrief = false; + full = ""; + } + // here we have a name and brief beginning + else + { + name = line.substr(1,line.find("-")-1); + trim(name); + // we are parsing the brief context + brief = line.substr(line.find("-")+1,std::string::npos); + trim(brief); + // Brief may already be terminated on the first line + if (brief.find('.')!=std::string::npos) + { + inBrief = false; + full = brief.substr(brief.find('.')+1,std::string::npos); + trim(full); + inFullFirstParagraph = true; + brief = brief.substr(0,brief.find('.')); + } + // brief is continued on following lines + else + { + inBrief = true; + full = ""; + } + } + newCtx = false; + continue; } // blank line if(line.size() <= 2) { - inBrief = false; - full += "\n"; + if (inBrief) { + inBrief = false; + full = ""; + } else { + full += "\n"; + // the first paragraph of full has ended + inFullFirstParagraph = false; + } newParagraph = true; } - // brief terminated by . - else if (inBrief && line[line.length()-1]=='.') + // brief is terminated by '.' + else if (inBrief && (line.find('.')!=std::string::npos)) { + /* the brief just ended */ inBrief = false; - brief += line.c_str()+1; + std::string endBrief = line.substr(1,line.find('.')); + trim(endBrief); + trim(brief); + brief += " " + endBrief; + full += line.substr(line.find('.')+1,std::string::npos); + trim(full); + inFullFirstParagraph = true; } // we handle full text or multi-line brief. else { std::string* text; - if (inBrief) { - text = &brief; - } else { - text = &full; - } + if (inBrief) + { + text = &brief; + } + else + { + text = &full; + } // two spaces if(line[1] == ' ' && line[2] == ' ') { - if(!newParagraph) + // there is no "full first paragraph at all." + if (line[3] == ' ') { + inFullFirstParagraph = false; + } - *text += "\n"; - newParagraph = true; + if(!newParagraph && !inFullFirstParagraph) + { + *text += "\n"; + newParagraph = true; } - // Skip #, and leave space for preformatted - *text += line.c_str()+1; - *text += "\n"; + // Skip #, and leave space for pre-formatted + if (inFullFirstParagraph) + { + std::string temp = line.c_str()+1; + trim(temp); + *text += " " + temp; + } + else + { + *text += line.c_str()+1; + *text += "\n"; + } } else if(line[1] == ' ') { @@ -910,7 +987,6 @@ int cmDocumentation::getStructuredDocFromFile( /* next line is not the first context line */ newCtx = false; } - return nbDocItemFound; } diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index 2f6e09e..fae409f 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -133,23 +133,26 @@ public: void addCPackStandardDocSections(); /** - * Get the documentation of macros and variable documented + * Get the documentation of macros, functions and variable documented * with CMake structured documentation in a CMake script. + * (in fact it may be in any file which follow the structured doc format) * Structured documentation begin with * ## (double sharp) in column 1 & 2 immediately followed * by a markup. Those ## are ignored by the legacy module * documentation parser @see CreateSingleModule. - * Current markup are ##macro, ##param, ##variable and ##end - * which is closing either of the previous ones. + * Current markup are ##macro, ##function, ##variable and ##end. + * ##end is closing either of the previous ones. * @param[in] fname the script file name to be parsed for documentation * @param[in,out] commands the vector of command/macros documentation * entry found in the script file. * @param[in,out] the cmake object instance to which variable documentation * will be attached (using @see cmake::DefineProperty) + * @param[in] the documentation section in which the property will be + * inserted. * @return the number of documented items (command and variable) * found in the file. */ - int getStructuredDocFromFile(const char* fname, + int GetStructuredDocFromFile(const char* fname, std::vector& commands, cmake* cm, const char *docSection); diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index ec4fd16..7a80a1c 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -23,6 +23,17 @@ public: ~cmFunctionHelperCommand() {}; /** + * This is used to avoid including this command + * in documentation. This is mainly used by + * cmMacroHelperCommand and cmFunctionHelperCommand + * which cannot provide appropriate documentation. + */ + virtual bool ShouldAppearInDocumentation() + { + return false; + } + + /** * This is a virtual constructor for the command. */ virtual cmCommand* Clone() diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 774f32b..f81a63d 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -23,6 +23,17 @@ public: ~cmMacroHelperCommand() {}; /** + * This is used to avoid including this command + * in documentation. This is mainly used by + * cmMacroHelperCommand and cmFunctionHelperCommand + * which cannot provide appropriate documentation. + */ + virtual bool ShouldAppearInDocumentation() + { + return false; + } + + /** * This is a virtual constructor for the command. */ virtual cmCommand* Clone() diff --git a/Source/cmake.cxx b/Source/cmake.cxx index d691f46..f8e1216 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2677,7 +2677,9 @@ void cmake::GetCommandDocumentation(std::vector& v, j != this->Commands.end(); ++j) { if ((( withCompatCommands == false) && ( (*j).second->IsDiscouraged())) - || ((withCurrentCommands == false) && (!(*j).second->IsDiscouraged()))) + || ((withCurrentCommands == false) && (!(*j).second->IsDiscouraged())) + || (!((*j).second->ShouldAppearInDocumentation())) + ) { continue; } -- cgit v0.12 From 751713f54b70d955334818f534139f9b59cc66e6 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sun, 22 Jan 2012 13:37:39 +0100 Subject: Update bash completion file in order to handle new CPack doc options. --- Docs/cmake-completion | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Docs/cmake-completion b/Docs/cmake-completion index d82d608..d70ac24 100644 --- a/Docs/cmake-completion +++ b/Docs/cmake-completion @@ -130,6 +130,16 @@ _cpack() COMPREPLY=( $(compgen -f ${cur}) ) return 0 ;; + --help-variable) + local running=$(for x in `cpack --help-variable-list | grep -v "cpack version" `; do echo ${x} ; done ) + COMPREPLY=( $(compgen -W "${running}" -- ${cur}) ) + return 0 + ;; + --help-command) + local running=$(for x in `cpack --help-command-list | grep -v "cpack version" `; do echo ${x} ; done ) + COMPREPLY=( $(compgen -W "${running}" -- ${cur}) ) + return 0 + ;; *) ;; esac -- cgit v0.12 From 62b589b4cd73fa59b5902f8f0a5779a6a77947aa Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Tue, 24 Jan 2012 23:38:22 +0100 Subject: Suppress unused var, beautify code, avoid 1 extra newline. There remains extra newlines in text Formatter output but the parser does not seem to be the culprit. The formatter should be. --- Source/cmDocumentation.cxx | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index f032592..8aa4721 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -724,7 +724,6 @@ void cmDocumentation::addCMakeStandardDocSections() //---------------------------------------------------------------------------- void cmDocumentation::addCTestStandardDocSections() { - cmDocumentationSection *sec; // This is currently done for backward compatibility reason // We may suppress some of these. addCMakeStandardDocSections(); @@ -749,12 +748,16 @@ void cmDocumentation::addCPackStandardDocSections() static void trim(std::string& s) { std::string::size_type pos = s.find_last_not_of(' '); - if(pos != std::string::npos) { + if(pos != std::string::npos) + { s.erase(pos + 1); pos = s.find_first_not_of(' '); if(pos != std::string::npos) s.erase(0, pos); - } - else s.erase(s.begin(), s.end()); + } + else + { + s.erase(s.begin(), s.end()); + } } int cmDocumentation::GetStructuredDocFromFile( @@ -792,7 +795,8 @@ int cmDocumentation::GetStructuredDocFromFile( if(line.size() && line[0] == '#') { /* handle structured doc context */ - if (line[1]=='#') { + if (line[1]=='#') + { std::string mkword = line.substr(2,std::string::npos); if (mkword=="macro") { @@ -904,7 +908,10 @@ int cmDocumentation::GetStructuredDocFromFile( inBrief = false; full = ""; } else { - full += "\n"; + if (full.length()>0) + { + full += "\n"; + } // the first paragraph of full has ended inFullFirstParagraph = false; } @@ -949,18 +956,18 @@ int cmDocumentation::GetStructuredDocFromFile( *text += "\n"; newParagraph = true; } - // Skip #, and leave space for pre-formatted - if (inFullFirstParagraph) - { - std::string temp = line.c_str()+1; - trim(temp); - *text += " " + temp; - } - else - { - *text += line.c_str()+1; - *text += "\n"; - } + // Skip #, and leave space for pre-formatted + if (inFullFirstParagraph) + { + std::string temp = line.c_str()+1; + trim(temp); + *text += " " + temp; + } + else + { + *text += line.c_str()+1; + *text += "\n"; + } } else if(line[1] == ' ') { -- cgit v0.12 From 9d72b25a861bdcc69bf08e7494884027c341f7c9 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Thu, 26 Jan 2012 22:10:31 +0100 Subject: CMakeOnly.AllFindModules: clean up the Qt3/Qt4 code --- Tests/CMakeOnly/AllFindModules/CMakeLists.txt | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index 8a38f06..d28ac01 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -15,25 +15,25 @@ macro(do_find MODULE_NAME) find_package(${MODULE_NAME}) endmacro(do_find) +# It is only possible to use either Qt3 or Qt4 in one project. +# Since FindQt will complain if both are found we explicitely +# filter out this and FindQt3. FindKDE3 also depends on Qt3 and +# is therefore also blocked +set(NO_QT4_MODULES "Qt" "Qt3" "KDE3") + foreach(FIND_MODULE ${FIND_MODULES}) string(REGEX REPLACE ".*/Find(.*)\\.cmake$" "\\1" MODULE_NAME "${FIND_MODULE}") - # It is only possible to use either Qt3 or Qt4 in one project. - # Since FindQt will complain if both are found we explicitely - # filter out this and FindQt3. FindKDE3 also depends on Qt3 and - # is therefore also blocked - - if (NOT MODULE_NAME STREQUAL "Qt" AND - NOT MODULE_NAME STREQUAL "Qt3" AND - NOT MODULE_NAME STREQUAL "KDE3") + list(FIND NO_QT4_MODULES ${MODULE_NAME} NO_QT4_INDEX) + if (NO_QT4_INDEX EQUAL -1) do_find(${MODULE_NAME}) endif () endforeach(FIND_MODULE) # Qt4 is not present, so we can check Qt3 -if(NOT QT4_FOUND) - foreach(FIND_MODULE "Qt3" "Qt" "KDE3") +if (NOT QT4_FOUND) + foreach(FIND_MODULE ${NO_QT4_MODULES}) do_find(${FIND_MODULE}) endforeach(FIND_MODULE) -endif(NOT QT4_FOUND) +endif (NOT QT4_FOUND) -- cgit v0.12 From 3c4b4fffd0a6739e8771e4d552d98d21d294a84b Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Thu, 26 Jan 2012 22:17:10 +0100 Subject: CMakeOnly.AllFindModules: always check FindQt --- Tests/CMakeOnly/AllFindModules/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index d28ac01..0c22e00 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -19,8 +19,9 @@ endmacro(do_find) # Since FindQt will complain if both are found we explicitely # filter out this and FindQt3. FindKDE3 also depends on Qt3 and # is therefore also blocked -set(NO_QT4_MODULES "Qt" "Qt3" "KDE3") +set(NO_QT4_MODULES "Qt3" "KDE3") +set(DESIRED_QT_VERSION 4) foreach(FIND_MODULE ${FIND_MODULES}) string(REGEX REPLACE ".*/Find(.*)\\.cmake$" "\\1" MODULE_NAME "${FIND_MODULE}") @@ -33,7 +34,8 @@ endforeach(FIND_MODULE) # Qt4 is not present, so we can check Qt3 if (NOT QT4_FOUND) - foreach(FIND_MODULE ${NO_QT4_MODULES}) + set(DESIRED_QT_VERSION 3) + foreach(FIND_MODULE ${NO_QT4_MODULES} "Qt") do_find(${FIND_MODULE}) endforeach(FIND_MODULE) endif (NOT QT4_FOUND) -- cgit v0.12 From 2dee9294969ff5ef85a4dacb13de70b8a9de03db Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Thu, 26 Jan 2012 22:26:00 +0100 Subject: CMakeOnly.AllFindModules: suppress two modules from testing FindPackageHandleStandardArgs and FindPackageMessage match the glob expression but are nothing that will usually be fed into find_package(). --- Tests/CMakeOnly/AllFindModules/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index 0c22e00..308177d 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -21,12 +21,17 @@ endmacro(do_find) # is therefore also blocked set(NO_QT4_MODULES "Qt3" "KDE3") +# These modules are named Find*.cmake, but are nothing that works in +# find_package(). +set(NO_FIND_MODULES "PackageHandleStandardArgs" "PackageMessage") + set(DESIRED_QT_VERSION 4) foreach(FIND_MODULE ${FIND_MODULES}) string(REGEX REPLACE ".*/Find(.*)\\.cmake$" "\\1" MODULE_NAME "${FIND_MODULE}") list(FIND NO_QT4_MODULES ${MODULE_NAME} NO_QT4_INDEX) - if (NO_QT4_INDEX EQUAL -1) + list(FIND NO_FIND_MODULES ${MODULE_NAME} NO_FIND_INDEX) + if (NO_QT4_INDEX EQUAL -1 AND NO_FIND_INDEX EQUAL -1) do_find(${MODULE_NAME}) endif () -- cgit v0.12 From 7c82b7f51a7c7a02d060ca804e15049c0a745748 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Tue, 31 Jan 2012 21:26:44 +0100 Subject: Fix potential bad memory access, thanks to Eike --- Source/cmDocumentation.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 8aa4721..80f74a6 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -512,7 +512,7 @@ bool cmDocumentation::CreateSingleModule(const char* fname, if(line.size() && line[0] == '#') { /* line beginnings with ## are mark-up ignore them */ - if (line[1] == '#') continue; + if (line.size()>=2 && line[1] == '#') continue; // blank line if(line.size() <= 2) { -- cgit v0.12 From 37f90ed57609308ff33223474567e5bfb94c2a21 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Tue, 31 Jan 2012 21:27:55 +0100 Subject: Calm down compiler warning about unused var --- Source/CPack/cmCPackDocumentMacros.cxx | 2 ++ Source/CPack/cmCPackDocumentVariables.cxx | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Source/CPack/cmCPackDocumentMacros.cxx b/Source/CPack/cmCPackDocumentMacros.cxx index 8752e56..94d5391 100644 --- a/Source/CPack/cmCPackDocumentMacros.cxx +++ b/Source/CPack/cmCPackDocumentMacros.cxx @@ -3,6 +3,8 @@ void cmCPackDocumentMacros::GetMacrosDocumentation( std::vector& v) { + // avoid compiler warning + (int)v.size(); // Commented-out example of use // // cmDocumentationEntry e("cpack_", diff --git a/Source/CPack/cmCPackDocumentVariables.cxx b/Source/CPack/cmCPackDocumentVariables.cxx index 8b60d5f..27d4df2 100644 --- a/Source/CPack/cmCPackDocumentVariables.cxx +++ b/Source/CPack/cmCPackDocumentVariables.cxx @@ -3,6 +3,8 @@ void cmCPackDocumentVariables::DefineVariables(cmake* cm) { + // avoid compiler warning + (void*)cm; // Subsection: variables defined/used by cpack, // which are common to all CPack generators -- cgit v0.12 From c4a0bcea775981dea86d527f66161c98f5e05e95 Mon Sep 17 00:00:00 2001 From: Mattias Helsing Date: Wed, 1 Feb 2012 08:15:44 -0500 Subject: CPack: Fix NSIS handling of privileged users (#12923) When using the NSIS generator from CPack the file NSIS.template.in is used to generate a project.nsi file for NSIS to process. The file consists code in the NSIS scripting language. Among other functions there is an onInit function the initializes the installer. The function (tries to) recognise admin and power users but fails since NSIS scripting language relative includes the jump from the current command so +3 means "run the third command after this one", so a failed check for admin completely skips the check for a power user and goes directly to "done:". User permission lookup was added in initial NSIS support by commit a11b9a4c (Merge from CPack branch, 2006-01-01). Later commit b1b052fd (Several changes to for NSIS, 2006-03-01) added a line inside a block that should be skipped by a jump without updating the jump length. Update the jump length to correct the behavior. --- Modules/NSIS.template.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in index 6259a5b..819cc5c 100644 --- a/Modules/NSIS.template.in +++ b/Modules/NSIS.template.in @@ -922,12 +922,12 @@ Function .onInit Pop $0 UserInfo::GetAccountType Pop $1 - StrCmp $1 "Admin" 0 +3 + StrCmp $1 "Admin" 0 +4 SetShellVarContext all ;MessageBox MB_OK 'User "$0" is in the Admin group' StrCpy $SV_ALLUSERS "AllUsers" Goto done - StrCmp $1 "Power" 0 +3 + StrCmp $1 "Power" 0 +4 SetShellVarContext all ;MessageBox MB_OK 'User "$0" is in the Power Users group' StrCpy $SV_ALLUSERS "AllUsers" -- cgit v0.12 From de289462efc070d831bf5e49d63fb47e1de57769 Mon Sep 17 00:00:00 2001 From: Peter Kuemmel Date: Sat, 28 Jan 2012 13:59:19 +0100 Subject: Find VC Express during default generator selection (#12917) CMake doesn't find Visual C++ Express and uses "NMake Makefiles" generator by default when one calls cmake WITHOUT using the -G options. Teach CMake to find VC Express to use it as the default generator just like the commercial versions. --- Source/cmake.cxx | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index d691f46..c0c73d6 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2204,8 +2204,11 @@ int cmake::ActualConfigure() std::string installedCompiler; // Try to find the newest VS installed on the computer and // use that as a default if -G is not specified - std::string vsregBase = - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\"; + const std::string vsregBase = + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"; + std::vector vsVerions; + vsVerions.push_back("VisualStudio\\"); + vsVerions.push_back("VCExpress\\"); struct VSRegistryEntryName { const char* MSVersion; @@ -2219,14 +2222,18 @@ int cmake::ActualConfigure() {"9.0", "Visual Studio 9 2008"}, {"10.0", "Visual Studio 10"}, {0, 0}}; - for(int i =0; version[i].MSVersion != 0; i++) + for(size_t b=0; b < vsVerions.size() && installedCompiler.empty(); b++) { - std::string reg = vsregBase + version[i].MSVersion; - reg += ";InstallDir]"; - cmSystemTools::ExpandRegistryValues(reg); - if (!(reg == "/registry")) + for(int i =0; version[i].MSVersion != 0; i++) { - installedCompiler = version[i].GeneratorName; + std::string reg = vsregBase + vsVerions[b] + version[i].MSVersion; + reg += ";InstallDir]"; + cmSystemTools::ExpandRegistryValues(reg, + cmSystemTools::KeyWOW64_32); + if (!(reg == "/registry")) + { + installedCompiler = version[i].GeneratorName; + } } } cmGlobalGenerator* gen -- cgit v0.12 From ed1b12624dfe7f4b6afeb557aabb091904918bc7 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Mon, 30 Jan 2012 19:25:07 +0100 Subject: CMakeOnly.AllFindModules: require version for some modules --- Tests/CMakeOnly/AllFindModules/CMakeLists.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index 308177d..127e9d7 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -44,3 +44,25 @@ if (NOT QT4_FOUND) do_find(${FIND_MODULE}) endforeach(FIND_MODULE) endif (NOT QT4_FOUND) + +# If any of these modules reported that it was found a version number should have been +# reported. +set(VERSIONS_REQUIRED + ALSA BISON BZIP2 CUPS CURL DOXYGEN EXPAT FLEX GETTEXT GIF GIT GNUPLOT + ImageMagick JASPER LibArchive LIBXML2 PERL PostgreSQL SWIG TIFF ZLIB) + +foreach(VTEST ${VERSIONS_REQUIRED}) + if (${VTEST}_FOUND) + if (DEFINED ${VTEST}_VERSION_STRING) + if (NOT ${VTEST}_VERSION_STRING MATCHES "^[0-9][0-9\\.]*[A-Za-z_]*[0-9\\.]*$") + message(SEND_ERROR "${VTEST}_VERSION_STRING has unexpected content ${${VTEST}_VERSION_STRING}") + endif() + elseif (DEFINED ${VTEST}_VERSION) + if (NOT ${VTEST}_VERSION MATCHES "^[0-9][0-9\\.]*[A-Za-z_]*[0-9\\.]*$") + message(SEND_ERROR "${VTEST}_VERSION has unexpected content ${${VTEST}_VERSION}") + endif() + else() + message(SEND_ERROR "${VTEST}_FOUND is set but no version number is defined") + endif() + endif(${VTEST}_FOUND) +endforeach(VTEST) -- cgit v0.12 From 44d007b6593eeea2c2c47a4431603ed08bc22280 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 1 Feb 2012 18:14:52 +0100 Subject: CheckIncludeFiles: fix status output CHECK_INCLUDE_FILES("foo.h" HAVE_FOO_H) gave an output like: Looking for include files HAVE_FOO_H After this change it does now what CHECK_INCLUDE_FILE() also does: Looking for include files foo.h --- Modules/CheckIncludeFiles.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake index 75b5ca1..642d962 100644 --- a/Modules/CheckIncludeFiles.cmake +++ b/Modules/CheckIncludeFiles.cmake @@ -44,7 +44,7 @@ MACRO(CHECK_INCLUDE_FILES INCLUDE VARIABLE) CONFIGURE_FILE("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in" "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c" @ONLY IMMEDIATE) - MESSAGE(STATUS "Looking for include files ${VARIABLE}") + MESSAGE(STATUS "Looking for include files ${INCLUDE}") TRY_COMPILE(${VARIABLE} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c @@ -54,15 +54,15 @@ MACRO(CHECK_INCLUDE_FILES INCLUDE VARIABLE) "${CHECK_INCLUDE_FILES_INCLUDE_DIRS}" OUTPUT_VARIABLE OUTPUT) IF(${VARIABLE}) - MESSAGE(STATUS "Looking for include files ${VARIABLE} - found") - SET(${VARIABLE} 1 CACHE INTERNAL "Have include ${VARIABLE}") + MESSAGE(STATUS "Looking for include files ${INCLUDE} - found") + SET(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}") FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if files ${INCLUDE} " "exist passed with the following output:\n" "${OUTPUT}\n\n") ELSE(${VARIABLE}) - MESSAGE(STATUS "Looking for include files ${VARIABLE} - not found.") - SET(${VARIABLE} "" CACHE INTERNAL "Have includes ${VARIABLE}") + MESSAGE(STATUS "Looking for include files ${INCLUDE} - not found.") + SET(${VARIABLE} "" CACHE INTERNAL "Have includes ${INCLUDE}") FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if files ${INCLUDE} " "exist failed with the following output:\n" -- cgit v0.12 From 31826b5166f0921d34625d86e82dd73fb47652d5 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 18 Jan 2012 18:08:43 +0100 Subject: FindPerl{,Libs}: move version detection into FindPerl If the first attempt of getting the version doesn't succeed, try a second approach. --- Modules/FindPerl.cmake | 39 ++++++++++++++++++++++++++++++++++++--- Modules/FindPerlLibs.cmake | 36 ++++++++++++------------------------ 2 files changed, 48 insertions(+), 27 deletions(-) diff --git a/Modules/FindPerl.cmake b/Modules/FindPerl.cmake index db393e7..ae686df 100644 --- a/Modules/FindPerl.cmake +++ b/Modules/FindPerl.cmake @@ -1,8 +1,9 @@ # - Find perl # this module looks for Perl # -# PERL_EXECUTABLE - the full path to perl -# PERL_FOUND - If false, don't attempt to use perl. +# PERL_EXECUTABLE - the full path to perl +# PERL_FOUND - If false, don't attempt to use perl. +# PERL_VERSION_STRING - version of perl found (since CMake 2.8.8) #============================================================================= # Copyright 2001-2009 Kitware, Inc. @@ -39,12 +40,44 @@ FIND_PROGRAM(PERL_EXECUTABLE PATHS ${PERL_POSSIBLE_BIN_PATHS} ) +IF(PERL_EXECUTABLE) + ### PERL_VERSION + EXECUTE_PROCESS( + COMMAND + ${PERL_EXECUTABLE} -V:version + OUTPUT_VARIABLE + PERL_VERSION_OUTPUT_VARIABLE + RESULT_VARIABLE + PERL_VERSION_RESULT_VARIABLE + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + IF(NOT PERL_VERSION_RESULT_VARIABLE AND NOT PERL_VERSION_OUTPUT_VARIABLE MATCHES "^version='UNKNOWN'") + STRING(REGEX REPLACE "version='([^']+)'.*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE}) + ELSE() + EXECUTE_PROCESS( + COMMAND ${PERL_EXECUTABLE} -v + OUTPUT_VARIABLE PERL_VERSION_OUTPUT_VARIABLE + RESULT_VARIABLE PERL_VERSION_RESULT_VARIABLE + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + IF(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl.*[ \\(]v([0-9\\._]+)[ \\)]") + STRING(REGEX REPLACE ".*This is perl.*[ \\(]v([0-9\\._]+)[ \\)].*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE}) + ELSEIF(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl, version ([0-9\\._]+) +") + STRING(REGEX REPLACE ".*This is perl, version ([0-9\\._]+) +.*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE}) + ENDIF() + ENDIF() +ENDIF(PERL_EXECUTABLE) + # Deprecated settings for compatibility with CMake1.4 SET(PERL ${PERL_EXECUTABLE}) # handle the QUIETLY and REQUIRED arguments and set PERL_FOUND to TRUE if # all listed variables are TRUE INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Perl DEFAULT_MSG PERL_EXECUTABLE) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Perl + REQUIRED_VARS PERL_EXECUTABLE + VERSION_VAR PERL_VERSION_STRING) MARK_AS_ADVANCED(PERL_EXECUTABLE) diff --git a/Modules/FindPerlLibs.cmake b/Modules/FindPerlLibs.cmake index eea55f1..0ac8060 100644 --- a/Modules/FindPerlLibs.cmake +++ b/Modules/FindPerlLibs.cmake @@ -55,19 +55,6 @@ if (PERL_EXECUTABLE) string(REGEX REPLACE "prefix='([^']+)'.*" "\\1" PERL_PREFIX ${PERL_PREFIX_OUTPUT_VARIABLE}) endif (NOT PERL_PREFIX_RESULT_VARIABLE) - ### PERL_VERSION - execute_process( - COMMAND - ${PERL_EXECUTABLE} -V:version - OUTPUT_VARIABLE - PERL_VERSION_OUTPUT_VARIABLE - RESULT_VARIABLE - PERL_VERSION_RESULT_VARIABLE - ) - if (NOT PERL_VERSION_RESULT_VARIABLE) - string(REGEX REPLACE "version='([^']+)'.*" "\\1" PERL_VERSION ${PERL_VERSION_OUTPUT_VARIABLE}) - endif (NOT PERL_VERSION_RESULT_VARIABLE) - ### PERL_ARCHNAME execute_process( COMMAND @@ -206,19 +193,19 @@ if (PERL_EXECUTABLE) ### PERL_POSSIBLE_INCLUDE_PATHS set(PERL_POSSIBLE_INCLUDE_PATHS ${PERL_ARCHLIB}/CORE - /usr/lib/perl5/${PERL_VERSION}/${PERL_ARCHNAME}/CORE - /usr/lib/perl/${PERL_VERSION}/${PERL_ARCHNAME}/CORE - /usr/lib/perl5/${PERL_VERSION}/CORE - /usr/lib/perl/${PERL_VERSION}/CORE + /usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE + /usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE + /usr/lib/perl5/${PERL_VERSION_STRING}/CORE + /usr/lib/perl/${PERL_VERSION_STRING}/CORE ) ### PERL_POSSIBLE_LIB_PATHS set(PERL_POSSIBLE_LIB_PATHS ${PERL_ARCHLIB}/CORE - /usr/lib/perl5/${PERL_VERSION}/${PERL_ARCHNAME}/CORE - /usr/lib/perl/${PERL_VERSION}/${PERL_ARCHNAME}/CORE - /usr/lib/perl5/${PERL_VERSION}/CORE - /usr/lib/perl/${PERL_VERSION}/CORE + /usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE + /usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE + /usr/lib/perl5/${PERL_VERSION_STRING}/CORE + /usr/lib/perl/${PERL_VERSION_STRING}/CORE ) ### PERL_POSSIBLE_LIBRARY_NAME @@ -249,7 +236,7 @@ if (PERL_EXECUTABLE) find_library(PERL_LIBRARY NAMES ${PERL_POSSIBLE_LIBRARY_NAME} - perl${PERL_VERSION} + perl${PERL_VERSION_STRING} perl PATHS ${PERL_POSSIBLE_LIB_PATHS} @@ -261,15 +248,16 @@ endif (PERL_EXECUTABLE) # all listed variables are TRUE include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) find_package_handle_standard_args(PerlLibs REQUIRED_VARS PERL_LIBRARY PERL_INCLUDE_PATH - VERSION_VAR PERL_VERSION) + VERSION_VAR PERL_VERSION_STRING) # Introduced after CMake 2.6.4 to bring module into compliance set(PERL_INCLUDE_DIR ${PERL_INCLUDE_PATH}) set(PERL_INCLUDE_DIRS ${PERL_INCLUDE_PATH}) set(PERL_LIBRARIES ${PERL_LIBRARY}) +# For backward compatibility with CMake before 2.8.7 +set(PERL_VERSION ${PERL_VERSION_STRING}) mark_as_advanced( PERL_INCLUDE_PATH - PERL_EXECUTABLE PERL_LIBRARY ) -- cgit v0.12 From 9e25b127010464e7dea0f0f1989e5234ee4be536 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 25 Jan 2012 17:42:00 +0100 Subject: FindLibArchive: support version selection --- Modules/FindLibArchive.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Modules/FindLibArchive.cmake b/Modules/FindLibArchive.cmake index cedcd24..be931c5 100644 --- a/Modules/FindLibArchive.cmake +++ b/Modules/FindLibArchive.cmake @@ -54,8 +54,9 @@ endif() # itself includes this FindLibArchive when built with an older CMake that does # not provide it. The older CMake also does not have CMAKE_CURRENT_LIST_DIR.) include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) -find_package_handle_standard_args(LibArchive DEFAULT_MSG - LibArchive_LIBRARY LibArchive_INCLUDE_DIR +find_package_handle_standard_args(LibArchive + REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR + VERSION_VAR LibArchive_VERSION ) set(LibArchive_FOUND ${LIBARCHIVE_FOUND}) unset(LIBARCHIVE_FOUND) -- cgit v0.12 From 5d18851b25af4f363d72371a5a6492741436eb37 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Wed, 1 Feb 2012 23:32:50 +0100 Subject: CPackArchive restore default behavior and provide new variable. CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY should be set by the user in order to get the toplevel directory included in the archive whenever a componentized archive is requested. This solves bug #12129 and keeps fully backward compatible behavior. --- Source/CPack/cmCPackArchiveGenerator.cxx | 2 +- Source/CPack/cmCPackGenerator.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 12d1796..0ff9050 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -58,7 +58,7 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(cmArchiveWrite& archive, // Change to local toplevel cmSystemTools::ChangeDirectory(localToplevel.c_str()); std::string filePrefix; - if (this->IsOn("CPACK_INCLUDE_TOPLEVEL_DIRECTORY")) + if (this->IsOn("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY")) { filePrefix = this->GetOption("CPACK_PACKAGE_FILE_NAME"); filePrefix += "/"; diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 01ed4df..f7d8a4d 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -691,7 +691,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( // one install directory for each component. tempInstallDirectory += GetComponentInstallDirNameSuffix(installComponent); - if (this->IsOn("CPACK_INCLUDE_TOPLEVEL_DIRECTORY")) + if (this->IsOn("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY")) { tempInstallDirectory += "/"; tempInstallDirectory += this->GetOption("CPACK_PACKAGE_FILE_NAME"); -- cgit v0.12 From 46a734cdbd4c2ffb5af64a3f0d8a5c48c47b8140 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Fri, 3 Feb 2012 00:05:06 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 664bf6f..f2998f6 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 02) +SET(KWSYS_DATE_STAMP_DAY 03) -- cgit v0.12 From 9e01aefd24cd23878bd88c2f3cae62b5e28802b0 Mon Sep 17 00:00:00 2001 From: Eugene Golushkov Date: Fri, 3 Feb 2012 09:07:12 -0500 Subject: VS: Add support for WinRT project properties (#12930) VS_WINRT_EXTENSIONS: Boolean property that correspond to "Enable Tailored Features" in Visual Studio 11 IDE. VS_WINRT_REFERENCES: Semicolon-delimited list of *.winmd references to add to the project, which creates a new . --- Source/cmTarget.cxx | 10 ++++++++ Source/cmVisualStudio10TargetGenerator.cxx | 38 +++++++++++++++++++++++++++++- Source/cmVisualStudio10TargetGenerator.h | 1 + 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 1a68cee..ae5596b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1065,6 +1065,16 @@ void cmTarget::DefineProperties(cmake *cm) "generated Visual Studio project. For example, \"System;" "System.Windows.Forms\"."); cm->DefineProperty + ("VS_WINRT_EXTENSIONS", cmProperty::TARGET, + "Visual Studio project C++/CX language extensions for Windows Runtime", + "Can be set to enable C++/CX language extensions."); + cm->DefineProperty + ("VS_WINRT_REFERENCES", cmProperty::TARGET, + "Visual Studio project Windows Runtime Metadata references", + "Adds one or more semicolon-delimited WinRT references to a " + "generated Visual Studio project. For example, \"Windows;" + "Windows.UI.Core\"."); + cm->DefineProperty ("VS_GLOBAL_", cmProperty::TARGET, "Visual Studio project-specific global variable.", "Tell the Visual Studio generator to set the global variable " diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 449adc1..9193223 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -255,6 +255,7 @@ void cmVisualStudio10TargetGenerator::Generate() this->WriteObjSources(); this->WriteCLSources(); this->WriteDotNetReferences(); + this->WriteWinRTReferences(); this->WriteProjectReferences(); this->WriteString( "Target->GetProperty("VS_WINRT_REFERENCES"); + if(vsWinRTReferences) + { + std::string references(vsWinRTReferences); + std::string::size_type position = 0; + + this->WriteString("\n", 1); + while(references.length() > 0) + { + if((position = references.find(";")) == std::string::npos) + { + position = references.length() + 1; + } + + this->WriteString("BuildFileStream) << + cmVS10EscapeXML(references.substr(0, position)) << "\">\n"; + this->WriteString("true\n", 3); + this->WriteString("\n", 2); + + references.erase(0, position + 1); + } + + this->WriteString("\n", 1); + } +} + // ConfigurationType Application, Utility StaticLibrary DynamicLibrary void cmVisualStudio10TargetGenerator::WriteProjectConfigurations() @@ -372,7 +403,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() this->WriteString(mfcLine.c_str(), 2); if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY && - this->ClOptions[*i]->UsingUnicode()) + this->ClOptions[*i]->UsingUnicode() || + this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) { this->WriteString("Unicode\n", 2); } @@ -387,6 +419,10 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() pts += "\n"; this->WriteString(pts.c_str(), 2); } + if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) + { + this->WriteString("true\n", 2); + } this->WriteString("\n", 1); } } diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 6702509..90035f2 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -48,6 +48,7 @@ private: void WriteProjectConfigurationValues(); void WriteCLSources(); void WriteDotNetReferences(); + void WriteWinRTReferences(); void WriteObjSources(); void WritePathAndIncrementalLinkOptions(); void WriteItemDefinitionGroups(); -- cgit v0.12 From bf2e385397d6feeafbc3d3df45bac47b325c6c7a Mon Sep 17 00:00:00 2001 From: David Cole Date: Fri, 3 Feb 2012 11:48:25 -0500 Subject: Tests: Update drop site value for the Trilinos contract test --- Tests/Contracts/Trilinos-10-6/Patch.cmake | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Tests/Contracts/Trilinos-10-6/Patch.cmake b/Tests/Contracts/Trilinos-10-6/Patch.cmake index a7aae27..76051eb 100644 --- a/Tests/Contracts/Trilinos-10-6/Patch.cmake +++ b/Tests/Contracts/Trilinos-10-6/Patch.cmake @@ -2,6 +2,7 @@ if(NOT DEFINED source_dir) message(FATAL_ERROR "variable 'source_dir' not defined") endif() + if(NOT EXISTS "${source_dir}/CMakeLists.txt") message(FATAL_ERROR "error: No CMakeLists.txt file to patch!") endif() @@ -18,3 +19,20 @@ MESSAGE(\"Trilinos_WARNINGS_AS_ERRORS_FLAGS='\${Trilinos_WARNINGS_AS_ERRORS_FLAG ") file(APPEND "${source_dir}/CMakeLists.txt" "${text}") + + +if(NOT EXISTS "${source_dir}/CTestConfig.cmake") + message(FATAL_ERROR "error: No CTestConfig.cmake file to patch!") +endif() + +set(text " + +# +# Use newer than 10.6.1 CTestConfig settings from the Trilinos project. +# Send the Trilinos dashboards to the new Trilinos CDash server instance. +# +SET(CTEST_NIGHTLY_START_TIME \"04:00:00 UTC\") # 10 PM MDT or 9 PM MST +SET(CTEST_DROP_SITE \"testing.sandia.gov\") +") + +file(APPEND "${source_dir}/CTestConfig.cmake" "${text}") -- cgit v0.12 From a03447b3dfb448b402a0451e4e436a135fee366e Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 3 Feb 2012 14:32:17 -0500 Subject: VS: Simplify ;-separated attribute value parsing An implementation ;-separated list parsing was added by commit a1f976ce (VS: Add support for three new project properties, 2011-11-23) and again by commit 9e01aefd (VS: Add support for WinRT project properties, 2012-02-03). Refactor both instances to use ExpandListArgument. --- Source/cmVisualStudio10TargetGenerator.cxx | 54 +++++++++++------------------- 1 file changed, 20 insertions(+), 34 deletions(-) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 9193223..9418761 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -269,63 +269,49 @@ void cmVisualStudio10TargetGenerator::Generate() void cmVisualStudio10TargetGenerator::WriteDotNetReferences() { - const char* vsDotNetReferences - = this->Target->GetProperty("VS_DOTNET_REFERENCES"); - if(vsDotNetReferences) + std::vector references; + if(const char* vsDotNetReferences = + this->Target->GetProperty("VS_DOTNET_REFERENCES")) + { + cmSystemTools::ExpandListArgument(vsDotNetReferences, references); + } + if(!references.empty()) { - std::string references(vsDotNetReferences); - std::string::size_type position = 0; - this->WriteString("\n", 1); - while(references.length() > 0) + for(std::vector::iterator ri = references.begin(); + ri != references.end(); ++ri) { - if((position = references.find(";")) == std::string::npos) - { - position = references.length() + 1; - } - this->WriteString("BuildFileStream) << - cmVS10EscapeXML(references.substr(0, position)) << "\">\n"; + (*this->BuildFileStream) << cmVS10EscapeXML(*ri) << "\">\n"; this->WriteString("true" "\n", 3); this->WriteString("true" "\n", 3); this->WriteString("\n", 2); - - references.erase(0, position + 1); } - this->WriteString("\n", 1); } } void cmVisualStudio10TargetGenerator::WriteWinRTReferences() { - const char* vsWinRTReferences - = this->Target->GetProperty("VS_WINRT_REFERENCES"); - if(vsWinRTReferences) + std::vector references; + if(const char* vsWinRTReferences = + this->Target->GetProperty("VS_WINRT_REFERENCES")) + { + cmSystemTools::ExpandListArgument(vsWinRTReferences, references); + } + if(!references.empty()) { - std::string references(vsWinRTReferences); - std::string::size_type position = 0; - this->WriteString("\n", 1); - while(references.length() > 0) + for(std::vector::iterator ri = references.begin(); + ri != references.end(); ++ri) { - if((position = references.find(";")) == std::string::npos) - { - position = references.length() + 1; - } - this->WriteString("BuildFileStream) << - cmVS10EscapeXML(references.substr(0, position)) << "\">\n"; + (*this->BuildFileStream) << cmVS10EscapeXML(*ri) << "\">\n"; this->WriteString("true\n", 3); this->WriteString("\n", 2); - - references.erase(0, position + 1); } - this->WriteString("\n", 1); } } -- cgit v0.12 From 749584509ee3155bb87e56a08ee538e4100a59d8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 3 Feb 2012 10:36:26 -0500 Subject: Fix CXX/Fortran MODULE flags when enabled before C (#12929) If CXX or Fortran is enabled before C then the values of CMAKE_SHARED_MODULE_C_FLAGS CMAKE_SHARED_MODULE_CREATE_C_FLAGS may not be available. On platforms where MODULE library (plugin) creation is the same as SHARED library creation initialize the MODULE creation flags from the SHARED creation flags of the matching language instead of assuming that C has been enabled first. Teach the COnly and CxxOnly tests to build MODULE libraries. The latter covers this specific case. --- Modules/CMakeCXXInformation.cmake | 14 ++++++++------ Modules/CMakeFortranInformation.cmake | 8 ++++++++ Tests/COnly/CMakeLists.txt | 2 ++ Tests/COnly/testCModule.c | 6 ++++++ Tests/CxxOnly/CMakeLists.txt | 2 ++ Tests/CxxOnly/testCxxModule.cxx | 6 ++++++ 6 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 Tests/COnly/testCModule.c create mode 100644 Tests/CxxOnly/testCxxModule.cxx diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index b97a69c..25abb8c 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -93,12 +93,6 @@ IF(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX) ENDIF() -# for most systems a module is the same as a shared library -# so unless the variable CMAKE_MODULE_EXISTS is set just -# copy the values from the LIBRARY variables -IF(NOT CMAKE_MODULE_EXISTS) - SET(CMAKE_SHARED_MODULE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}) -ENDIF(NOT CMAKE_MODULE_EXISTS) # Create a set of shared library variable specific to C++ # For 90% of the systems, these are the same flags as the C versions # so if these are not set just copy the flags from the c version @@ -158,6 +152,14 @@ IF(NOT CMAKE_INCLUDE_FLAG_SEP_CXX) SET(CMAKE_INCLUDE_FLAG_SEP_CXX ${CMAKE_INCLUDE_FLAG_SEP_C}) ENDIF(NOT CMAKE_INCLUDE_FLAG_SEP_CXX) +# for most systems a module is the same as a shared library +# so unless the variable CMAKE_MODULE_EXISTS is set just +# copy the values from the LIBRARY variables +IF(NOT CMAKE_MODULE_EXISTS) + SET(CMAKE_SHARED_MODULE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}) + SET(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS}) +ENDIF(NOT CMAKE_MODULE_EXISTS) + # repeat for modules IF(NOT CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS) SET(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS}) diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index aed1fd2..76cf34e 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -109,6 +109,14 @@ IF(NOT DEFINED CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG) SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG}) ENDIF() +# for most systems a module is the same as a shared library +# so unless the variable CMAKE_MODULE_EXISTS is set just +# copy the values from the LIBRARY variables +IF(NOT CMAKE_MODULE_EXISTS) + SET(CMAKE_SHARED_MODULE_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_Fortran_FLAGS}) + SET(CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS}) +ENDIF(NOT CMAKE_MODULE_EXISTS) + # repeat for modules IF(NOT DEFINED CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS) SET(CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS}) diff --git a/Tests/COnly/CMakeLists.txt b/Tests/COnly/CMakeLists.txt index 7742055..5ef0f1e 100644 --- a/Tests/COnly/CMakeLists.txt +++ b/Tests/COnly/CMakeLists.txt @@ -19,3 +19,5 @@ if("${LANG}" STREQUAL "C") else("${LANG}" STREQUAL "C") message(FATAL_ERROR "Bad language for file conly.c") endif("${LANG}" STREQUAL "C") + +add_library(testCModule MODULE testCModule.c) diff --git a/Tests/COnly/testCModule.c b/Tests/COnly/testCModule.c new file mode 100644 index 0000000..1a89292 --- /dev/null +++ b/Tests/COnly/testCModule.c @@ -0,0 +1,6 @@ +#ifdef _WIN32 +# define TEST_EXPORT __declspec(dllexport) +#else +# define TEST_EXPORT +#endif +TEST_EXPORT int testCModule(void) { return 0; } diff --git a/Tests/CxxOnly/CMakeLists.txt b/Tests/CxxOnly/CMakeLists.txt index 5d27890..e62f3c7 100644 --- a/Tests/CxxOnly/CMakeLists.txt +++ b/Tests/CxxOnly/CMakeLists.txt @@ -9,3 +9,5 @@ add_library(testcxx1.my STATIC libcxx1.cxx ${EXTRA_SRCS}) add_library(testcxx2 SHARED libcxx2.cxx) add_executable (CxxOnly cxxonly.cxx) target_link_libraries(CxxOnly testcxx1.my testcxx2) + +add_library(testCxxModule MODULE testCxxModule.cxx) diff --git a/Tests/CxxOnly/testCxxModule.cxx b/Tests/CxxOnly/testCxxModule.cxx new file mode 100644 index 0000000..dd16d2b --- /dev/null +++ b/Tests/CxxOnly/testCxxModule.cxx @@ -0,0 +1,6 @@ +#ifdef _WIN32 +# define TEST_EXPORT __declspec(dllexport) +#else +# define TEST_EXPORT +#endif +TEST_EXPORT int testCxxModule(void) { return 0; } -- cgit v0.12 From daa4101619514d2b7eebbce7a73cd2149b7679b8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 3 Feb 2012 15:54:20 -0500 Subject: Remove unused test code We have not run tests with the "como" compiler or enabled the experimental ConvLibrary test for years. --- Tests/CMakeLists.txt | 78 +++++++++++++++------------------------- Tests/ConvLibrary/CMakeLists.txt | 20 ----------- Tests/ConvLibrary/bar.c | 4 --- Tests/ConvLibrary/bartest.cxx | 37 ------------------- Tests/ConvLibrary/foo.cxx | 4 --- Tests/ConvLibrary/sub1/car.cxx | 4 --- 6 files changed, 29 insertions(+), 118 deletions(-) delete mode 100644 Tests/ConvLibrary/CMakeLists.txt delete mode 100644 Tests/ConvLibrary/bar.c delete mode 100644 Tests/ConvLibrary/bartest.cxx delete mode 100644 Tests/ConvLibrary/foo.cxx delete mode 100644 Tests/ConvLibrary/sub1/car.cxx diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 2c5acd9..906b40d 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -765,56 +765,36 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ) LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig") - # Como does not seem to support shared libraries. - GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_CXX_COMPILER} NAME_WE) - IF(CMAKE_BASE_NAME MATCHES "^como$") - SET(COMPILER_IS_COMO 1) - ENDIF(CMAKE_BASE_NAME MATCHES "^como$") - IF(NOT COMPILER_IS_COMO) - ADD_TEST(complex ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/Complex" - "${CMake_BINARY_DIR}/Tests/Complex" - --build-two-config - --build-config-sample "${CMAKE_CTEST_COMMAND}" - --build-generator ${CMAKE_TEST_GENERATOR} - --build-project Complex - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} - --build-exe-dir "${CMake_BINARY_DIR}/Tests/Complex/bin" - --build-options - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - --test-command complex - ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Complex") + ADD_TEST(complex ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/Complex" + "${CMake_BINARY_DIR}/Tests/Complex" + --build-two-config + --build-config-sample "${CMAKE_CTEST_COMMAND}" + --build-generator ${CMAKE_TEST_GENERATOR} + --build-project Complex + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --build-exe-dir "${CMake_BINARY_DIR}/Tests/Complex/bin" + --build-options + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + --test-command complex + ) + LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Complex") - ADD_TEST(complexOneConfig ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/ComplexOneConfig" - "${CMake_BINARY_DIR}/Tests/ComplexOneConfig" - --build-generator ${CMAKE_TEST_GENERATOR} - --build-project Complex - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} - --build-exe-dir "${CMake_BINARY_DIR}/Tests/ComplexOneConfig/bin" - --build-options - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - --test-command complex) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ComplexOneConfig") - # because of the registry write these tests depend on each other - SET_TESTS_PROPERTIES ( complex PROPERTIES DEPENDS complexOneConfig) - -# This fails on VS 70 -# works on Xcode and makefiles -# ADD_TEST(ConvLibrary ${CMAKE_CTEST_COMMAND} -# --build-and-test -# "${CMake_SOURCE_DIR}/Tests/ConvLibrary" -# "${CMake_BINARY_DIR}/Tests/ConvLibrary" -# --build-two-config -# --build-generator ${CMAKE_TEST_GENERATOR} -# --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} -# --build-project ConvLibrary -# --test-command bartest) - - ENDIF(NOT COMPILER_IS_COMO) + ADD_TEST(complexOneConfig ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/ComplexOneConfig" + "${CMake_BINARY_DIR}/Tests/ComplexOneConfig" + --build-generator ${CMAKE_TEST_GENERATOR} + --build-project Complex + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --build-exe-dir "${CMake_BINARY_DIR}/Tests/ComplexOneConfig/bin" + --build-options + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + --test-command complex) + LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ComplexOneConfig") + # because of the registry write these tests depend on each other + SET_TESTS_PROPERTIES ( complex PROPERTIES DEPENDS complexOneConfig) ADD_TEST(Example ${CMAKE_CTEST_COMMAND} --build-and-test diff --git a/Tests/ConvLibrary/CMakeLists.txt b/Tests/ConvLibrary/CMakeLists.txt deleted file mode 100644 index afc1cb6..0000000 --- a/Tests/ConvLibrary/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -cmake_minimum_required (VERSION 2.6) -project(ConvLibrary) - -# create a source list -set(foo_sources foo.cxx bar.c sub1/car.cxx) -# create a library foo from the sources -add_library(foo ${foo_sources}) -# get the object files from the target -get_target_property(OBJECT_FILES foo OBJECT_FILES) -message("${OBJECT_FILES}") -# set the object files as generated -set_source_files_properties(${OBJECT_FILES} PROPERTIES GENERATED true) -# create a library bar that contains the object files from foo -add_library(bar ${OBJECT_FILES}) -# set the linker language since bar only has .obj -set_target_properties(bar PROPERTIES LINKER_LANGUAGE CXX) -# make sure foo is built before bar -add_dependencies(bar foo) -add_executable(bartest bartest.cxx) -target_link_libraries(bartest bar) diff --git a/Tests/ConvLibrary/bar.c b/Tests/ConvLibrary/bar.c deleted file mode 100644 index d063082..0000000 --- a/Tests/ConvLibrary/bar.c +++ /dev/null @@ -1,4 +0,0 @@ -int bar() -{ - return 20; -} diff --git a/Tests/ConvLibrary/bartest.cxx b/Tests/ConvLibrary/bartest.cxx deleted file mode 100644 index ab95773..0000000 --- a/Tests/ConvLibrary/bartest.cxx +++ /dev/null @@ -1,37 +0,0 @@ -extern "C" int bar(); -int foo(); -int car(); - -#include -int main() -{ - if(foo() == 10) - { - printf("foo is 10!\n"); - } - else - { - printf("foo is not 10 error!\n"); - return -1; - } - if(bar() == 20) - { - printf("bar is 20!\n"); - } - else - { - printf("bar is not 20 error!\n"); - return -1; - } - if(car() == 30) - { - printf("car is 30!\n"); - } - else - { - printf("car is not 30 error!\n"); - return -1; - } - printf("Test past\n"); - return 0; -} diff --git a/Tests/ConvLibrary/foo.cxx b/Tests/ConvLibrary/foo.cxx deleted file mode 100644 index 1f46ef4..0000000 --- a/Tests/ConvLibrary/foo.cxx +++ /dev/null @@ -1,4 +0,0 @@ -int foo() -{ - return 10; -} diff --git a/Tests/ConvLibrary/sub1/car.cxx b/Tests/ConvLibrary/sub1/car.cxx deleted file mode 100644 index aa66726..0000000 --- a/Tests/ConvLibrary/sub1/car.cxx +++ /dev/null @@ -1,4 +0,0 @@ -int car() -{ - return 30; -} -- cgit v0.12 From a1979dc0e95a6b86495b669076f892cd362bda9f Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sat, 4 Feb 2012 00:05:06 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index f2998f6..dd48db0 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 03) +SET(KWSYS_DATE_STAMP_DAY 04) -- cgit v0.12 From 34cc537132e843d07c3bdeb0ccaa06e82f9aef88 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sun, 5 Feb 2012 00:05:09 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index dd48db0..bc468a4 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 04) +SET(KWSYS_DATE_STAMP_DAY 05) -- cgit v0.12 From 6a74eb1d36b079fe6b566244a636ac1e43303aa6 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sun, 5 Feb 2012 13:13:48 +0100 Subject: CPackNSIS fix #0012935 switch from LOG_WARNING to avoid final error. --- Source/CPack/cmCPackNSISGenerator.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 2b94067..0787ef9 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -344,9 +344,9 @@ int cmCPackNSISGenerator::InitializeInternal() if ( cmSystemTools::IsOn(this->GetOption( "CPACK_INCLUDE_TOPLEVEL_DIRECTORY")) ) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "NSIS Generator cannot work with CPACK_INCLUDE_TOPLEVEL_DIRECTORY. " - "This option will be ignored." + cmCPackLogger(cmCPackLog::LOG_WARNING, + "NSIS Generator cannot work with CPACK_INCLUDE_TOPLEVEL_DIRECTORY set. " + "This option will be reset to 0 (for this generator only)." << std::endl); this->SetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", 0); } -- cgit v0.12 From 1dd43c4c9d6d921b38288802d0560f92c90a0c08 Mon Sep 17 00:00:00 2001 From: Nicolas Despres Date: Sun, 5 Feb 2012 15:09:37 +0100 Subject: ccmake: Factor clear line. --- Source/CursesDialog/cmCursesMainForm.cxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 6c7627f..6b7d89e 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -409,12 +409,11 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */) char thirdLine[512]=""; if (process) { - sprintf(firstLine, - " "); - sprintf(secondLine, - " "); - sprintf(thirdLine, - " "); + const char* clearLine = + " "; + strcpy(firstLine, clearLine); + strcpy(secondLine, clearLine); + strcpy(thirdLine, clearLine); } else { -- cgit v0.12 From e130d3ece47d4ceee45473567935c629da72d1eb Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Mon, 6 Feb 2012 00:05:09 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index bc468a4..57aba08 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 05) +SET(KWSYS_DATE_STAMP_DAY 06) -- cgit v0.12 From c8ef6430e09c063b74708ef0cd28f533c15fd8bd Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 6 Feb 2012 09:40:42 -0500 Subject: Allow directory names containing '=' and warn if necessary (#12934) The approach taken by commit 8704525f (Reject directory names containing '=', 2011-01-14) was perhaps too heavy-handed for avoiding the obscure cases when '=' in the path fails due to limitations of Make syntax. Only two CMake tests: LinkDirectory OutOfSource fail when the path contains '=' and they cover obscure cases. Instead of rejecting such paths outright just warn when the problem may occur. --- Source/cmLocalUnixMakefileGenerator3.cxx | 15 +++++++++++++++ Source/cmake.cxx | 24 ------------------------ Source/cmake.h | 2 -- 3 files changed, 15 insertions(+), 26 deletions(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index ff48009..b10e959 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -561,6 +561,21 @@ cmLocalUnixMakefileGenerator3 space = " "; } + // Warn about paths not supported by Make tools. + std::string::size_type pos = tgt.find_first_of("="); + if(pos != std::string::npos) + { + cmOStringStream m; + m << + "Make rule for\n" + " " << tgt << "\n" + "has '=' on left hand side. " + "The make tool may not support this."; + cmListFileBacktrace bt; + this->GlobalGenerator->GetCMakeInstance() + ->IssueMessage(cmake::WARNING, m.str(), bt); + } + // Mark the rule as symbolic if requested. if(symbolic) { diff --git a/Source/cmake.cxx b/Source/cmake.cxx index bc3245e..1b49837 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1946,32 +1946,8 @@ int cmake::Configure() } -bool cmake::RejectUnsupportedPaths(const char* desc, std::string const& path) -{ - // Some characters are not well-supported by native build systems. - std::string::size_type pos = path.find_first_of("="); - if(pos == std::string::npos) - { - return false; - } - cmOStringStream e; - e << "The path to the " << desc << " directory:\n" - << " " << path << "\n" - << "contains unsupported character '" << path[pos] << "'.\n" - << "Please use a different " << desc << " directory name."; - cmListFileBacktrace bt; - this->IssueMessage(cmake::FATAL_ERROR, e.str(), bt); - return true; -} - int cmake::ActualConfigure() { - if(this->RejectUnsupportedPaths("source", this->cmHomeDirectory) || - this->RejectUnsupportedPaths("binary", this->HomeOutputDirectory)) - { - return 1; - } - // Construct right now our path conversion table before it's too late: this->UpdateConversionPathTable(); this->CleanupCommandsAndMacros(); diff --git a/Source/cmake.h b/Source/cmake.h index 6744ca1..435d38b 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -435,8 +435,6 @@ protected: ///! Find the full path to one of the cmake programs like ctest, cpack, etc. std::string FindCMakeProgram(const char* name) const; - - bool RejectUnsupportedPaths(const char* desc, std::string const& path); private: cmake(const cmake&); // Not implemented. void operator=(const cmake&); // Not implemented. -- cgit v0.12 From 415ffda7a8ca0dfea2e00353a65fb31d8fadfb75 Mon Sep 17 00:00:00 2001 From: Nicolas Despres Date: Sun, 5 Feb 2012 16:56:47 +0100 Subject: ccmake: Extend clear line. When configuring or generating the 'ng' of the end of the second line is not cleared. This patch fixes this. The problem was introduced by commit fd632195 (ccmake: Align 'g' and 'q' key instructions, 2011-01-07) which adjusted the length of lines that need clearing. --- Source/CursesDialog/cmCursesMainForm.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 6b7d89e..4fee0bb 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -410,7 +410,7 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */) if (process) { const char* clearLine = - " "; + " "; strcpy(firstLine, clearLine); strcpy(secondLine, clearLine); strcpy(thirdLine, clearLine); -- cgit v0.12 From 495f8998458f06fac250d62ba948e21c2429565f Mon Sep 17 00:00:00 2001 From: David Cole Date: Mon, 6 Feb 2012 13:48:53 -0500 Subject: Update version of Qt for dashmacmini5 produced release binaries Use 4.8.0 --- Utilities/Release/dashmacmini5_release.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/Release/dashmacmini5_release.cmake b/Utilities/Release/dashmacmini5_release.cmake index 9bb3a98..bd93a87 100644 --- a/Utilities/Release/dashmacmini5_release.cmake +++ b/Utilities/Release/dashmacmini5_release.cmake @@ -14,7 +14,7 @@ CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.5 CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE CPACK_SYSTEM_NAME:STRING=Darwin64-universal BUILD_QtDialog:BOOL=TRUE -QT_QMAKE_EXECUTABLE:FILEPATH=/Users/kitware/Support/qt-4.7.4/install/bin/qmake +QT_QMAKE_EXECUTABLE:FILEPATH=/Users/kitware/Support/qt-4.8.0/install/bin/qmake ") get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH) include(${path}/release_cmake.cmake) -- cgit v0.12 From 45bba995381bd88895eb2e15ac9cdf91dc5c5080 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Tue, 7 Feb 2012 00:05:07 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 57aba08..2cbfe26 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 06) +SET(KWSYS_DATE_STAMP_DAY 07) -- cgit v0.12 From 59ecc2c8ac4f6e4e3e9b20a37763365060d8bb6d Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Wed, 8 Feb 2012 00:05:06 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 2cbfe26..17f7339 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 07) +SET(KWSYS_DATE_STAMP_DAY 08) -- cgit v0.12 From 5db99e8708c7d329620186e4cfb6e059f400dfcc Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 8 Feb 2012 10:48:34 -0500 Subject: Add CheckLanguage module Define a "check_language()" macro to test whether can be enabled. Cache the result in CMAKE__COMPILER. Add a test case covering expected results. --- Modules/CheckLanguage.cmake | 65 ++++++++++++++++++++++++++++ Tests/CMakeOnly/CMakeLists.txt | 2 + Tests/CMakeOnly/CheckLanguage/CMakeLists.txt | 22 ++++++++++ 3 files changed, 89 insertions(+) create mode 100644 Modules/CheckLanguage.cmake create mode 100644 Tests/CMakeOnly/CheckLanguage/CMakeLists.txt diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake new file mode 100644 index 0000000..87a4018 --- /dev/null +++ b/Modules/CheckLanguage.cmake @@ -0,0 +1,65 @@ +# - Check if a language can be enabled +# Usage: +# check_language() +# where is a language that may be passed to enable_language() +# such as "Fortran". If CMAKE__COMPILER is already defined the +# check does nothing. Otherwise it tries enabling the language in a +# test project. The result is cached in CMAKE__COMPILER as the +# compiler that was found, or NOTFOUND if the language cannot be enabled. +# +# Example: +# check_language(Fortran) +# if(CMAKE_Fortran_COMPILER) +# enable_language(Fortran) +# else() +# message(STATUS "No Fortran support") +# endif() + +#============================================================================= +# Copyright 2009-2012 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +macro(check_language lang) + if(NOT DEFINED CMAKE_${lang}_COMPILER) + set(_desc "Looking for a ${lang} compiler") + message(STATUS ${_desc}) + file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}/CMakeLists.txt" + "cmake_minimum_required(VERSION 2.8) +project(Check${lang} ${lang}) +file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\" + \"set(CMAKE_${lang}_COMPILER \\\"\${CMAKE_${lang}_COMPILER}\\\")\\n\" + ) +") + execute_process( + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang} + COMMAND ${CMAKE_COMMAND} . -G ${CMAKE_GENERATOR} + OUTPUT_VARIABLE output + ERROR_VARIABLE output + RESULT_VARIABLE result + ) + include(${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}/result.cmake OPTIONAL) + if(CMAKE_${lang}_COMPILER AND "${result}" STREQUAL "0") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "${_desc} passed with the following output:\n" + "${output}\n") + else() + set(CMAKE_${lang}_COMPILER NOTFOUND) + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "${_desc} failed with the following output:\n" + "${output}\n") + endif() + message(STATUS "${_desc} - ${CMAKE_${lang}_COMPILER}") + set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER}" CACHE FILEPATH "${lang} compiler") + mark_as_advanced(CMAKE_${lang}_COMPILER) + endif() +endmacro() diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt index 33c426a..4407efb 100644 --- a/Tests/CMakeOnly/CMakeLists.txt +++ b/Tests/CMakeOnly/CMakeLists.txt @@ -17,6 +17,8 @@ add_CMakeOnly_test(CheckCXXSymbolExists) add_CMakeOnly_test(CheckCXXCompilerFlag) +add_CMakeOnly_test(CheckLanguage) + add_CMakeOnly_test(AllFindModules) add_CMakeOnly_test(TargetScope) diff --git a/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt b/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt new file mode 100644 index 0000000..f5336dc --- /dev/null +++ b/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required (VERSION 2.8) +project(CheckLanguage NONE) +include(CheckLanguage) + +set(langs ) +set(expect_C 1) +set(expect_CXX 1) +unset(expect_Fortran) +set(expect_NoSuchLanguage 0) +foreach(lang C CXX Fortran NoSuchLanguage) + check_language(${lang}) + if(NOT DEFINED CMAKE_${lang}_COMPILER) + message(FATAL_ERROR "check_language(${lang}) did not set result") + endif() + if(DEFINED expect_${lang}) + if(expect_${lang} AND NOT CMAKE_${lang}_COMPILER) + message(FATAL_ERROR "check_language(${lang}) should not fail!") + elseif(NOT expect_${lang} AND CMAKE_${lang}_COMPILER) + message(FATAL_ERROR "check_language(${lang}) should not succeed!") + endif() + endif() +endforeach() -- cgit v0.12 From 81228e9d1d94cb55fa0a75b474c5a3283b39551a Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 8 Feb 2012 18:46:57 +0100 Subject: FindOpenMP: do not fail if only C or CXX is enabled (#11910) Inspired-By: Raymond Wan --- Modules/FindOpenMP.cmake | 112 +++++++++++++++++++++++++++++------------------ 1 file changed, 69 insertions(+), 43 deletions(-) diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index 652803c..ceac8d2 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -24,9 +24,12 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -include(CheckCSourceCompiles) -include(CheckCXXSourceCompiles) -include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +get_property(_ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) +list(FIND _ENABLED_LANGUAGES "C" _HAVE_LANGUAGE_C) +list(FIND _ENABLED_LANGUAGES "CXX" _HAVE_LANGUAGE_CXX) +unset(_ENABLED_LANGUAGES) + +set(_OPENMP_REQUIRED_VARS) set(OpenMP_C_FLAG_CANDIDATES #Gnu @@ -62,8 +65,6 @@ int main() { #endif } ") -# use the same source for CXX as C for now -set(OpenMP_CXX_TEST_SOURCE ${OpenMP_C_TEST_SOURCE}) # if these are set then do not try to find them again, # by avoiding any try_compiles for the flags if(DEFINED OpenMP_C_FLAGS AND DEFINED OpenMP_CXX_FLAGS) @@ -72,43 +73,68 @@ if(DEFINED OpenMP_C_FLAGS AND DEFINED OpenMP_CXX_FLAGS) endif(DEFINED OpenMP_C_FLAGS AND DEFINED OpenMP_CXX_FLAGS) # check c compiler -foreach(FLAG ${OpenMP_C_FLAG_CANDIDATES}) - set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") - set(CMAKE_REQUIRED_FLAGS "${FLAG}") - unset(OpenMP_FLAG_DETECTED CACHE) - message(STATUS "Try OpenMP C flag = [${FLAG}]") - check_c_source_compiles("${OpenMP_CXX_TEST_SOURCE}" OpenMP_FLAG_DETECTED) - set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}") - if(OpenMP_FLAG_DETECTED) - set(OpenMP_C_FLAGS_INTERNAL "${FLAG}") - break() - endif(OpenMP_FLAG_DETECTED) -endforeach(FLAG ${OpenMP_C_FLAG_CANDIDATES}) +if(NOT _HAVE_LANGUAGE_C EQUAL -1) + include(CheckCSourceCompiles) + + foreach(FLAG ${OpenMP_C_FLAG_CANDIDATES}) + set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") + set(CMAKE_REQUIRED_FLAGS "${FLAG}") + unset(OpenMP_FLAG_DETECTED CACHE) + message(STATUS "Try OpenMP C flag = [${FLAG}]") + check_c_source_compiles("${OpenMP_C_TEST_SOURCE}" OpenMP_FLAG_DETECTED) + set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}") + if(OpenMP_FLAG_DETECTED) + set(OpenMP_C_FLAGS_INTERNAL "${FLAG}") + break() + endif(OpenMP_FLAG_DETECTED) + endforeach(FLAG ${OpenMP_C_FLAG_CANDIDATES}) + + set(OpenMP_C_FLAGS "${OpenMP_C_FLAGS_INTERNAL}" + CACHE STRING "C compiler flags for OpenMP parallization") + + list(APPEND _OPENMP_REQUIRED_VARS OpenMP_C_FLAGS) + unset(OpenMP_C_FLAG_CANDIDATES) +endif() # check cxx compiler -foreach(FLAG ${OpenMP_CXX_FLAG_CANDIDATES}) - set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") - set(CMAKE_REQUIRED_FLAGS "${FLAG}") - unset(OpenMP_FLAG_DETECTED CACHE) - message(STATUS "Try OpenMP CXX flag = [${FLAG}]") - check_cxx_source_compiles("${OpenMP_C_TEST_SOURCE}" OpenMP_FLAG_DETECTED) - set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}") - if(OpenMP_FLAG_DETECTED) - set(OpenMP_CXX_FLAGS_INTERNAL "${FLAG}") - break() - endif(OpenMP_FLAG_DETECTED) -endforeach(FLAG ${OpenMP_CXX_FLAG_CANDIDATES}) - -set(OpenMP_C_FLAGS "${OpenMP_C_FLAGS_INTERNAL}" - CACHE STRING "C compiler flags for OpenMP parallization") - -set(OpenMP_CXX_FLAGS "${OpenMP_CXX_FLAGS_INTERNAL}" - CACHE STRING "C++ compiler flags for OpenMP parallization") -# handle the standard arguments for find_package -find_package_handle_standard_args(OpenMP DEFAULT_MSG - OpenMP_C_FLAGS OpenMP_CXX_FLAGS ) - -mark_as_advanced( - OpenMP_C_FLAGS - OpenMP_CXX_FLAGS -) +if(NOT _HAVE_LANGUAGE_CXX EQUAL -1) + include(CheckCXXSourceCompiles) + # use the same source for CXX as C for now + set(OpenMP_CXX_TEST_SOURCE ${OpenMP_C_TEST_SOURCE}) + + foreach(FLAG ${OpenMP_CXX_FLAG_CANDIDATES}) + set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") + set(CMAKE_REQUIRED_FLAGS "${FLAG}") + unset(OpenMP_FLAG_DETECTED CACHE) + message(STATUS "Try OpenMP CXX flag = [${FLAG}]") + check_cxx_source_compiles("${OpenMP_CXX_TEST_SOURCE}" OpenMP_FLAG_DETECTED) + set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}") + if(OpenMP_FLAG_DETECTED) + set(OpenMP_CXX_FLAGS_INTERNAL "${FLAG}") + break() + endif(OpenMP_FLAG_DETECTED) + endforeach(FLAG ${OpenMP_CXX_FLAG_CANDIDATES}) + + set(OpenMP_CXX_FLAGS "${OpenMP_CXX_FLAGS_INTERNAL}" + CACHE STRING "C++ compiler flags for OpenMP parallization") + + list(APPEND _OPENMP_REQUIRED_VARS OpenMP_CXX_FLAGS) + unset(OpenMP_CXX_FLAG_CANDIDATES) + unset(OpenMP_CXX_TEST_SOURCE) +endif() + +unset(_HAVE_LANGUAGE_C) +unset(_HAVE_LANGUAGE_CXX) + +if(_OPENMP_REQUIRED_VARS) + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) + + find_package_handle_standard_args(OpenMP + REQUIRED_VARS ${_OPENMP_REQUIRED_VARS}) + + mark_as_advanced(${_OPENMP_REQUIRED_VARS}) + + unset(_OPENMP_REQUIRED_VARS) +else() + message(SEND_ERROR "FindOpenMP requires C or CXX language to be enabled") +endif() -- cgit v0.12 From c008141eee4ef2989e4b172bc1aa018255c89cd9 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 8 Feb 2012 20:15:20 +0100 Subject: FindX11: also search for Xmu (#12447) --- Modules/FindX11.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake index 04646c0..1735bd4 100644 --- a/Modules/FindX11.cmake +++ b/Modules/FindX11.cmake @@ -29,6 +29,7 @@ # X11_Xkb_INCLUDE_PATH, X11_Xkb_FOUND # X11_Xkblib_INCLUDE_PATH, X11_Xkb_FOUND # X11_Xkbfile_INCLUDE_PATH, X11_Xkbfile_LIB, X11_Xkbfile_FOUND +# X11_Xmu_INCLUDE_PATH, X11_Xmu_LIB, X11_Xmu_FOUND # X11_Xpm_INCLUDE_PATH, X11_Xpm_LIB, X11_Xpm_FOUND # X11_XTest_INCLUDE_PATH, X11_XTest_LIB, X11_XTest_FOUND # X11_Xrandr_INCLUDE_PATH, X11_Xrandr_LIB, X11_Xrandr_FOUND @@ -103,6 +104,7 @@ IF (UNIX) FIND_PATH(X11_Xkb_INCLUDE_PATH X11/extensions/XKB.h ${X11_INC_SEARCH_PATH}) FIND_PATH(X11_Xkblib_INCLUDE_PATH X11/XKBlib.h ${X11_INC_SEARCH_PATH}) FIND_PATH(X11_Xkbfile_INCLUDE_PATH X11/extensions/XKBfile.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_Xmu_INCLUDE_PATH X11/Xmu/Xmu.h ${X11_INC_SEARCH_PATH}) FIND_PATH(X11_Xpm_INCLUDE_PATH X11/xpm.h ${X11_INC_SEARCH_PATH}) FIND_PATH(X11_XTest_INCLUDE_PATH X11/extensions/XTest.h ${X11_INC_SEARCH_PATH}) FIND_PATH(X11_XShm_INCLUDE_PATH X11/extensions/XShm.h ${X11_INC_SEARCH_PATH}) @@ -134,6 +136,7 @@ IF (UNIX) FIND_LIBRARY(X11_Xinerama_LIB Xinerama ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xinput_LIB Xi ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xkbfile_LIB xkbfile ${X11_LIB_SEARCH_PATH}) + FIND_LIBRARY(X11_Xmu_LIB Xmu ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xpm_LIB Xpm ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xrandr_LIB Xrandr ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH}) @@ -297,6 +300,11 @@ IF (UNIX) SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xkbfile_INCLUDE_PATH} ) ENDIF (X11_Xkbfile_INCLUDE_PATH AND X11_Xkbfile_LIB AND X11_Xlib_INCLUDE_PATH) + IF (X11_Xmu_INCLUDE_PATH AND X11_Xmu_LIB) + SET(X11_Xmu_FOUND TRUE) + SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xmu_INCLUDE_PATH}) + ENDIF (X11_Xmu_INCLUDE_PATH AND X11_Xmu_LIB) + IF (X11_Xinput_INCLUDE_PATH AND X11_Xinput_LIB) SET(X11_Xinput_FOUND TRUE) SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinput_INCLUDE_PATH}) @@ -456,6 +464,8 @@ IF (UNIX) X11_Xkblib_INCLUDE_PATH X11_Xkbfile_INCLUDE_PATH X11_Xkbfile_LIB + X11_Xmu_INCLUDE_PATH + X11_Xmu_LIB X11_Xscreensaver_INCLUDE_PATH X11_Xscreensaver_LIB X11_Xpm_INCLUDE_PATH -- cgit v0.12 From bb5f48fe99b3b6d66d7ae6b6c4ae6ac07969e5e2 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 8 Feb 2012 20:26:27 +0100 Subject: detect "pgfortran" as PGI Fortran compiler (#12425) See http://www.pgroup.com/doc/pgiug.pdf, page xviii. --- Modules/CMakeDetermineFortranCompiler.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index efcba29..ade6d58 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -50,7 +50,7 @@ IF(NOT CMAKE_Fortran_COMPILER) # fort77: native F77 compiler under HP-UX (and some older Crays) # frt: Fujitsu F77 compiler # pathf90/pathf95/pathf2003: PathScale Fortran compiler - # pgf77/pgf90/pgf95: Portland Group F77/F90/F95 compilers + # pgf77/pgf90/pgf95/pgfortran: Portland Group F77/F90/F95 compilers # xlf/xlf90/xlf95: IBM (AIX) F77/F90/F95 compilers # lf95: Lahey-Fujitsu F95 compiler # fl32: Microsoft Fortran 77 "PowerStation" compiler @@ -64,8 +64,8 @@ IF(NOT CMAKE_Fortran_COMPILER) # then 77 or older compilers, gnu is always last in the group, # so if you paid for a compiler it is picked by default. SET(CMAKE_Fortran_COMPILER_LIST - ifort ifc af95 af90 efc f95 pathf2003 pathf95 pgf95 lf95 xlf95 fort - gfortran gfortran-4 g95 f90 pathf90 pgf90 xlf90 epcf90 fort77 + ifort ifc af95 af90 efc f95 pathf2003 pathf95 pgf95 pgfortran lf95 xlf95 + fort gfortran gfortran-4 g95 f90 pathf90 pgf90 xlf90 epcf90 fort77 frt pgf77 xlf fl32 af77 g77 f77 ) @@ -73,7 +73,7 @@ IF(NOT CMAKE_Fortran_COMPILER) SET(_Fortran_COMPILER_NAMES_GNU gfortran gfortran-4 g95 g77) SET(_Fortran_COMPILER_NAMES_Intel ifort ifc efc) SET(_Fortran_COMPILER_NAMES_Absoft af95 af90 af77) - SET(_Fortran_COMPILER_NAMES_PGI pgf95 pgf90 pgf77) + SET(_Fortran_COMPILER_NAMES_PGI pgf95 pgfortran pgf90 pgf77) SET(_Fortran_COMPILER_NAMES_PathScale pathf2003 pathf95 pathf90) SET(_Fortran_COMPILER_NAMES_XL xlf) SET(_Fortran_COMPILER_NAMES_VisualAge xlf95 xlf90 xlf) -- cgit v0.12 From cbdfcc6515a58731308d21bb3c5cbaa513503c01 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Wed, 8 Feb 2012 18:40:55 -0700 Subject: FindQt4: clarify warning message about incorrect Qt installation. Fixes bug #12915. Thanks Laurent Rineau and Brad King for input. --- Modules/FindQt4.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index c56827e..9b646b4 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -588,8 +588,9 @@ IF (QT_QMAKE_EXECUTABLE AND QTVERSION) SET(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE INTERNAL "Qt library dir" FORCE) SET(QT_QTCORE_FOUND 1) ELSE() - MESSAGE("Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_LIBS as ${QT_LIBRARY_DIR_TMP}") - MESSAGE("Warning: But QtCore couldn't be found. Qt must NOT be installed correctly, or it wasn't found for cross compiling.") + MESSAGE(WARNING "${QT_QMAKE_EXECUTABLE} reported QT_INSTALL_LIBS as \"${QT_LIBRARY_DIR_TMP}\" " + "but QtCore could not be found there. " + "Qt is NOT installed correctly for the target build environment.") IF(Qt4_FIND_REQUIRED) MESSAGE( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details.") ENDIF(Qt4_FIND_REQUIRED) -- cgit v0.12 From 7a6d2796e63a8a390bd86fe9a029c4add119132b Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Wed, 8 Feb 2012 19:01:29 -0700 Subject: FindQt4: Add include directories for lupdate. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes bug #12644. Thanks Bernd Lörwald for partial patch. --- Modules/Qt4Macros.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index 4da1a3f..f327125 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -393,7 +393,13 @@ MACRO(QT4_CREATE_TRANSLATION _qm_files) FOREACH(_pro_src ${_my_sources}) SET(_pro_srcs "${_pro_srcs} \"${_pro_src}\"") ENDFOREACH(_pro_src ${_my_sources}) - FILE(WRITE ${_ts_pro} "SOURCES = ${_pro_srcs}") + SET(_pro_includes) + GET_DIRECTORY_PROPERTY(_inc_DIRS INCLUDE_DIRECTORIES) + FOREACH(_pro_include ${_inc_DIRS}) + GET_FILENAME_COMPONENT(_abs_include "${_pro_include}" ABSOLUTE) + SET(_pro_includes "${_pro_includes} \"${_abs_include}\"") + ENDFOREACH(_pro_include ${CMAKE_CXX_INCLUDE_PATH}) + FILE(WRITE ${_ts_pro} "SOURCES = ${_pro_srcs}\nINCLUDEPATH = ${_pro_includes}\n") ENDIF(_my_sources) ADD_CUSTOM_COMMAND(OUTPUT ${_ts_file} COMMAND ${QT_LUPDATE_EXECUTABLE} -- cgit v0.12 From 16b1a6e4e07b223c7ead20cd40346fc327e90569 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Thu, 9 Feb 2012 00:05:06 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 17f7339..7b31670 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 08) +SET(KWSYS_DATE_STAMP_DAY 09) -- cgit v0.12 From 538c3452ad660a45c3d6ca32f8c09ee7c93a8b84 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 9 Dec 2011 18:04:19 -0500 Subject: Add CMakeAddFortranSubdirectory to use MinGW gfortran in VS This patch adds a new module that allows for easy integration of MinGW gfortran and the Visual Studio compiler. It is done in a function called cmake_add_fortran_subdirectory. The patch also includes a test for this feature. --- Modules/CMakeAddFortranSubdirectory.cmake | 167 +++++++++++++++++++++ .../build_mingw.cmake.in | 2 + .../config_mingw.cmake.in | 8 + Tests/CMakeLists.txt | 9 ++ Tests/VSGNUFortran/CMakeLists.txt | 39 +++++ Tests/VSGNUFortran/c_code/CMakeLists.txt | 2 + Tests/VSGNUFortran/c_code/main.c | 7 + Tests/VSGNUFortran/fortran/CMakeLists.txt | 12 ++ Tests/VSGNUFortran/fortran/hello.f | 7 + Tests/VSGNUFortran/fortran/world.f | 6 + Tests/VSGNUFortran/runtest.cmake.in | 23 +++ 11 files changed, 282 insertions(+) create mode 100644 Modules/CMakeAddFortranSubdirectory.cmake create mode 100644 Modules/CMakeAddFortranSubdirectory/build_mingw.cmake.in create mode 100644 Modules/CMakeAddFortranSubdirectory/config_mingw.cmake.in create mode 100644 Tests/VSGNUFortran/CMakeLists.txt create mode 100644 Tests/VSGNUFortran/c_code/CMakeLists.txt create mode 100644 Tests/VSGNUFortran/c_code/main.c create mode 100644 Tests/VSGNUFortran/fortran/CMakeLists.txt create mode 100644 Tests/VSGNUFortran/fortran/hello.f create mode 100644 Tests/VSGNUFortran/fortran/world.f create mode 100644 Tests/VSGNUFortran/runtest.cmake.in diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake new file mode 100644 index 0000000..4e351a6 --- /dev/null +++ b/Modules/CMakeAddFortranSubdirectory.cmake @@ -0,0 +1,167 @@ +# - Use MinGW gfortran from VS if a fortran compiler is not found. +# The 'add_fortran_subdirectory' function adds a subdirectory +# to a project that contains a fortran only sub-project. The module +# will check the current compiler and see if it can support fortran. +# If no fortran compiler is found and the compiler is MSVC, then +# this module will find the MinGW gfortran. It will then use +# an external project to build with the MinGW tools. It will also +# create imported targets for the libraries created. This will only +# work if the fortran code is built into a dll, so BUILD_SHARED_LIBS +# is turned on in the project. In addition the GNUtoMS option is set +# to on, so that the MS .lib files are created. +# Usage is as follows: +# cmake_add_fortran_subdirectory( +# # name of subdirectory +# PROJECT # project name in sbudir toplevel CMakeLists.txt +# ARCHIVE_DIR # .lib location relative to root binary tree (lib) +# RUNTIME_DIR # .dll location relative to root binary tree (bin) +# LIBRARIES lib2 lib2 # names of libraries created and exported +# LINK_LIBRARIES # link interface libraries for LIBRARIES +# LINK_LIBS ... +# LINK_LIBS ... +# CMAKE_COMMAND_LINE # extra command line flags to pass to cmake +# ) +# + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + + +set(_MS_MINGW_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}) +include(CheckLanguage) +include(ExternalProject) +include(CMakeParseArguments) + +function(_setup_mingw_config_and_build source_dir) + find_program(MINGW_GFORTRAN NAMES gfortran + HINTS + c:/MinGW/bin + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MinGW;InstallLocation]/bin" ) + if(NOT MINGW_GFORTRAN) + message(FATAL_ERROR + "gfortran not found, please install MinGW with the gfortran option." + "Or set the cache variable MINGW_GFORTRAN to the full path. " + " This is required to build") + endif() + execute_process(COMMAND ${MINGW_GFORTRAN} -v ERROR_VARIABLE out) + if(NOT "${out}" MATCHES "Target:.*mingw32") + message(FATAL_ERROR "Non-MinGW gfortran found: ${MINGW_GFORTRAN}\n" + "output from -v [${out}]\n" + "set MINGW_GFORTRAN to the path to MinGW fortran.") + endif() + get_filename_component(MINGW_PATH ${MINGW_GFORTRAN} PATH) + file(TO_NATIVE_PATH "${MINGW_PATH}" MINGW_PATH) + string(REPLACE "\\" "\\\\" MINGW_PATH "${MINGW_PATH}") + configure_file( + ${_MS_MINGW_SOURCE_DIR}/CMakeAddFortranSubdirectory/config_mingw.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/config_mingw.cmake + @ONLY) + configure_file( + ${_MS_MINGW_SOURCE_DIR}/CMakeAddFortranSubdirectory/build_mingw.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/build_mingw.cmake + @ONLY) +endfunction() + +function(_add_fortran_library_link_interface library depend_library) + set_target_properties(${library} PROPERTIES + IMPORTED_LINK_INTERFACE_LIBRARIES_NOCONFIG "${depend_library}") +endfunction() + + +function(cmake_add_fortran_subdirectory subdir) + # if we are not using MSVC without fortran support + # then just use the usual add_subdirectory to build + # the fortran library + check_language(Fortran) + if(NOT (MSVC AND (NOT CMAKE_Fortran_COMPILER))) + add_subdirectory(${subdir}) + return() + endif() + + # if we have MSVC without Intel fortran then setup + # external projects to build with mingw fortran + + # Parse arguments to function + set(oneValueArgs PROJECT ARCHIVE_DIR RUNTIME_DIR) + set(multiValueArgs LIBRARIES LINK_LIBRARIES CMAKE_COMMAND_LINE) + cmake_parse_arguments(ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + set(source_dir "${CMAKE_CURRENT_SOURCE_DIR}/${subdir}") + set(project_name "${ARGS_PROJECT}") + set(library_dir "${ARGS_ARCHIVE_DIR}") + set(binary_dir "${ARGS_RUNTIME_DIR}") + set(libraries ${ARGS_LIBRARIES}) + # use the same directory that add_subdirectory would have used + set(build_dir "${CMAKE_CURRENT_BINARY_DIR}/${subdir}") + # create build and configure wrapper scripts + _setup_mingw_config_and_build(${source_dir}) + # create the external project + externalproject_add(${project_name}_build + SOURCE_DIR ${source_dir} + BINARY_DIR ${build_dir} + CONFIGURE_COMMAND ${CMAKE_COMMAND} + -P ${CMAKE_CURRENT_BINARY_DIR}/config_mingw.cmake + BUILD_COMMAND ${CMAKE_COMMAND} + -P ${CMAKE_CURRENT_BINARY_DIR}/build_mingw.cmake + INSTALL_COMMAND "" + ) + # make the external project always run make with each build + externalproject_add_step(${project_name}_build forcebuild + COMMAND ${CMAKE_COMMAND} + -E remove + ${CMAKE_CURRENT_BUILD_DIR}/${project_name}-prefix/src/${project_name}-stamp/${project_name}-build + DEPENDEES configure + DEPENDERS build + ALWAYS 1 + ) + # create imported targets for all libraries + foreach(lib ${libraries}) + add_library(${lib} SHARED IMPORTED) + set_property(TARGET ${lib} APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG) + set_target_properties(${lib} PROPERTIES + IMPORTED_IMPLIB_NOCONFIG + "${build_dir}/${library_dir}/lib${lib}.lib" + IMPORTED_LOCATION_NOCONFIG + "${build_dir}/${binary_dir}/lib${lib}.dll" + ) + add_dependencies(${lib} ${project_name}_build) + endforeach() + + # now setup link libraries for targets + set(start FALSE) + set(target) + foreach(lib ${ARGS_LINK_LIBRARIES}) + if("${lib}" STREQUAL "LINK_LIBS") + set(start TRUE) + else() + if(start) + if(DEFINED target) + # process current target and target_libs + _add_fortran_library_link_interface(${target} "${target_libs}") + # zero out target and target_libs + set(target) + set(target_libs) + endif() + # save the current target and set start to FALSE + set(target ${lib}) + set(start FALSE) + else() + # append the lib to target_libs + list(APPEND target_libs "${lib}") + endif() + endif() + endforeach() + # process anything that is left in target and target_libs + if(DEFINED target) + _add_fortran_library_link_interface(${target} "${target_libs}") + endif() +endfunction() diff --git a/Modules/CMakeAddFortranSubdirectory/build_mingw.cmake.in b/Modules/CMakeAddFortranSubdirectory/build_mingw.cmake.in new file mode 100644 index 0000000..55b271a --- /dev/null +++ b/Modules/CMakeAddFortranSubdirectory/build_mingw.cmake.in @@ -0,0 +1,2 @@ +set(ENV{PATH} "@MINGW_PATH@\;$ENV{PATH}") +execute_process(COMMAND "@CMAKE_COMMAND@" --build . ) diff --git a/Modules/CMakeAddFortranSubdirectory/config_mingw.cmake.in b/Modules/CMakeAddFortranSubdirectory/config_mingw.cmake.in new file mode 100644 index 0000000..96141da --- /dev/null +++ b/Modules/CMakeAddFortranSubdirectory/config_mingw.cmake.in @@ -0,0 +1,8 @@ +set(ENV{PATH} "@MINGW_PATH@\;$ENV{PATH}") +execute_process( + COMMAND "@CMAKE_COMMAND@" "-GMinGW Makefiles" + -DCMAKE_Fortran_COMPILER:PATH=@MINGW_GFORTRAN@ + -DBUILD_SHARED_LIBS=ON + -DCMAKE_GNUtoMS=ON + @ARGS_CMAKE_COMMAND_LINE@ + "@source_dir@") diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 906b40d..e949887 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -163,6 +163,15 @@ IF(BUILD_TESTING) IF(CMAKE_Fortran_COMPILER) ADD_TEST_MACRO(FortranOnly FortranOnly) ENDIF() + # test Visual Studio GNU Fortran mixing with cmake_add_fortran_subdirectory + # run this project if we have a working fortran compiler or + # the test is enabled with CMAKE_TEST_CMAKE_ADD_FORTRAN cache variable. + # If you enable the test, CMake should find the MinGW fortran install, + # or in some cases you might need to set the PATH so that cmake can find + # the gfortran from mingw. + IF(CMAKE_Fortran_COMPILER OR CMAKE_TEST_CMAKE_ADD_FORTRAN) + ADD_TEST_MACRO(VSGNUFortran ${CMAKE_COMMAND} -P runtest.cmake) + ENDIF() ADD_TEST_MACRO(COnly COnly) ADD_TEST_MACRO(CxxOnly CxxOnly) ADD_TEST_MACRO(IPO COnly/COnly) diff --git a/Tests/VSGNUFortran/CMakeLists.txt b/Tests/VSGNUFortran/CMakeLists.txt new file mode 100644 index 0000000..2e527f9 --- /dev/null +++ b/Tests/VSGNUFortran/CMakeLists.txt @@ -0,0 +1,39 @@ +cmake_minimum_required(VERSION 2.8) +project(VSGNUFortran) +# force the executable to be put out of Debug/Release dir +# because gmake build of fortran will not be in a config +# directory, and for easier testing we want the exe and .dll +# to be in the same directory. +if(CMAKE_CONFIGURATION_TYPES) + foreach(config ${CMAKE_CONFIGURATION_TYPES}) + string(TOUPPER "${config}" config) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${config} + "${PROJECT_BINARY_DIR}/bin") + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${config} + "${PROJECT_BINARY_DIR}/bin") + endforeach() +else() + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) +endif() + +include(CMakeAddFortranSubdirectory) +# add the fortran subdirectory as a fortran project +# the subdir is fortran, the project is FortranHello +cmake_add_fortran_subdirectory(fortran + PROJECT FortranHello # project name in toplevel CMakeLists.txt + ARCHIVE_DIR ../bin # .lib location relative to root binary tree + RUNTIME_DIR ../bin # .dll location relative to root binary tree + LIBRARIES hello world # target libraries created + CMAKE_COMMAND_LINE -DEXECUTABLE_OUTPUT_PATH=../bin + -DLIBRARY_OUTPUT_PATH=../bin + LINK_LIBRARIES # link interface libraries + LINK_LIBS hello world # hello needs world to link + ) + +include_directories(${VSGNUFortran_BINARY_DIR}/fortran) +add_subdirectory(c_code) +# use a cmake script to run the executable so that PATH +# can be set with the MinGW/bin in it, and the fortran +# runtime libraries can be found. +configure_file(runtest.cmake.in runtest.cmake @ONLY) diff --git a/Tests/VSGNUFortran/c_code/CMakeLists.txt b/Tests/VSGNUFortran/c_code/CMakeLists.txt new file mode 100644 index 0000000..27d22fd --- /dev/null +++ b/Tests/VSGNUFortran/c_code/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(c_using_fortran main.c) +target_link_libraries(c_using_fortran hello) diff --git a/Tests/VSGNUFortran/c_code/main.c b/Tests/VSGNUFortran/c_code/main.c new file mode 100644 index 0000000..391bf26 --- /dev/null +++ b/Tests/VSGNUFortran/c_code/main.c @@ -0,0 +1,7 @@ +#include // created by FortranCInterface +extern void FC_hello(void); +int main() +{ + FC_hello(); + return 0; +} diff --git a/Tests/VSGNUFortran/fortran/CMakeLists.txt b/Tests/VSGNUFortran/fortran/CMakeLists.txt new file mode 100644 index 0000000..ff22993 --- /dev/null +++ b/Tests/VSGNUFortran/fortran/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 2.8) +project(FortranHello Fortran C) + +include(FortranCInterface) +FortranCInterface_HEADER(HelloWorldFCMangle.h + MACRO_NAMESPACE "FC_" + SYMBOL_NAMESPACE "FC_" + SYMBOLS hello world) + +add_library(hello SHARED hello.f) +add_library(world SHARED world.f) +target_link_libraries(hello world) diff --git a/Tests/VSGNUFortran/fortran/hello.f b/Tests/VSGNUFortran/fortran/hello.f new file mode 100644 index 0000000..e52119a --- /dev/null +++ b/Tests/VSGNUFortran/fortran/hello.f @@ -0,0 +1,7 @@ +!DEC$ ATTRIBUTES DLLEXPORT :: HELLO + SUBROUTINE HELLO + + PRINT *, 'Hello' + CALL WORLD + + END diff --git a/Tests/VSGNUFortran/fortran/world.f b/Tests/VSGNUFortran/fortran/world.f new file mode 100644 index 0000000..0598eee --- /dev/null +++ b/Tests/VSGNUFortran/fortran/world.f @@ -0,0 +1,6 @@ +!DEC$ ATTRIBUTES DLLEXPORT :: WORLD + SUBROUTINE WORLD + + PRINT *, 'World!' + + END diff --git a/Tests/VSGNUFortran/runtest.cmake.in b/Tests/VSGNUFortran/runtest.cmake.in new file mode 100644 index 0000000..987207b --- /dev/null +++ b/Tests/VSGNUFortran/runtest.cmake.in @@ -0,0 +1,23 @@ +get_filename_component(MINGW_PATH "@MINGW_GFORTRAN@" PATH) +if(NOT EXISTS "${MINGW_PATH}") + set(test_exe + "@VSGNUFortran_BINARY_DIR@/bin/c_using_fortran@CMAKE_EXECUTABLE_SUFFIX@") + message("run: ${test_exe}") + execute_process(COMMAND "${test_exe}" + RESULT_VARIABLE res) + if(NOT "${res}" EQUAL 0) + message(FATAL_ERROR "${test_exe} returned a non 0 value") + endif() + return() +endif() +file(TO_NATIVE_PATH "${MINGW_PATH}" MINGW_PATH) +string(REPLACE "\\" "\\\\" MINGW_PATH "${MINGW_PATH}") +message("${MINGW_PATH}") +set(test_exe "@VSGNUFortran_BINARY_DIR@/bin/c_using_fortran.exe") +set(ENV{PATH} "${MINGW_PATH}";$ENV{PATH}) +message("run ${test_exe}") +execute_process(COMMAND "${test_exe}" + RESULT_VARIABLE res) +if(NOT "${res}" EQUAL 0) + message(FATAL_ERROR "${test_exe} returned a non 0 value") +endif() -- cgit v0.12 From e4ae038f5d9f0fa14d63f9eaea71e0466dc86619 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 15 Dec 2011 10:19:46 -0500 Subject: CMakeAddFortranSubdirectory: Allow full paths to directories Fix the implementation to allow full paths with spaces. Change the interpretation of relative paths to be with respect to the current binary directory. This matches the convention used in ExternalProject. Test both full and relative paths in the VSGNUFortran test. --- Modules/CMakeAddFortranSubdirectory.cmake | 19 +++++++++++++------ .../config_mingw.cmake.in | 3 ++- Tests/VSGNUFortran/CMakeLists.txt | 22 ++++++++++++---------- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake index 4e351a6..e92dcb4 100644 --- a/Modules/CMakeAddFortranSubdirectory.cmake +++ b/Modules/CMakeAddFortranSubdirectory.cmake @@ -13,14 +13,17 @@ # cmake_add_fortran_subdirectory( # # name of subdirectory # PROJECT # project name in sbudir toplevel CMakeLists.txt -# ARCHIVE_DIR # .lib location relative to root binary tree (lib) -# RUNTIME_DIR # .dll location relative to root binary tree (bin) +# ARCHIVE_DIR # dir where project places .lib files +# RUNTIME_DIR # dir where project places .dll files # LIBRARIES lib2 lib2 # names of libraries created and exported # LINK_LIBRARIES # link interface libraries for LIBRARIES # LINK_LIBS ... # LINK_LIBS ... # CMAKE_COMMAND_LINE # extra command line flags to pass to cmake # ) +# Relative paths in ARCHIVE_DIR and RUNTIME_DIR are interpreted with respect +# to the build directory corresponding to the source directory in which the +# function is invoked. # #============================================================================= @@ -102,6 +105,12 @@ function(cmake_add_fortran_subdirectory subdir) set(libraries ${ARGS_LIBRARIES}) # use the same directory that add_subdirectory would have used set(build_dir "${CMAKE_CURRENT_BINARY_DIR}/${subdir}") + foreach(dir_var library_dir binary_dir) + if(NOT IS_ABSOLUTE "${${dir_var}}") + get_filename_component(${dir_var} + "${CMAKE_CURRENT_BINARY_DIR}/${${dir_var}}" ABSOLUTE) + endif() + endforeach() # create build and configure wrapper scripts _setup_mingw_config_and_build(${source_dir}) # create the external project @@ -128,10 +137,8 @@ function(cmake_add_fortran_subdirectory subdir) add_library(${lib} SHARED IMPORTED) set_property(TARGET ${lib} APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG) set_target_properties(${lib} PROPERTIES - IMPORTED_IMPLIB_NOCONFIG - "${build_dir}/${library_dir}/lib${lib}.lib" - IMPORTED_LOCATION_NOCONFIG - "${build_dir}/${binary_dir}/lib${lib}.dll" + IMPORTED_IMPLIB_NOCONFIG "${library_dir}/lib${lib}.lib" + IMPORTED_LOCATION_NOCONFIG "${binary_dir}/lib${lib}.dll" ) add_dependencies(${lib} ${project_name}_build) endforeach() diff --git a/Modules/CMakeAddFortranSubdirectory/config_mingw.cmake.in b/Modules/CMakeAddFortranSubdirectory/config_mingw.cmake.in index 96141da..97f6769 100644 --- a/Modules/CMakeAddFortranSubdirectory/config_mingw.cmake.in +++ b/Modules/CMakeAddFortranSubdirectory/config_mingw.cmake.in @@ -1,8 +1,9 @@ set(ENV{PATH} "@MINGW_PATH@\;$ENV{PATH}") +set(CMAKE_COMMAND_LINE "@ARGS_CMAKE_COMMAND_LINE@") execute_process( COMMAND "@CMAKE_COMMAND@" "-GMinGW Makefiles" -DCMAKE_Fortran_COMPILER:PATH=@MINGW_GFORTRAN@ -DBUILD_SHARED_LIBS=ON -DCMAKE_GNUtoMS=ON - @ARGS_CMAKE_COMMAND_LINE@ + ${CMAKE_COMMAND_LINE} "@source_dir@") diff --git a/Tests/VSGNUFortran/CMakeLists.txt b/Tests/VSGNUFortran/CMakeLists.txt index 2e527f9..422350a 100644 --- a/Tests/VSGNUFortran/CMakeLists.txt +++ b/Tests/VSGNUFortran/CMakeLists.txt @@ -1,5 +1,10 @@ cmake_minimum_required(VERSION 2.8) project(VSGNUFortran) + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") + # force the executable to be put out of Debug/Release dir # because gmake build of fortran will not be in a config # directory, and for easier testing we want the exe and .dll @@ -7,14 +12,9 @@ project(VSGNUFortran) if(CMAKE_CONFIGURATION_TYPES) foreach(config ${CMAKE_CONFIGURATION_TYPES}) string(TOUPPER "${config}" config) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${config} - "${PROJECT_BINARY_DIR}/bin") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${config} - "${PROJECT_BINARY_DIR}/bin") + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) endforeach() -else() - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) endif() include(CMakeAddFortranSubdirectory) @@ -22,11 +22,13 @@ include(CMakeAddFortranSubdirectory) # the subdir is fortran, the project is FortranHello cmake_add_fortran_subdirectory(fortran PROJECT FortranHello # project name in toplevel CMakeLists.txt - ARCHIVE_DIR ../bin # .lib location relative to root binary tree - RUNTIME_DIR ../bin # .dll location relative to root binary tree + ARCHIVE_DIR ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} + RUNTIME_DIR bin # ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} LIBRARIES hello world # target libraries created - CMAKE_COMMAND_LINE -DEXECUTABLE_OUTPUT_PATH=../bin - -DLIBRARY_OUTPUT_PATH=../bin + CMAKE_COMMAND_LINE + -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} + -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} LINK_LIBRARIES # link interface libraries LINK_LIBS hello world # hello needs world to link ) -- cgit v0.12 From d6b031283a686eaeff643a13f8368c7828850229 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 15 Dec 2011 10:48:33 -0500 Subject: CMakeAddFortranSubdirectory: Fix documentation format and typos Indent the function signature correctly. Fix some typos. Fix the copyright year. --- Modules/CMakeAddFortranSubdirectory.cmake | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake index e92dcb4..10935a8 100644 --- a/Modules/CMakeAddFortranSubdirectory.cmake +++ b/Modules/CMakeAddFortranSubdirectory.cmake @@ -7,27 +7,25 @@ # an external project to build with the MinGW tools. It will also # create imported targets for the libraries created. This will only # work if the fortran code is built into a dll, so BUILD_SHARED_LIBS -# is turned on in the project. In addition the GNUtoMS option is set -# to on, so that the MS .lib files are created. +# is turned on in the project. In addition the CMAKE_GNUtoMS option +# is set to on, so that the MS .lib files are created. # Usage is as follows: -# cmake_add_fortran_subdirectory( -# # name of subdirectory -# PROJECT # project name in sbudir toplevel CMakeLists.txt -# ARCHIVE_DIR # dir where project places .lib files -# RUNTIME_DIR # dir where project places .dll files -# LIBRARIES lib2 lib2 # names of libraries created and exported -# LINK_LIBRARIES # link interface libraries for LIBRARIES -# LINK_LIBS ... -# LINK_LIBS ... -# CMAKE_COMMAND_LINE # extra command line flags to pass to cmake +# cmake_add_fortran_subdirectory( +# # name of subdirectory +# PROJECT # project name in subdir top CMakeLists.txt +# ARCHIVE_DIR # dir where project places .lib files +# RUNTIME_DIR # dir where project places .dll files +# LIBRARIES ... # names of library targets to import +# LINK_LIBRARIES # link interface libraries for LIBRARIES +# [LINK_LIBS ...]... +# CMAKE_COMMAND_LINE ... # extra command line flags to pass to cmake # ) # Relative paths in ARCHIVE_DIR and RUNTIME_DIR are interpreted with respect # to the build directory corresponding to the source directory in which the # function is invoked. -# #============================================================================= -# Copyright 2002-2009 Kitware, Inc. +# Copyright 2011 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. -- cgit v0.12 From 7e0d9f15d626c13b452bc213172cd54c24f5b41a Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 15 Dec 2011 10:50:55 -0500 Subject: CMakeAddFortranSubdirectory: Find gfortran in PATH In the find_program(MINGW_GFORTRAN) call use the PATHS option for hard-coded guesses instead of HINTS. This allows the user environment to override the guesses and corrects usage of the command options. --- Modules/CMakeAddFortranSubdirectory.cmake | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake index 10935a8..d36738c 100644 --- a/Modules/CMakeAddFortranSubdirectory.cmake +++ b/Modules/CMakeAddFortranSubdirectory.cmake @@ -44,10 +44,13 @@ include(ExternalProject) include(CMakeParseArguments) function(_setup_mingw_config_and_build source_dir) - find_program(MINGW_GFORTRAN NAMES gfortran - HINTS - c:/MinGW/bin - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MinGW;InstallLocation]/bin" ) + # Look for a MinGW gfortran. + find_program(MINGW_GFORTRAN + NAMES gfortran + PATHS + c:/MinGW/bin + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MinGW;InstallLocation]/bin" + ) if(NOT MINGW_GFORTRAN) message(FATAL_ERROR "gfortran not found, please install MinGW with the gfortran option." -- cgit v0.12 From 414a780d1c22339e924ea3d880e54482f0d67898 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 15 Dec 2011 11:39:42 -0500 Subject: CMakeAddFortranSubdirectory: Validate gfortran architecture Verify that MINGW_GFORTRAN not only points to a MinGW gfortran but also one that compiles for the target architecture. This prevents using a 32-bit gfortran in a 64-bit MSVC build. --- Modules/CMakeAddFortranSubdirectory.cmake | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake index d36738c..c846b55 100644 --- a/Modules/CMakeAddFortranSubdirectory.cmake +++ b/Modules/CMakeAddFortranSubdirectory.cmake @@ -57,12 +57,28 @@ function(_setup_mingw_config_and_build source_dir) "Or set the cache variable MINGW_GFORTRAN to the full path. " " This is required to build") endif() - execute_process(COMMAND ${MINGW_GFORTRAN} -v ERROR_VARIABLE out) - if(NOT "${out}" MATCHES "Target:.*mingw32") - message(FATAL_ERROR "Non-MinGW gfortran found: ${MINGW_GFORTRAN}\n" - "output from -v [${out}]\n" - "set MINGW_GFORTRAN to the path to MinGW fortran.") + + # Validate the MinGW gfortran we found. + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(_mingw_target "Target:.*64.*mingw") + else() + set(_mingw_target "Target:.*mingw32") endif() + execute_process(COMMAND "${MINGW_GFORTRAN}" -v + ERROR_VARIABLE out ERROR_STRIP_TRAILING_WHITESPACE) + if(NOT "${out}" MATCHES "${_mingw_target}") + string(REPLACE "\n" "\n " out " ${out}") + message(FATAL_ERROR + "MINGW_GFORTRAN is set to\n" + " ${MINGW_GFORTRAN}\n" + "which is not a MinGW gfortran for this architecture. " + "The output from -v does not match \"${_mingw_target}\":\n" + "${out}\n" + "Set MINGW_GFORTRAN to a proper MinGW gfortran for this architecture." + ) + endif() + + # Configure scripts to run MinGW tools with the proper PATH. get_filename_component(MINGW_PATH ${MINGW_GFORTRAN} PATH) file(TO_NATIVE_PATH "${MINGW_PATH}" MINGW_PATH) string(REPLACE "\\" "\\\\" MINGW_PATH "${MINGW_PATH}") -- cgit v0.12 From bd69e1c567cc4fc1bf30d321d888dd2567d82e7a Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 16 Dec 2011 17:01:19 -0500 Subject: VSGNUFortran: Add special case for SunPro Fortran runtime library The SunPro compiler does not add the fortran runtime library when creating a shared fortran library. Link to the SunPro Fortran runtime libraries explicitly. --- Tests/VSGNUFortran/fortran/CMakeLists.txt | 36 ++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/Tests/VSGNUFortran/fortran/CMakeLists.txt b/Tests/VSGNUFortran/fortran/CMakeLists.txt index ff22993..3ee1855 100644 --- a/Tests/VSGNUFortran/fortran/CMakeLists.txt +++ b/Tests/VSGNUFortran/fortran/CMakeLists.txt @@ -1,12 +1,46 @@ cmake_minimum_required(VERSION 2.8) project(FortranHello Fortran C) +# add a function to test for -lsunquad on sunpro sun systems. +function(test_sunquad result) + set( TEST_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/sunq") + file(WRITE "${TEST_DIR}/testsunq.f" " + PROGRAM TEST + END + ") + file(WRITE ${TEST_DIR}/CMakeLists.txt " +project(sunq Fortran) +add_library(sunq SHARED testsunq.f) +target_link_libraries(sunq sunquad) +") + message(STATUS "looking for -lsunquad") + try_compile(RESULT "${TEST_DIR}" "${TEST_DIR}" sunq OUTPUT_VARIABLE OUT) + if("${RESULT}") + message(STATUS "-lsunquad found") + else() + message(STATUS "-lsunquad not found") + endif() + message(STATUS + "looking for sunquad:\nRESULT=[${RESULT}]\nOUTPUT=[\n${OUT}\n]") + set(${result} "${RESULT}" PARENT_SCOPE) +endfunction() + +# check for the fortran c interface mangling include(FortranCInterface) FortranCInterface_HEADER(HelloWorldFCMangle.h MACRO_NAMESPACE "FC_" SYMBOL_NAMESPACE "FC_" SYMBOLS hello world) - add_library(hello SHARED hello.f) add_library(world SHARED world.f) target_link_libraries(hello world) +if(CMAKE_Fortran_COMPILER_ID MATCHES SunPro) + target_link_libraries(hello fsu) + if(CMAKE_Fortran_PLATFORM_ID MATCHES SunOS) + target_link_libraries(hello sunmath m) + test_sunquad(CMAKE_HAS_SUNQUAD) + if(CMAKE_HAS_SUNQUAD) + target_link_libraries(hello sunquad) + endif() + endif() +endif() -- cgit v0.12 From 067c1f44a80ed8fb32e56918a57437142c64b049 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 16 Dec 2011 18:20:46 -0500 Subject: VSGNUFortran: Disable test in special cases The ifort compiler found on some test machines does not support Mac universal binaries or the Linux Standard Base. --- Tests/CMakeLists.txt | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index e949887..9c97828 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -170,7 +170,24 @@ IF(BUILD_TESTING) # or in some cases you might need to set the PATH so that cmake can find # the gfortran from mingw. IF(CMAKE_Fortran_COMPILER OR CMAKE_TEST_CMAKE_ADD_FORTRAN) - ADD_TEST_MACRO(VSGNUFortran ${CMAKE_COMMAND} -P runtest.cmake) + SET(CMAKE_SKIP_VSGNUFortran FALSE) + # disable test for apple builds using ifort if they are building + # more than one architecture, as ifort does not support that. + IF(APPLE AND (CMAKE_Fortran_COMPILER MATCHES ifort)) + LIST(LENGTH CMAKE_OSX_ARCHITECTURES len) + IF("${len}" GREATER 1) + MESSAGE(STATUS "Skip VSGNUFortran for ifort dual cpu mac build") + SET(CMAKE_SKIP_VSGNUFortran TRUE) + ENDIF() + ENDIF() + IF((CMAKE_C_COMPILER MATCHES lsb) + AND (CMAKE_Fortran_COMPILER MATCHES ifort)) + MESSAGE(STATUS "Skip VSGNUFortran for ifort and lsb compilers") + SET(CMAKE_SKIP_VSGNUFortran TRUE) + ENDIF() + IF(NOT CMAKE_SKIP_VSGNUFortran) + ADD_TEST_MACRO(VSGNUFortran ${CMAKE_COMMAND} -P runtest.cmake) + ENDIF() ENDIF() ADD_TEST_MACRO(COnly COnly) ADD_TEST_MACRO(CxxOnly CxxOnly) -- cgit v0.12 From 48a09f82ccadf93eb2d60c9efe5da783327a8520 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 27 Jan 2012 11:14:00 -0500 Subject: CMakeAddFortranSubdirectory: Make IMPORTED targets GLOBAL cmake_add_fortran_directory uses imported targets when using the mingw fortran compiler. This change makes those targets global in scope so they act just like the real targets that exist when a fortran compiler exists and regular add_subdirectory is used. --- Modules/CMakeAddFortranSubdirectory.cmake | 4 +-- Tests/VSGNUFortran/CMakeLists.txt | 19 ++-------- Tests/VSGNUFortran/fortran/CMakeLists.txt | 46 ------------------------ Tests/VSGNUFortran/fortran/hello.f | 7 ---- Tests/VSGNUFortran/fortran/world.f | 6 ---- Tests/VSGNUFortran/subdir/CMakeLists.txt | 15 ++++++++ Tests/VSGNUFortran/subdir/fortran/CMakeLists.txt | 46 ++++++++++++++++++++++++ Tests/VSGNUFortran/subdir/fortran/hello.f | 7 ++++ Tests/VSGNUFortran/subdir/fortran/world.f | 6 ++++ 9 files changed, 78 insertions(+), 78 deletions(-) delete mode 100644 Tests/VSGNUFortran/fortran/CMakeLists.txt delete mode 100644 Tests/VSGNUFortran/fortran/hello.f delete mode 100644 Tests/VSGNUFortran/fortran/world.f create mode 100644 Tests/VSGNUFortran/subdir/CMakeLists.txt create mode 100644 Tests/VSGNUFortran/subdir/fortran/CMakeLists.txt create mode 100644 Tests/VSGNUFortran/subdir/fortran/hello.f create mode 100644 Tests/VSGNUFortran/subdir/fortran/world.f diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake index c846b55..5c3e9a2 100644 --- a/Modules/CMakeAddFortranSubdirectory.cmake +++ b/Modules/CMakeAddFortranSubdirectory.cmake @@ -25,7 +25,7 @@ # function is invoked. #============================================================================= -# Copyright 2011 Kitware, Inc. +# Copyright 2011-2012 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -151,7 +151,7 @@ function(cmake_add_fortran_subdirectory subdir) ) # create imported targets for all libraries foreach(lib ${libraries}) - add_library(${lib} SHARED IMPORTED) + add_library(${lib} SHARED IMPORTED GLOBAL) set_property(TARGET ${lib} APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG) set_target_properties(${lib} PROPERTIES IMPORTED_IMPLIB_NOCONFIG "${library_dir}/lib${lib}.lib" diff --git a/Tests/VSGNUFortran/CMakeLists.txt b/Tests/VSGNUFortran/CMakeLists.txt index 422350a..229c315 100644 --- a/Tests/VSGNUFortran/CMakeLists.txt +++ b/Tests/VSGNUFortran/CMakeLists.txt @@ -17,23 +17,8 @@ if(CMAKE_CONFIGURATION_TYPES) endforeach() endif() -include(CMakeAddFortranSubdirectory) -# add the fortran subdirectory as a fortran project -# the subdir is fortran, the project is FortranHello -cmake_add_fortran_subdirectory(fortran - PROJECT FortranHello # project name in toplevel CMakeLists.txt - ARCHIVE_DIR ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} - RUNTIME_DIR bin # ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - LIBRARIES hello world # target libraries created - CMAKE_COMMAND_LINE - -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} - -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - LINK_LIBRARIES # link interface libraries - LINK_LIBS hello world # hello needs world to link - ) - -include_directories(${VSGNUFortran_BINARY_DIR}/fortran) +add_subdirectory(subdir) +include_directories(${VSGNUFortran_BINARY_DIR}/subdir/fortran) add_subdirectory(c_code) # use a cmake script to run the executable so that PATH # can be set with the MinGW/bin in it, and the fortran diff --git a/Tests/VSGNUFortran/fortran/CMakeLists.txt b/Tests/VSGNUFortran/fortran/CMakeLists.txt deleted file mode 100644 index 3ee1855..0000000 --- a/Tests/VSGNUFortran/fortran/CMakeLists.txt +++ /dev/null @@ -1,46 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -project(FortranHello Fortran C) - -# add a function to test for -lsunquad on sunpro sun systems. -function(test_sunquad result) - set( TEST_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/sunq") - file(WRITE "${TEST_DIR}/testsunq.f" " - PROGRAM TEST - END - ") - file(WRITE ${TEST_DIR}/CMakeLists.txt " -project(sunq Fortran) -add_library(sunq SHARED testsunq.f) -target_link_libraries(sunq sunquad) -") - message(STATUS "looking for -lsunquad") - try_compile(RESULT "${TEST_DIR}" "${TEST_DIR}" sunq OUTPUT_VARIABLE OUT) - if("${RESULT}") - message(STATUS "-lsunquad found") - else() - message(STATUS "-lsunquad not found") - endif() - message(STATUS - "looking for sunquad:\nRESULT=[${RESULT}]\nOUTPUT=[\n${OUT}\n]") - set(${result} "${RESULT}" PARENT_SCOPE) -endfunction() - -# check for the fortran c interface mangling -include(FortranCInterface) -FortranCInterface_HEADER(HelloWorldFCMangle.h - MACRO_NAMESPACE "FC_" - SYMBOL_NAMESPACE "FC_" - SYMBOLS hello world) -add_library(hello SHARED hello.f) -add_library(world SHARED world.f) -target_link_libraries(hello world) -if(CMAKE_Fortran_COMPILER_ID MATCHES SunPro) - target_link_libraries(hello fsu) - if(CMAKE_Fortran_PLATFORM_ID MATCHES SunOS) - target_link_libraries(hello sunmath m) - test_sunquad(CMAKE_HAS_SUNQUAD) - if(CMAKE_HAS_SUNQUAD) - target_link_libraries(hello sunquad) - endif() - endif() -endif() diff --git a/Tests/VSGNUFortran/fortran/hello.f b/Tests/VSGNUFortran/fortran/hello.f deleted file mode 100644 index e52119a..0000000 --- a/Tests/VSGNUFortran/fortran/hello.f +++ /dev/null @@ -1,7 +0,0 @@ -!DEC$ ATTRIBUTES DLLEXPORT :: HELLO - SUBROUTINE HELLO - - PRINT *, 'Hello' - CALL WORLD - - END diff --git a/Tests/VSGNUFortran/fortran/world.f b/Tests/VSGNUFortran/fortran/world.f deleted file mode 100644 index 0598eee..0000000 --- a/Tests/VSGNUFortran/fortran/world.f +++ /dev/null @@ -1,6 +0,0 @@ -!DEC$ ATTRIBUTES DLLEXPORT :: WORLD - SUBROUTINE WORLD - - PRINT *, 'World!' - - END diff --git a/Tests/VSGNUFortran/subdir/CMakeLists.txt b/Tests/VSGNUFortran/subdir/CMakeLists.txt new file mode 100644 index 0000000..df018b3 --- /dev/null +++ b/Tests/VSGNUFortran/subdir/CMakeLists.txt @@ -0,0 +1,15 @@ +include(CMakeAddFortranSubdirectory) +# add the fortran subdirectory as a fortran project +# the subdir is fortran, the project is FortranHello +cmake_add_fortran_subdirectory(fortran + PROJECT FortranHello # project name in toplevel CMakeLists.txt + ARCHIVE_DIR ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} + RUNTIME_DIR bin # ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + LIBRARIES hello world # target libraries created + CMAKE_COMMAND_LINE + -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} + -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + LINK_LIBRARIES # link interface libraries + LINK_LIBS hello world # hello needs world to link + ) diff --git a/Tests/VSGNUFortran/subdir/fortran/CMakeLists.txt b/Tests/VSGNUFortran/subdir/fortran/CMakeLists.txt new file mode 100644 index 0000000..3ee1855 --- /dev/null +++ b/Tests/VSGNUFortran/subdir/fortran/CMakeLists.txt @@ -0,0 +1,46 @@ +cmake_minimum_required(VERSION 2.8) +project(FortranHello Fortran C) + +# add a function to test for -lsunquad on sunpro sun systems. +function(test_sunquad result) + set( TEST_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/sunq") + file(WRITE "${TEST_DIR}/testsunq.f" " + PROGRAM TEST + END + ") + file(WRITE ${TEST_DIR}/CMakeLists.txt " +project(sunq Fortran) +add_library(sunq SHARED testsunq.f) +target_link_libraries(sunq sunquad) +") + message(STATUS "looking for -lsunquad") + try_compile(RESULT "${TEST_DIR}" "${TEST_DIR}" sunq OUTPUT_VARIABLE OUT) + if("${RESULT}") + message(STATUS "-lsunquad found") + else() + message(STATUS "-lsunquad not found") + endif() + message(STATUS + "looking for sunquad:\nRESULT=[${RESULT}]\nOUTPUT=[\n${OUT}\n]") + set(${result} "${RESULT}" PARENT_SCOPE) +endfunction() + +# check for the fortran c interface mangling +include(FortranCInterface) +FortranCInterface_HEADER(HelloWorldFCMangle.h + MACRO_NAMESPACE "FC_" + SYMBOL_NAMESPACE "FC_" + SYMBOLS hello world) +add_library(hello SHARED hello.f) +add_library(world SHARED world.f) +target_link_libraries(hello world) +if(CMAKE_Fortran_COMPILER_ID MATCHES SunPro) + target_link_libraries(hello fsu) + if(CMAKE_Fortran_PLATFORM_ID MATCHES SunOS) + target_link_libraries(hello sunmath m) + test_sunquad(CMAKE_HAS_SUNQUAD) + if(CMAKE_HAS_SUNQUAD) + target_link_libraries(hello sunquad) + endif() + endif() +endif() diff --git a/Tests/VSGNUFortran/subdir/fortran/hello.f b/Tests/VSGNUFortran/subdir/fortran/hello.f new file mode 100644 index 0000000..e52119a --- /dev/null +++ b/Tests/VSGNUFortran/subdir/fortran/hello.f @@ -0,0 +1,7 @@ +!DEC$ ATTRIBUTES DLLEXPORT :: HELLO + SUBROUTINE HELLO + + PRINT *, 'Hello' + CALL WORLD + + END diff --git a/Tests/VSGNUFortran/subdir/fortran/world.f b/Tests/VSGNUFortran/subdir/fortran/world.f new file mode 100644 index 0000000..0598eee --- /dev/null +++ b/Tests/VSGNUFortran/subdir/fortran/world.f @@ -0,0 +1,6 @@ +!DEC$ ATTRIBUTES DLLEXPORT :: WORLD + SUBROUTINE WORLD + + PRINT *, 'World!' + + END -- cgit v0.12 From 6f6891b33736918f149279dc7d1e9ade50efd917 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 8 Feb 2012 11:55:07 -0500 Subject: CMakeAddFortranSubdirectory: Always parse arguments Parse arguments even in add_subdirectory() mode to validate them. --- Modules/CMakeAddFortranSubdirectory.cmake | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake index 5c3e9a2..681b09e 100644 --- a/Modules/CMakeAddFortranSubdirectory.cmake +++ b/Modules/CMakeAddFortranSubdirectory.cmake @@ -99,6 +99,11 @@ endfunction() function(cmake_add_fortran_subdirectory subdir) + # Parse arguments to function + set(oneValueArgs PROJECT ARCHIVE_DIR RUNTIME_DIR) + set(multiValueArgs LIBRARIES LINK_LIBRARIES CMAKE_COMMAND_LINE) + cmake_parse_arguments(ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + # if we are not using MSVC without fortran support # then just use the usual add_subdirectory to build # the fortran library @@ -111,10 +116,6 @@ function(cmake_add_fortran_subdirectory subdir) # if we have MSVC without Intel fortran then setup # external projects to build with mingw fortran - # Parse arguments to function - set(oneValueArgs PROJECT ARCHIVE_DIR RUNTIME_DIR) - set(multiValueArgs LIBRARIES LINK_LIBRARIES CMAKE_COMMAND_LINE) - cmake_parse_arguments(ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) set(source_dir "${CMAKE_CURRENT_SOURCE_DIR}/${subdir}") set(project_name "${ARGS_PROJECT}") set(library_dir "${ARGS_ARCHIVE_DIR}") -- cgit v0.12 From 1e16406dc9a8c5bdad7adbed8c3b6cee0a7020d0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 8 Feb 2012 11:58:57 -0500 Subject: CMakeAddFortranSubdirectory: Add NO_EXTERNAL_INSTALL option We do not yet support "make install" in the external project case. Document this explicitly in the interface. Require the caller to use an option to "disable" the unsupported behavior. This will allow us to add the behavior by default in the future without clobbering existing projects that handle the installation themselves. --- Modules/CMakeAddFortranSubdirectory.cmake | 16 +++++++++++++++- Tests/VSGNUFortran/subdir/CMakeLists.txt | 3 ++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake index 681b09e..ddb79fb 100644 --- a/Modules/CMakeAddFortranSubdirectory.cmake +++ b/Modules/CMakeAddFortranSubdirectory.cmake @@ -19,10 +19,17 @@ # LINK_LIBRARIES # link interface libraries for LIBRARIES # [LINK_LIBS ...]... # CMAKE_COMMAND_LINE ... # extra command line flags to pass to cmake +# NO_EXTERNAL_INSTALL # skip installation of external project # ) # Relative paths in ARCHIVE_DIR and RUNTIME_DIR are interpreted with respect # to the build directory corresponding to the source directory in which the # function is invoked. +# +# Limitations: +# +# NO_EXTERNAL_INSTALL is required for forward compatibility with a +# future version that supports installation of the external project +# binaries during "make install". #============================================================================= # Copyright 2011-2012 Kitware, Inc. @@ -100,9 +107,16 @@ endfunction() function(cmake_add_fortran_subdirectory subdir) # Parse arguments to function + set(options NO_EXTERNAL_INSTALL) set(oneValueArgs PROJECT ARCHIVE_DIR RUNTIME_DIR) set(multiValueArgs LIBRARIES LINK_LIBRARIES CMAKE_COMMAND_LINE) - cmake_parse_arguments(ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + if(NOT ARGS_NO_EXTERNAL_INSTALL) + message(FATAL_ERROR + "Option NO_EXTERNAL_INSTALL is required (for forward compatibility) " + "but was not given." + ) + endif() # if we are not using MSVC without fortran support # then just use the usual add_subdirectory to build diff --git a/Tests/VSGNUFortran/subdir/CMakeLists.txt b/Tests/VSGNUFortran/subdir/CMakeLists.txt index df018b3..0b99199 100644 --- a/Tests/VSGNUFortran/subdir/CMakeLists.txt +++ b/Tests/VSGNUFortran/subdir/CMakeLists.txt @@ -12,4 +12,5 @@ cmake_add_fortran_subdirectory(fortran -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} LINK_LIBRARIES # link interface libraries LINK_LIBS hello world # hello needs world to link - ) + NO_EXTERNAL_INSTALL + ) -- cgit v0.12 From ed14435b232a7e76678716b5a2a6694e7cade66c Mon Sep 17 00:00:00 2001 From: Artur Kedzierski Date: Thu, 9 Feb 2012 09:09:54 -0500 Subject: Add CURL_CA_BUNDLE option for SSL support (#12946) This adds the ability to specify the location of SSL CA bundle at compile time. --- Utilities/cmcurl/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index 7030b2e..1d50914 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -190,6 +190,11 @@ IF(CMAKE_USE_OPENSSL) CHECK_LIBRARY_EXISTS_CONCAT("crypto" CRYPTO_lock HAVE_LIBCRYPTO) CHECK_LIBRARY_EXISTS_CONCAT("ssl" SSL_connect HAVE_LIBSSL) ENDIF(WIN32) + SET(CURL_CA_BUNDLE "" CACHE FILEPATH "Path to SSL CA Certificate Bundle") + MARK_AS_ADVANCED(CURL_CA_BUNDLE) + IF(CURL_CA_BUNDLE) + ADD_DEFINITIONS(-DCURL_CA_BUNDLE="${CURL_CA_BUNDLE}") + ENDIF(CURL_CA_BUNDLE) ENDIF(CMAKE_USE_OPENSSL) # Check for idn -- cgit v0.12 From 9fb9416f78a83c59e1260ec1ec0699618be1b95f Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Thu, 9 Feb 2012 20:33:58 -0500 Subject: Use upgraded qt on linux build machine. --- Utilities/Release/magrathea_release.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/Release/magrathea_release.cmake b/Utilities/Release/magrathea_release.cmake index 549460e..1b2ae02 100644 --- a/Utilities/Release/magrathea_release.cmake +++ b/Utilities/Release/magrathea_release.cmake @@ -10,7 +10,7 @@ CURSES_INCLUDE_PATH:PATH=/usr/i686-gcc-332s/include/ncurses FORM_LIBRARY:FILEPATH=/usr/i686-gcc-332s/lib/libform.a CPACK_SYSTEM_NAME:STRING=Linux-i386 BUILD_QtDialog:BOOL:=TRUE -QT_QMAKE_EXECUTABLE:FILEPATH=/home/kitware/qt-x11-opensource-src-4.3.3-install/bin/qmake +QT_QMAKE_EXECUTABLE:FILEPATH=/home/kitware/qt-4.43-install/bin/qmake ") get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH) include(${path}/release_cmake.cmake) -- cgit v0.12 From 0fcf69d72f113a989df43973e05c039e4bbd3d33 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Fri, 10 Feb 2012 00:05:05 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 7b31670..13de8a0 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 09) +SET(KWSYS_DATE_STAMP_DAY 10) -- cgit v0.12 From ca7790240cf63cd6f449cbde2d8b9866bd22c7d8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 10 Feb 2012 15:16:06 -0500 Subject: libarchive: Workaround mbsnrtowcs assertion failure on old glibc The CMake TarTest fails with the error mbsnrtowcs.c:116: __mbsnrtowcs: Assertion `status == GCONV_OK || status != GCONV_EMPTY_INPUT || status == GCONV_ILLEGAL_INPUT || status == GCONV_INCOMPLETE_INPUT || status == GCONV_FULL_OUTPUT' failed. on very old glibc versions. Work around the problem by pretending that mbsnrtowcs does not exist. Libarchive will fall back to mbrtowc. --- Utilities/cmlibarchive/libarchive/archive_platform.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Utilities/cmlibarchive/libarchive/archive_platform.h b/Utilities/cmlibarchive/libarchive/archive_platform.h index ce2f482..cdd9c7c 100644 --- a/Utilities/cmlibarchive/libarchive/archive_platform.h +++ b/Utilities/cmlibarchive/libarchive/archive_platform.h @@ -76,6 +76,11 @@ #define __FBSDID(a) struct _undefined_hack #endif +/* Old glibc mbsnrtowcs fails assertions in our use case. */ +#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ <= 1 +# undef HAVE_MBSNRTOWCS +#endif + /* Try to get standard C99-style integer type definitions. */ #if HAVE_INTTYPES_H #include -- cgit v0.12 From 677047dda0620fa675bcc1a8bacde5388ad954c3 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sat, 11 Feb 2012 00:05:07 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 13de8a0..efbc816 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 10) +SET(KWSYS_DATE_STAMP_DAY 11) -- cgit v0.12 From a6de8a58822a70182e58ead76a1b308e11350bff Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Sat, 11 Feb 2012 17:08:51 +0100 Subject: FindSDL*: use FPHSA (#12467) --- Modules/FindSDL.cmake | 10 +++------- Modules/FindSDL_image.cmake | 7 +++---- Modules/FindSDL_mixer.cmake | 7 +++---- Modules/FindSDL_net.cmake | 7 +++---- Modules/FindSDL_sound.cmake | 6 +++--- Modules/FindSDL_ttf.cmake | 7 +++---- 6 files changed, 18 insertions(+), 26 deletions(-) diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake index 0dc02f5..1c04726 100644 --- a/Modules/FindSDL.cmake +++ b/Modules/FindSDL.cmake @@ -81,7 +81,6 @@ FIND_PATH(SDL_INCLUDE_DIR SDL.h /opt/csw # Blastwave /opt ) -#MESSAGE("SDL_INCLUDE_DIR is ${SDL_INCLUDE_DIR}") # SDL-1.1 is the name used by FreeBSD ports... # don't confuse it for the version number. @@ -97,8 +96,6 @@ FIND_LIBRARY(SDL_LIBRARY_TEMP /opt ) -#MESSAGE("SDL_LIBRARY_TEMP is ${SDL_LIBRARY_TEMP}") - IF(NOT SDL_BUILDING_LIBRARY) IF(NOT ${SDL_INCLUDE_DIR} MATCHES ".framework") # Non-OS X framework versions expect you to also dynamically link to @@ -134,7 +131,6 @@ IF(MINGW) SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW") ENDIF(MINGW) -SET(SDL_FOUND "NO") IF(SDL_LIBRARY_TEMP) # For SDLmain IF(NOT SDL_BUILDING_LIBRARY) @@ -169,9 +165,9 @@ IF(SDL_LIBRARY_TEMP) SET(SDL_LIBRARY ${SDL_LIBRARY_TEMP} CACHE STRING "Where the SDL Library can be found") # Set the temp variable to INTERNAL so it is not seen in the CMake GUI SET(SDL_LIBRARY_TEMP "${SDL_LIBRARY_TEMP}" CACHE INTERNAL "") - - SET(SDL_FOUND "YES") ENDIF(SDL_LIBRARY_TEMP) -#MESSAGE("SDL_LIBRARY is ${SDL_LIBRARY}") +INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL + REQUIRED_VARS SDL_LIBRARY SDL_INCLUDE_DIR) diff --git a/Modules/FindSDL_image.cmake b/Modules/FindSDL_image.cmake index 5a5f59b..9a130fa 100644 --- a/Modules/FindSDL_image.cmake +++ b/Modules/FindSDL_image.cmake @@ -68,8 +68,7 @@ FIND_LIBRARY(SDLIMAGE_LIBRARY /opt ) -SET(SDLIMAGE_FOUND "NO") -IF(SDLIMAGE_LIBRARY AND SDLIMAGE_INCLUDE_DIR) - SET(SDLIMAGE_FOUND "YES") -ENDIF(SDLIMAGE_LIBRARY AND SDLIMAGE_INCLUDE_DIR) +INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDLIMAGE + REQUIRED_VARS SDLIMAGE_LIBRARY SDLIMAGE_INCLUDE_DIR) diff --git a/Modules/FindSDL_mixer.cmake b/Modules/FindSDL_mixer.cmake index e2b2294..ce1ae9e 100644 --- a/Modules/FindSDL_mixer.cmake +++ b/Modules/FindSDL_mixer.cmake @@ -68,8 +68,7 @@ FIND_LIBRARY(SDLMIXER_LIBRARY /opt ) -SET(SDLMIXER_FOUND "NO") -IF(SDLMIXER_LIBRARY AND SDLMIXER_INCLUDE_DIR) - SET(SDLMIXER_FOUND "YES") -ENDIF(SDLMIXER_LIBRARY AND SDLMIXER_INCLUDE_DIR) +INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDLMIXER + REQUIRED_VARS SDLMIXER_LIBRARY SDLMIXER_INCLUDE_DIR) diff --git a/Modules/FindSDL_net.cmake b/Modules/FindSDL_net.cmake index 730b129..b5ada54 100644 --- a/Modules/FindSDL_net.cmake +++ b/Modules/FindSDL_net.cmake @@ -67,8 +67,7 @@ FIND_LIBRARY(SDLNET_LIBRARY /opt ) -SET(SDLNET_FOUND "NO") -IF(SDLNET_LIBRARY AND SDLNET_INCLUDE_DIR) - SET(SDLNET_FOUND "YES") -ENDIF(SDLNET_LIBRARY AND SDLNET_INCLUDE_DIR) +INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDLNET + REQUIRED_VARS SDLNET_LIBRARY SDLNET_INCLUDE_DIR) diff --git a/Modules/FindSDL_sound.cmake b/Modules/FindSDL_sound.cmake index 959f3eb..8edf6ca 100644 --- a/Modules/FindSDL_sound.cmake +++ b/Modules/FindSDL_sound.cmake @@ -114,7 +114,6 @@ FIND_LIBRARY(SDL_SOUND_LIBRARY /opt/lib ) -SET(SDL_SOUND_FOUND "NO") IF(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) # CMake is giving me problems using TRY_COMPILE with the CMAKE_FLAGS @@ -414,8 +413,9 @@ IF(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) ENDIF(NOT MY_RESULT) SET(SDL_SOUND_LIBRARIES "${SDL_SOUND_EXTRAS} ${SDL_SOUND_LIBRARIES_TMP}" CACHE INTERNAL "SDL_sound and dependent libraries") - SET(SDL_SOUND_FOUND "YES") ENDIF(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) - # MESSAGE("SDL_SOUND_LIBRARIES is ${SDL_SOUND_LIBRARIES}") +INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_SOUND + REQUIRED_VARS SDL_SOUND_LIBRARIES SDL_SOUND_INCLUDE_DIR) diff --git a/Modules/FindSDL_ttf.cmake b/Modules/FindSDL_ttf.cmake index b36ddd3..3d07ab7 100644 --- a/Modules/FindSDL_ttf.cmake +++ b/Modules/FindSDL_ttf.cmake @@ -68,8 +68,7 @@ FIND_LIBRARY(SDLTTF_LIBRARY PATH_SUFFIXES lib64 lib ) -SET(SDLTTF_FOUND "NO") -IF(SDLTTF_LIBRARY AND SDLTTF_INCLUDE_DIR) - SET(SDLTTF_FOUND "YES") -ENDIF(SDLTTF_LIBRARY AND SDLTTF_INCLUDE_DIR) +INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDLTTF + REQUIRED_VARS SDLTTF_LIBRARY SDLTTF_INCLUDE_DIR) -- cgit v0.12 From e6c5b9452a0e49d93e775169bb5bf63ea016df5e Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Sat, 11 Feb 2012 18:04:26 +0100 Subject: fix FeatureSummary for REQUIRED packages, they were reported as OPTIONAL Alex --- Source/cmFindPackageCommand.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 7d3f09b..22bb628 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -1226,6 +1226,15 @@ void cmFindPackageCommand::AppendSuccessInformation() } this->Makefile->GetCMakeInstance()->SetProperty(versionInfoPropName.c_str(), versionInfo.c_str()); + if (this->Required) + { + std::string requiredInfoPropName = "_CMAKE_"; + requiredInfoPropName += this->Name; + requiredInfoPropName += "_TYPE"; + this->Makefile->GetCMakeInstance()->SetProperty( + requiredInfoPropName.c_str(), "REQUIRED"); + } + // Restore original state of "_FIND_" variables we set. this->RestoreFindDefinitions(); -- cgit v0.12 From 815485e9333e07fbbac66bfc415fa2ae5cbe8a85 Mon Sep 17 00:00:00 2001 From: Philip Lowman Date: Sat, 11 Feb 2012 18:51:22 -0500 Subject: FindALSA: Fix incorrect include path detection This fixes a bug where the alsa include path was being detected incorrectly (e.g. /usr/local/include/alsa instead of /usr/local/include) --- Modules/FindALSA.cmake | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Modules/FindALSA.cmake b/Modules/FindALSA.cmake index ec6e3a8..41c4e30 100644 --- a/Modules/FindALSA.cmake +++ b/Modules/FindALSA.cmake @@ -12,8 +12,8 @@ # #============================================================================= -# Copyright 2009 Kitware, Inc. -# Copyright 2009 Philip Lowman +# Copyright 2009-2011 Kitware, Inc. +# Copyright 2009-2011 Philip Lowman # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -25,8 +25,9 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -find_path(ALSA_INCLUDE_DIR NAMES asoundlib.h - PATH_SUFFIXES alsa +# Try to find asoundlib.h both in /include/alsa and /include +# since older versions of ALSA put it in include directly +find_path(ALSA_INCLUDE_DIR NAMES alsa/asoundlib.h asoundlib.h DOC "The ALSA (asound) include directory" ) -- cgit v0.12 From 11cf52ebce8ee9bef4e79cfee3043016387f75b0 Mon Sep 17 00:00:00 2001 From: Philip Lowman Date: Sat, 11 Feb 2012 20:37:48 -0500 Subject: FindALSA: Fix version detection after last commit Also, removed detection of header file from /include. Can't find any example in alsa source code where the library headers were installed outside of /include/alsa. --- Modules/FindALSA.cmake | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Modules/FindALSA.cmake b/Modules/FindALSA.cmake index 41c4e30..4a0b693 100644 --- a/Modules/FindALSA.cmake +++ b/Modules/FindALSA.cmake @@ -25,9 +25,7 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -# Try to find asoundlib.h both in /include/alsa and /include -# since older versions of ALSA put it in include directly -find_path(ALSA_INCLUDE_DIR NAMES alsa/asoundlib.h asoundlib.h +find_path(ALSA_INCLUDE_DIR NAMES alsa/asoundlib.h DOC "The ALSA (asound) include directory" ) @@ -35,8 +33,8 @@ find_library(ALSA_LIBRARY NAMES asound DOC "The ALSA (asound) library" ) -if(ALSA_INCLUDE_DIR AND EXISTS "${ALSA_INCLUDE_DIR}/version.h") - file(STRINGS "${ALSA_INCLUDE_DIR}/version.h" alsa_version_str REGEX "^#define[\t ]+SND_LIB_VERSION_STR[\t ]+\".*\"") +if(ALSA_INCLUDE_DIR AND EXISTS "${ALSA_INCLUDE_DIR}/alsa/version.h") + file(STRINGS "${ALSA_INCLUDE_DIR}/alsa/version.h" alsa_version_str REGEX "^#define[\t ]+SND_LIB_VERSION_STR[\t ]+\".*\"") string(REGEX REPLACE "^.*SND_LIB_VERSION_STR[\t ]+\"([^\"]*)\".*$" "\\1" ALSA_VERSION_STRING "${alsa_version_str}") unset(alsa_version_str) -- cgit v0.12 From 62952bc9b451b2b658c20756fc4c714945d84b45 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sun, 12 Feb 2012 00:05:07 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index efbc816..ef0add7 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 11) +SET(KWSYS_DATE_STAMP_DAY 12) -- cgit v0.12 From 9b4e4c92aeae15f58438e3bb9846242daafcfc9c Mon Sep 17 00:00:00 2001 From: Matthias Kretz Date: Sun, 12 Feb 2012 10:42:54 +0100 Subject: Improve checks for Open64 and g++ incompatible flags (#12119) --- Modules/CheckCCompilerFlag.cmake | 2 ++ Modules/CheckCXXCompilerFlag.cmake | 3 +++ 2 files changed, 5 insertions(+) diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake index 5380f4d..3618bdf 100644 --- a/Modules/CheckCCompilerFlag.cmake +++ b/Modules/CheckCCompilerFlag.cmake @@ -9,6 +9,7 @@ #============================================================================= # Copyright 2006-2011 Kitware, Inc. # Copyright 2006 Alexander Neundorf +# Copyright 2011 Matthias Kretz # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -35,6 +36,7 @@ MACRO (CHECK_C_COMPILER_FLAG _FLAG _RESULT) FAIL_REGEX "[Uu]nknown option" # HP FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro FAIL_REGEX "command option .* is not recognized" # XL + FAIL_REGEX "WARNING: unknown flag:" # Open64 ) SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") ENDMACRO (CHECK_C_COMPILER_FLAG) diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake index 3da04b4..134f875 100644 --- a/Modules/CheckCXXCompilerFlag.cmake +++ b/Modules/CheckCXXCompilerFlag.cmake @@ -9,6 +9,7 @@ #============================================================================= # Copyright 2006-2010 Kitware, Inc. # Copyright 2006 Alexander Neundorf +# Copyright 2011 Matthias Kretz # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -27,6 +28,7 @@ MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT) SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") CHECK_CXX_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT} # Some compilers do not fail with a bad flag + FAIL_REGEX "command line option .* is valid for .* but not for C\\\\+\\\\+" # GNU FAIL_REGEX "unrecognized .*option" # GNU FAIL_REGEX "unknown .*option" # Clang FAIL_REGEX "ignoring unknown option" # MSVC @@ -36,6 +38,7 @@ MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT) FAIL_REGEX "command option .* is not recognized" # XL FAIL_REGEX "not supported in this configuration; ignored" # AIX FAIL_REGEX "File with unknown suffix passed to linker" # PGI + FAIL_REGEX "WARNING: unknown flag:" # Open64 ) SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") ENDMACRO (CHECK_CXX_COMPILER_FLAG) -- cgit v0.12 From 3b488228032e32f03a639af3a084a4e5ad3201bd Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Sun, 12 Feb 2012 18:57:28 +0100 Subject: FindGetText: fix multiple targets with the same name problem (CMP0002) The functions in FindGettext create a custom target. If the functions are called multiple times, multiple times the same target is created. This works only if CMP0002 is set to OLD. With this patch there is only one central target created, and each invocation of the function creates a target with a unique name and make the central target depend on this one. Alex --- Modules/FindGettext.cmake | 48 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake index 635090b..6dbc026 100644 --- a/Modules/FindGettext.cmake +++ b/Modules/FindGettext.cmake @@ -61,6 +61,17 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gettext INCLUDE(CMakeParseArguments) +FUNCTION(_GETTEXT_GET_UNIQUE_TARGET_NAME _name _unique_name) + SET(propertyName "_GETTEXT_UNIQUE_COUNTER_${_name}") + GET_PROPERTY(currentCounter GLOBAL PROPERTY "${propertyName}") + IF(NOT currentCounter) + SET(currentCounter 1) + ENDIF() + SET(${_unique_name} "${_name}_${currentCounter}" PARENT_SCOPE) + MATH(EXPR currentCounter "${currentCounter} + 1") + SET_PROPERTY(GLOBAL PROPERTY ${propertyName} ${currentCounter} ) +ENDFUNCTION() + MACRO(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg) # make it a real variable, so we can modify it here SET(_firstPoFile "${_firstPoFileArg}") @@ -94,7 +105,15 @@ MACRO(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg) ENDFOREACH (_currentPoFile ) - ADD_CUSTOM_TARGET(translations ${_addToAll} DEPENDS ${_gmoFiles}) + IF(NOT TARGET translations) + ADD_CUSTOM_TARGET(translations) + ENDIF() + + _GETTEXT_GET_UNIQUE_TARGET_NAME(translations uniqueTargetName) + + ADD_CUSTOM_TARGET(${uniqueTargetName} ${_addToAll} DEPENDS ${_gmoFiles}) + + ADD_DEPENDENCIES(translations ${uniqueTargetName}) ENDMACRO(GETTEXT_CREATE_TRANSLATIONS ) @@ -133,11 +152,20 @@ FUNCTION(GETTEXT_PROCESS_POT_FILE _potFile) LIST(APPEND _gmoFiles ${_gmoFile}) ENDFOREACH (_lang ) + IF(NOT TARGET potfiles) + ADD_CUSTOM_TARGET(potfiles) + ENDIF() + + _GETTEXT_GET_UNIQUE_TARGET_NAME( potfiles uniqueTargetName) + IF(_parsedArguments_ALL) - ADD_CUSTOM_TARGET(potfiles ALL DEPENDS ${_gmoFiles}) + ADD_CUSTOM_TARGET(${uniqueTargetName} ALL DEPENDS ${_gmoFiles}) ELSE(_parsedArguments_ALL) - ADD_CUSTOM_TARGET(potfiles DEPENDS ${_gmoFiles}) + ADD_CUSTOM_TARGET(${uniqueTargetName} DEPENDS ${_gmoFiles}) ENDIF(_parsedArguments_ALL) + + ADD_DEPENDENCIES(potfiles ${uniqueTargetName}) + ENDFUNCTION(GETTEXT_PROCESS_POT_FILE) @@ -165,11 +193,21 @@ FUNCTION(GETTEXT_PROCESS_PO_FILES _lang) LIST(APPEND _gmoFiles ${_gmoFile}) ENDFOREACH(_current_PO_FILE) + + IF(NOT TARGET pofiles) + ADD_CUSTOM_TARGET(pofiles) + ENDIF() + + _GETTEXT_GET_UNIQUE_TARGET_NAME( pofiles uniqueTargetName) + IF(_parsedArguments_ALL) - ADD_CUSTOM_TARGET(pofiles ALL DEPENDS ${_gmoFiles}) + ADD_CUSTOM_TARGET(${uniqueTargetName} ALL DEPENDS ${_gmoFiles}) ELSE(_parsedArguments_ALL) - ADD_CUSTOM_TARGET(pofiles DEPENDS ${_gmoFiles}) + ADD_CUSTOM_TARGET(${uniqueTargetName} DEPENDS ${_gmoFiles}) ENDIF(_parsedArguments_ALL) + + ADD_DEPENDENCIES(pofiles ${uniqueTargetName}) + ENDFUNCTION(GETTEXT_PROCESS_PO_FILES) IF (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE ) -- cgit v0.12 From f17d3f58d66a8aac3d149e8819eb6a9666d0526e Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Mon, 13 Feb 2012 00:05:08 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index ef0add7..d21fe1d 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 12) +SET(KWSYS_DATE_STAMP_DAY 13) -- cgit v0.12 From 17a8e16cd243f06597ad1246775f80fc5a4337b4 Mon Sep 17 00:00:00 2001 From: Nicolas Despres Date: Tue, 7 Feb 2012 16:00:49 +0100 Subject: java: Factor jar output path. Signed-off-by: Andreas Schneider --- Modules/UseJava.cmake | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index b78278c..f1af5a9 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -312,11 +312,13 @@ function(add_jar _TARGET_NAME) endif (_JAVA_COMPILE_FILES) # create the jar file + set(_JAVA_JAR_OUTPUT_PATH + ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME}) if (CMAKE_JNI_TARGET) add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME} + OUTPUT ${_JAVA_JAR_OUTPUT_PATH} COMMAND ${Java_JAR_EXECUTABLE} - -cf ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME} + -cf ${_JAVA_JAR_OUTPUT_PATH} ${_JAVA_RESOURCE_FILES} @java_class_filelist COMMAND ${CMAKE_COMMAND} -D_JAVA_TARGET_DIR=${CMAKE_CURRENT_BINARY_DIR} @@ -325,7 +327,7 @@ function(add_jar _TARGET_NAME) -P ${_JAVA_SYMLINK_SCRIPT} COMMAND ${CMAKE_COMMAND} -D_JAVA_TARGET_DIR=${CMAKE_CURRENT_BINARY_DIR} - -D_JAVA_TARGET_OUTPUT_NAME=${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME} + -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_JAR_OUTPUT_PATH} -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK} -P ${_JAVA_SYMLINK_SCRIPT} DEPENDS ${_JAVA_RESOURCE_FILES} ${_JAVA_DEPENDS} ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist @@ -334,9 +336,9 @@ function(add_jar _TARGET_NAME) ) else () add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME} + OUTPUT ${_JAVA_JAR_OUTPUT_PATH} COMMAND ${Java_JAR_EXECUTABLE} - -cf ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME} + -cf ${_JAVA_JAR_OUTPUT_PATH} ${_JAVA_RESOURCE_FILES} @java_class_filelist COMMAND ${CMAKE_COMMAND} -D_JAVA_TARGET_DIR=${CMAKE_CURRENT_BINARY_DIR} @@ -350,14 +352,14 @@ function(add_jar _TARGET_NAME) endif (CMAKE_JNI_TARGET) # Add the target and make sure we have the latest resource files. - add_custom_target(${_TARGET_NAME} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME}) + add_custom_target(${_TARGET_NAME} ALL DEPENDS ${_JAVA_JAR_OUTPUT_PATH}) set_property( TARGET ${_TARGET_NAME} PROPERTY INSTALL_FILES - ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME} + ${_JAVA_JAR_OUTPUT_PATH} ) if (_JAVA_TARGET_OUTPUT_LINK) @@ -366,7 +368,7 @@ function(add_jar _TARGET_NAME) ${_TARGET_NAME} PROPERTY INSTALL_FILES - ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME} + ${_JAVA_JAR_OUTPUT_PATH} ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_LINK} ) @@ -386,7 +388,7 @@ function(add_jar _TARGET_NAME) ${_TARGET_NAME} PROPERTY JAR_FILE - ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME} + ${_JAVA_JAR_OUTPUT_PATH} ) set_property( -- cgit v0.12 From 525bb92a3d4149aae1b268315ac746a6142d1fec Mon Sep 17 00:00:00 2001 From: Nicolas Despres Date: Tue, 7 Feb 2012 16:01:12 +0100 Subject: java: Add CMAKE_JAVA_TARGET_OUTPUT_DIR optional variable. Signed-off-by: Andreas Schneider --- Modules/UseJava.cmake | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index f1af5a9..c84fc91 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -25,6 +25,11 @@ # set(CMAKE_JAVA_TARGET_OUTPUT_NAME shibboleet.jar) # add_jar(foobar foobar.java) # +# To use a different output directory than CMAKE_CURRENT_BINARY_DIR +# you can set it with: +# +# set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${PROJECT_BINARY_DIR}/bin) +# # To add a VERSION to the target output name you can set it using # CMAKE_JAVA_TARGET_VERSION. This will create a jar file with the name # shibboleet-1.0.0.jar and will create a symlink shibboleet.jar @@ -198,10 +203,14 @@ set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaSymlinks.cmake) function(add_jar _TARGET_NAME) set(_JAVA_SOURCE_FILES ${ARGN}) + if (NOT DEFINED CMAKE_JAVA_TARGET_OUTPUT_DIR) + set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) + endif(NOT DEFINED CMAKE_JAVA_TARGET_OUTPUT_DIR) + if (LIBRARY_OUTPUT_PATH) set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH}) else (LIBRARY_OUTPUT_PATH) - set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}) + set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${CMAKE_JAVA_TARGET_OUTPUT_DIR}) endif (LIBRARY_OUTPUT_PATH) set(CMAKE_JAVA_INCLUDE_PATH @@ -221,7 +230,7 @@ function(add_jar _TARGET_NAME) set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}") endforeach(JAVA_INCLUDE_DIR) - set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir") + set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${CMAKE_JAVA_TARGET_OUTPUT_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir") set(_JAVA_TARGET_OUTPUT_NAME "${_TARGET_NAME}.jar") if (CMAKE_JAVA_TARGET_OUTPUT_NAME AND CMAKE_JAVA_TARGET_VERSION) @@ -246,7 +255,7 @@ function(add_jar _TARGET_NAME) get_filename_component(_JAVA_PATH ${_JAVA_SOURCE_FILE} PATH) get_filename_component(_JAVA_FULL ${_JAVA_SOURCE_FILE} ABSOLUTE) - file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${CMAKE_CURRENT_BINARY_DIR} ${_JAVA_FULL}) + file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${CMAKE_JAVA_TARGET_OUTPUT_DIR} ${_JAVA_FULL}) file(RELATIVE_PATH _JAVA_REL_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${_JAVA_FULL}) string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN) string(LENGTH ${_JAVA_REL_SOURCE_PATH} _SRC_LEN) @@ -313,7 +322,7 @@ function(add_jar _TARGET_NAME) # create the jar file set(_JAVA_JAR_OUTPUT_PATH - ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME}) + ${CMAKE_JAVA_TARGET_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_NAME}) if (CMAKE_JNI_TARGET) add_custom_command( OUTPUT ${_JAVA_JAR_OUTPUT_PATH} @@ -321,12 +330,12 @@ function(add_jar _TARGET_NAME) -cf ${_JAVA_JAR_OUTPUT_PATH} ${_JAVA_RESOURCE_FILES} @java_class_filelist COMMAND ${CMAKE_COMMAND} - -D_JAVA_TARGET_DIR=${CMAKE_CURRENT_BINARY_DIR} + -D_JAVA_TARGET_DIR=${CMAKE_JAVA_TARGET_OUTPUT_DIR} -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME} -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK} -P ${_JAVA_SYMLINK_SCRIPT} COMMAND ${CMAKE_COMMAND} - -D_JAVA_TARGET_DIR=${CMAKE_CURRENT_BINARY_DIR} + -D_JAVA_TARGET_DIR=${CMAKE_JAVA_TARGET_OUTPUT_DIR} -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_JAR_OUTPUT_PATH} -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK} -P ${_JAVA_SYMLINK_SCRIPT} @@ -341,7 +350,7 @@ function(add_jar _TARGET_NAME) -cf ${_JAVA_JAR_OUTPUT_PATH} ${_JAVA_RESOURCE_FILES} @java_class_filelist COMMAND ${CMAKE_COMMAND} - -D_JAVA_TARGET_DIR=${CMAKE_CURRENT_BINARY_DIR} + -D_JAVA_TARGET_DIR=${CMAKE_JAVA_TARGET_OUTPUT_DIR} -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME} -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK} -P ${_JAVA_SYMLINK_SCRIPT} @@ -369,7 +378,7 @@ function(add_jar _TARGET_NAME) PROPERTY INSTALL_FILES ${_JAVA_JAR_OUTPUT_PATH} - ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_LINK} + ${CMAKE_JAVA_TARGET_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_LINK} ) if (CMAKE_JNI_TARGET) @@ -378,7 +387,7 @@ function(add_jar _TARGET_NAME) ${_TARGET_NAME} PROPERTY JNI_SYMLINK - ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_LINK} + ${CMAKE_JAVA_TARGET_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_LINK} ) endif (CMAKE_JNI_TARGET) endif (_JAVA_TARGET_OUTPUT_LINK) -- cgit v0.12 From 18e8d2f0ccfd853425c86b092693ac11db9ab906 Mon Sep 17 00:00:00 2001 From: Nicolas Despres Date: Tue, 7 Feb 2012 16:01:28 +0100 Subject: java: Add CMAKE_JAVA_JAR_ENTRY_POINT optional variable. Thanks to Matthieu Carpentier. Signed-off-by: Andreas Schneider --- Modules/UseJava.cmake | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index c84fc91..1dfa3c0 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -30,6 +30,10 @@ # # set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${PROJECT_BINARY_DIR}/bin) # +# To define an entry point in your jar you can set it with: +# +# set(CMAKE_JAVA_JAR_ENTRY_POINT com/examples/MyProject/Main) +# # To add a VERSION to the target output name you can set it using # CMAKE_JAVA_TARGET_VERSION. This will create a jar file with the name # shibboleet-1.0.0.jar and will create a symlink shibboleet.jar @@ -207,6 +211,11 @@ function(add_jar _TARGET_NAME) set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) endif(NOT DEFINED CMAKE_JAVA_TARGET_OUTPUT_DIR) + if (CMAKE_JAVA_JAR_ENTRY_POINT) + set(_ENTRY_POINT_OPTION e) + set(_ENTRY_POINT_VALUE ${CMAKE_JAVA_JAR_ENTRY_POINT}) + endif (CMAKE_JAVA_JAR_ENTRY_POINT) + if (LIBRARY_OUTPUT_PATH) set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH}) else (LIBRARY_OUTPUT_PATH) @@ -327,7 +336,7 @@ function(add_jar _TARGET_NAME) add_custom_command( OUTPUT ${_JAVA_JAR_OUTPUT_PATH} COMMAND ${Java_JAR_EXECUTABLE} - -cf ${_JAVA_JAR_OUTPUT_PATH} + -cf${_ENTRY_POINT_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_JAVA_RESOURCE_FILES} @java_class_filelist COMMAND ${CMAKE_COMMAND} -D_JAVA_TARGET_DIR=${CMAKE_JAVA_TARGET_OUTPUT_DIR} @@ -347,7 +356,7 @@ function(add_jar _TARGET_NAME) add_custom_command( OUTPUT ${_JAVA_JAR_OUTPUT_PATH} COMMAND ${Java_JAR_EXECUTABLE} - -cf ${_JAVA_JAR_OUTPUT_PATH} + -cf${_ENTRY_POINT_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_JAVA_RESOURCE_FILES} @java_class_filelist COMMAND ${CMAKE_COMMAND} -D_JAVA_TARGET_DIR=${CMAKE_JAVA_TARGET_OUTPUT_DIR} -- cgit v0.12 From afc75bb7f520b7405a08f24a25a42542d3e3c92f Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 13 Feb 2012 10:33:27 -0500 Subject: Recognize OpenBSD versioned .so names (#12954) OpenBSD shared library names end in a ".#.#" version number suffix. Teach cmComputeLinkInformation to tolerate the extra suffix after the normal library name suffixes when parsing library names. --- Source/cmComputeLinkInformation.cxx | 14 +++++++++++++- Source/cmComputeLinkInformation.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index edf6c35..57fd5b4 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -248,6 +248,10 @@ cmComputeLinkInformation this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator(); this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance(); + // Check whether to recognize OpenBSD-style library versioned names. + this->OpenBSD = this->Makefile->GetCMakeInstance() + ->GetPropertyAsBool("FIND_LIBRARY_USE_OPENBSD_VERSIONING"); + // The configuration being linked. this->Config = config; @@ -973,7 +977,15 @@ cmComputeLinkInformation } // Finish the list. - libext += ")$"; + libext += ")"; + + // Add an optional OpenBSD version component. + if(this->OpenBSD) + { + libext += "(\\.[0-9]+\\.[0-9]+)?"; + } + + libext += "$"; return libext; } diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index bbeed68..f60f8d3 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -128,6 +128,7 @@ private: cmsys::RegularExpression ExtractSharedLibraryName; cmsys::RegularExpression ExtractAnyLibraryName; std::string SharedRegexString; + bool OpenBSD; void AddLinkPrefix(const char* p); void AddLinkExtension(const char* e, LinkType type); std::string CreateExtensionRegex(std::vector const& exts); -- cgit v0.12 From 2f306a999203d7a894e5bace90d176ce525f6444 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Mon, 13 Feb 2012 18:45:38 +0100 Subject: AllFindModules test: do not enforce GNUPLOT version Ancient Gnuplot versions like 3.7.1 don't know about "--version". Disable this check so it doesn't break on machines with this version. --- Tests/CMakeOnly/AllFindModules/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index 127e9d7..f76f0d9 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -48,7 +48,7 @@ endif (NOT QT4_FOUND) # If any of these modules reported that it was found a version number should have been # reported. set(VERSIONS_REQUIRED - ALSA BISON BZIP2 CUPS CURL DOXYGEN EXPAT FLEX GETTEXT GIF GIT GNUPLOT + ALSA BISON BZIP2 CUPS CURL DOXYGEN EXPAT FLEX GETTEXT GIF GIT ImageMagick JASPER LibArchive LIBXML2 PERL PostgreSQL SWIG TIFF ZLIB) foreach(VTEST ${VERSIONS_REQUIRED}) -- cgit v0.12 From 5b016a23d0235a04b463533c1136dfdbc4cc14b4 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Tue, 14 Feb 2012 00:05:06 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index d21fe1d..f50f803 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 13) +SET(KWSYS_DATE_STAMP_DAY 14) -- cgit v0.12 From 52c53deb1bc0109340479aa1284e2fa03b2f5401 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Wed, 1 Feb 2012 20:47:28 +0100 Subject: Really avoid compiler warning about unused vars --- Source/CPack/cmCPackDocumentMacros.cxx | 4 +--- Source/CPack/cmCPackDocumentVariables.cxx | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Source/CPack/cmCPackDocumentMacros.cxx b/Source/CPack/cmCPackDocumentMacros.cxx index 94d5391..ddc75a4 100644 --- a/Source/CPack/cmCPackDocumentMacros.cxx +++ b/Source/CPack/cmCPackDocumentMacros.cxx @@ -1,10 +1,8 @@ #include "cmCPackDocumentMacros.h" void cmCPackDocumentMacros::GetMacrosDocumentation( - std::vector& v) + std::vector& ) { - // avoid compiler warning - (int)v.size(); // Commented-out example of use // // cmDocumentationEntry e("cpack_", diff --git a/Source/CPack/cmCPackDocumentVariables.cxx b/Source/CPack/cmCPackDocumentVariables.cxx index 27d4df2..6327152 100644 --- a/Source/CPack/cmCPackDocumentVariables.cxx +++ b/Source/CPack/cmCPackDocumentVariables.cxx @@ -1,10 +1,8 @@ #include "cmCPackDocumentVariables.h" #include "cmake.h" -void cmCPackDocumentVariables::DefineVariables(cmake* cm) +void cmCPackDocumentVariables::DefineVariables(cmake* ) { - // avoid compiler warning - (void*)cm; // Subsection: variables defined/used by cpack, // which are common to all CPack generators -- cgit v0.12 From cdbd1a9e39e79fe2f29dff3c3a7b9cf9c9fae3cc Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Wed, 1 Feb 2012 21:07:29 +0100 Subject: Fix another compiler warning due to a typo --- Source/cmDocumentation.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index fae409f..83a0a09 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -156,7 +156,6 @@ public: std::vector& commands, cmake* cm, const char *docSection); - ; private: void SetForm(Form f); void SetDocName(const char* docname); -- cgit v0.12 From 543f1adfa4a8f2f38371512ffcb8c252332acb18 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Thu, 2 Feb 2012 01:44:21 +0100 Subject: Make the load of script documentation more efficient and dynamic. CPack help will be searched in any CPack*.cmake file located near to CPack.cmake file. The script files is parsed iff the first line begin with ##section. Moreover the documentation section name is specified on the remaining part of the line minus the space immediately following ##section. --- Modules/CPack.cmake | 22 ++++++++++------- Modules/CPackDeb.cmake | 4 ++++ Modules/CPackRPM.cmake | 4 +++- Source/CPack/cpack.cxx | 60 ++++++++++++++++++++++++++++++++++++---------- Source/cmDocumentation.cxx | 20 ++++++++++++++-- 5 files changed, 85 insertions(+), 25 deletions(-) diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 1718008..8a44991 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -1,3 +1,6 @@ +##section Variables common to all CPack generators +##end +##module # - Build binary and source package installers. # The CPack module generates binary and source installers in a variety # of formats using the cpack program. Inclusion of the CPack module @@ -28,16 +31,16 @@ # on a per-generator basis. It only need contain overrides. # # Here's how it works: -# - cpack runs -# - it includes CPackConfig.cmake -# - it iterates over the generators listed in that file's -# CPACK_GENERATOR list variable (unless told to use just a -# specific one via -G on the command line...) +# - cpack runs +# - it includes CPackConfig.cmake +# - it iterates over the generators listed in that file's +# CPACK_GENERATOR list variable (unless told to use just a +# specific one via -G on the command line...) # -# - foreach generator, it then -# - sets CPACK_GENERATOR to the one currently being iterated -# - includes the CPACK_PROJECT_CONFIG_FILE -# - produces the package for that generator +# - foreach generator, it then +# - sets CPACK_GENERATOR to the one currently being iterated +# - includes the CPACK_PROJECT_CONFIG_FILE +# - produces the package for that generator # # This is the key: For each generator listed in CPACK_GENERATOR # in CPackConfig.cmake, cpack will *reset* CPACK_GENERATOR @@ -47,6 +50,7 @@ # Before including this CPack module in your CMakeLists.txt file, # there are a variety of variables that can be set to customize # the resulting installers. The most commonly-used variables are: +##end # ##variable # CPACK_PACKAGE_NAME - The name of the package (or application). If diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index fc7f992..0916843 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -1,3 +1,6 @@ +##section Variables specific to a CPack generator +##end +##module # - The builtin (binary) CPack Deb generator (Unix only) # CPackDeb may be used to create Deb package using CPack. # CPackDeb is a CPack generator thus it uses the CPACK_XXX variables @@ -11,6 +14,7 @@ # the wiki: # http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29 # However as a handy reminder here comes the list of specific variables: +##end # ##variable # CPACK_DEBIAN_PACKAGE_NAME diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index de06fef..f76e91e 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -1,5 +1,7 @@ -# - The builtin (binary) CPack RPM generator (Unix only) +##section Variables specific to a CPack generator +##end ##module +# - The builtin (binary) CPack RPM generator (Unix only) # CPackRPM may be used to create RPM package using CPack. # CPackRPM is a CPack generator thus it uses the CPACK_XXX variables # used by CPack : http://www.cmake.org/Wiki/CMake:CPackConfiguration diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 4117971..25a72fa 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -26,6 +26,8 @@ #include "cmCPackLog.h" #include +#include +#include #include // auto_ptr //---------------------------------------------------------------------------- @@ -527,22 +529,54 @@ int main (int argc, char *argv[]) typedef std::pair docModuleSectionPair_t; typedef std::list docedModulesList_t; - docedModulesList_t docedModList; + docedModulesList_t docedModList; docModuleSectionPair_t docPair; std::string docedFile; - // build the list of files to be parsed for documentation - // extraction - docPair.first = "CPack.cmake"; - docPair.second = "Variables common to all CPack generators"; - docedModList.push_back(docPair); - docPair.first = "CPackComponent.cmake"; - docedModList.push_back(docPair); - docPair.first = "CPackRPM.cmake"; - docPair.second = "Variables specific to a CPack generator"; - docedModList.push_back(docPair); - docPair.first = "CPackDeb.cmake"; - docedModList.push_back(docPair); + cmsys::Glob gl; + std::string findExpr; + std::vector files; + std::string line; + docedFile = globalMF->GetModulesFile("CPack.cmake"); + if (docedFile.length()!=0) + { + findExpr += cmSystemTools::GetFilenamePath(docedFile.c_str()); + findExpr += "/CPack*.cmake"; + if (gl.FindFiles(findExpr)) + { + files = gl.GetFiles(); + for (std::vector::iterator itf=files.begin(); + itf!=files.end();++itf) + { + std::ifstream fin((*itf).c_str()); + if (!fin) continue; + if (cmSystemTools::GetLineFromStream(fin, line)) + { + if (line.find("##section")!=std::string::npos) + { + docPair.first = cmSystemTools::GetFilenameName(*itf); + // 10 is the size of '##section' + 1 + docPair.second = line.substr(10,std::string::npos); + docedModList.push_back(docPair); + } + } + else + { + line.clear(); + } + } + } + else + { + // build the list of files to be parsed for documentation + // extraction + docPair.first = "CPack.cmake"; + docPair.second = "Variables common to all CPack generators"; + docedModList.push_back(docPair); + docPair.first = "CPackComponent.cmake"; + docedModList.push_back(docPair); + } + } // parse the files for documentation. for (docedModulesList_t::iterator it = docedModList.begin(); diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 80f74a6..ed1e5e1 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -768,6 +768,7 @@ int cmDocumentation::GetStructuredDocFromFile( { typedef enum sdoce { SDOC_NONE, SDOC_MODULE, SDOC_MACRO, SDOC_FUNCTION, SDOC_VARIABLE, + SDOC_SECTION, SDOC_UNKNOWN} sdoc_t; int nbDocItemFound = 0; int docCtxIdx = 0; @@ -795,9 +796,13 @@ int cmDocumentation::GetStructuredDocFromFile( if(line.size() && line[0] == '#') { /* handle structured doc context */ - if (line[1]=='#') + if ((line.size()>=2) && line[1]=='#') { - std::string mkword = line.substr(2,std::string::npos); + /* markup word is following '##' stopping at first space + * Some markup word like 'section' may have more characters + * following but we don't handle those here. + */ + std::string mkword = line.substr(2,line.find(' ',2)-2); if (mkword=="macro") { docCtxIdx++; @@ -822,6 +827,14 @@ int cmDocumentation::GetStructuredDocFromFile( docContextStack[docCtxIdx]=SDOC_MODULE; newCtx = true; } + else if (mkword=="section") + { + docCtxIdx++; + docContextStack[docCtxIdx]=SDOC_SECTION; + /* drop the rest of the line */ + line.clear(); + newCtx = true; + } else if (mkword.substr(0,3)=="end") { switch (docContextStack[docCtxIdx]) { @@ -841,6 +854,9 @@ int cmDocumentation::GetStructuredDocFromFile( case SDOC_MODULE: /* not implemented */ break; + case SDOC_SECTION: + /* not implemented */ + break; default: /* ignore other cases */ break; -- cgit v0.12 From bafd8a9e79612c260af12f9a42c7e7cddf1f7da3 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 4 Feb 2012 12:03:58 +0100 Subject: Example of builtin variable documentation (i.e. only used in C++ source code). --- Source/CPack/cmCPackDocumentVariables.cxx | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Source/CPack/cmCPackDocumentVariables.cxx b/Source/CPack/cmCPackDocumentVariables.cxx index 6327152..68cde78 100644 --- a/Source/CPack/cmCPackDocumentVariables.cxx +++ b/Source/CPack/cmCPackDocumentVariables.cxx @@ -1,17 +1,25 @@ #include "cmCPackDocumentVariables.h" #include "cmake.h" -void cmCPackDocumentVariables::DefineVariables(cmake* ) +void cmCPackDocumentVariables::DefineVariables(cmake* cm) { // Subsection: variables defined/used by cpack, // which are common to all CPack generators -// cm->DefineProperty -// ("CPACK_PACKAGE_VENDOR", cmProperty::VARIABLE, -// "The name of the package vendor.", -// "If not specified, defaults to \"Humanity\"." -// "", false, -// "Variables common to all CPack generators"); + cm->DefineProperty + ("CPACK_PACKAGING_INSTALL_PREFIX", cmProperty::VARIABLE, + "The prefix used in the built package.", + "Each CPack generator has a default value (like /usr)." + " This default value may" + " be overwritten from the CMakeLists.txt or the cpack command line" + " by setting an alternative value.\n" + "e.g. " + " set(CPACK_PACKAGING_INSTALL_PREFIX \"/opt\")\n" + "This is not the same purpose as CMAKE_INSTALL_PREFIX which" + " is used when installing from the build tree without building" + " a package." + "", false, + "Variables common to all CPack generators"); // Subsection: variables defined/used by cpack, // which are specific to one CPack generator -- cgit v0.12 From 24fbc28e5f81823661853be0c0acdf2670b3453e Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 4 Feb 2012 12:06:09 +0100 Subject: Add missing section markup for CPackComponent --- Modules/CPackComponent.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake index a0e0667..016cb8c 100644 --- a/Modules/CPackComponent.cmake +++ b/Modules/CPackComponent.cmake @@ -1,3 +1,6 @@ +##section Variables common to all CPack generators +##end +##module # - Build binary and source package installers # # The CPackComponent module is the module which handles @@ -20,6 +23,7 @@ # components are identified by the COMPONENT argument of CMake's # INSTALL commands, and should be further described by the following # CPack commands: +##end # ##macro # cpack_add_component - Describes a CPack installation component -- cgit v0.12 From 02ccb3291bd1053df30600211b0ceefbb7fea00f Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 4 Feb 2012 12:15:57 +0100 Subject: Create getDocumentedModulesListInDir which may be used in other context. This should makes it easier to use the same "documented module" techniques for CTest, CMake or user module. --- Source/CPack/cpack.cxx | 67 +++++++++------------------------------------- Source/cmDocumentation.cxx | 55 +++++++++++++++++++++++++++++++++++++ Source/cmDocumentation.h | 33 ++++++++++++++++++++++- 3 files changed, 99 insertions(+), 56 deletions(-) diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 25a72fa..3182915 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -26,7 +26,6 @@ #include "cmCPackLog.h" #include -#include #include #include // auto_ptr @@ -527,68 +526,26 @@ int main (int argc, char *argv[]) std::vector commands; - typedef std::pair docModuleSectionPair_t; - typedef std::list docedModulesList_t; - docedModulesList_t docedModList; - docModuleSectionPair_t docPair; - std::string docedFile; + std::string docedFile; + std::string docPath; + cmDocumentation::documentedModulesList_t docedModList; - cmsys::Glob gl; - std::string findExpr; - std::vector files; - std::string line; docedFile = globalMF->GetModulesFile("CPack.cmake"); if (docedFile.length()!=0) { - findExpr += cmSystemTools::GetFilenamePath(docedFile.c_str()); - findExpr += "/CPack*.cmake"; - if (gl.FindFiles(findExpr)) - { - files = gl.GetFiles(); - for (std::vector::iterator itf=files.begin(); - itf!=files.end();++itf) - { - std::ifstream fin((*itf).c_str()); - if (!fin) continue; - if (cmSystemTools::GetLineFromStream(fin, line)) - { - if (line.find("##section")!=std::string::npos) - { - docPair.first = cmSystemTools::GetFilenameName(*itf); - // 10 is the size of '##section' + 1 - docPair.second = line.substr(10,std::string::npos); - docedModList.push_back(docPair); - } - } - else - { - line.clear(); - } - } - } - else - { - // build the list of files to be parsed for documentation - // extraction - docPair.first = "CPack.cmake"; - docPair.second = "Variables common to all CPack generators"; - docedModList.push_back(docPair); - docPair.first = "CPackComponent.cmake"; - docedModList.push_back(docPair); - } + docPath = cmSystemTools::GetFilenamePath(docedFile.c_str()); + doc.getDocumentedModulesListInDir(docPath,"CPack*.cmake",docedModList); } // parse the files for documentation. - for (docedModulesList_t::iterator it = docedModList.begin(); - it!= docedModList.end(); ++it) + cmDocumentation::documentedModulesList_t::iterator docedIt; + for (docedIt = docedModList.begin(); + docedIt!= docedModList.end(); ++docedIt) { - docedFile = globalMF->GetModulesFile((it->first).c_str()); - if (docedFile.length()!=0) - { - doc.GetStructuredDocFromFile(docedFile.c_str(), - commands,&cminst,(it->second).c_str()); - } - } + doc.GetStructuredDocFromFile( + (docedIt->first).c_str(), + commands,&cminst,(docedIt->second).c_str()); + } std::map propDocs; cminst.GetPropertiesDocumentation(propDocs); diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index ed1e5e1..dde4953 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -14,6 +14,7 @@ #include "cmSystemTools.h" #include "cmVersion.h" #include +#include //---------------------------------------------------------------------------- @@ -745,6 +746,60 @@ void cmDocumentation::addCPackStandardDocSections() } //---------------------------------------------------------------------------- +int cmDocumentation::getDocumentedModulesListInDir( + std::string path, + std::string globExpr, + documentedModulesList_t& docedModuleList) +{ + cmsys::Glob gl; + std::string findExpr; + std::vector files; + std::string line; + documentedModuleSectionPair_t docPair; + int nbDocumentedModules = 0; + + findExpr = path + "/" + globExpr; + if (gl.FindFiles(findExpr)) + { + files = gl.GetFiles(); + for (std::vector::iterator itf=files.begin(); + itf!=files.end();++itf) + { + std::ifstream fin((*itf).c_str()); + // file access trouble ignore it (ignore this kind of error) + if (!fin) continue; + /* read first line in order to get doc section */ + if (cmSystemTools::GetLineFromStream(fin, line)) + { + /* Doc section indicates that + * this file has structured doc in it. + */ + if (line.find("##section")!=std::string::npos) + { + // ok found one more documented module + ++nbDocumentedModules; + docPair.first = *itf; + // 10 is the size of '##section' + 1 + docPair.second = line.substr(10,std::string::npos); + docedModuleList.push_back(docPair); + } + // No else if no section is found (undocumented module) + } + // No else cannot read first line (ignore this kind of error) + line.clear(); + } + } + if (nbDocumentedModules>0) + { + return 0; + } + else + { + return 1; + } +} + +//---------------------------------------------------------------------------- static void trim(std::string& s) { std::string::size_type pos = s.find_last_not_of(' '); diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index 83a0a09..00dba1a 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -35,6 +35,21 @@ public: cmDocumentation(); ~cmDocumentation(); + + /** + * An helper type pair for [structured] documented modules. + * The comment of those module contains structure markup + * which makes it possible to retrieve the documentation + * of variables, macros and functions defined in the module. + * - first is the filename of the module + * - second is the section of the doc the module belongs too + */ + typedef std::pair documentedModuleSectionPair_t; + /** + * A list of documented module(s). + */ + typedef std::list documentedModulesList_t; + // High-level interface for standard documents: /** @@ -133,6 +148,21 @@ public: void addCPackStandardDocSections(); /** + * Retrieve the list of documented module located in + * path which match the globing expression globExpr. + * @param[in] path, directory where to start the search + * we will recurse into it. + * @param[in] globExpr, the globing expression used to + * match the file in path. + * @param[out] the list of obtained pairs (may be empty) + * @return 0 on success 1 on error or empty list + */ + int getDocumentedModulesListInDir( + std::string path, + std::string globExpr, + documentedModulesList_t& docModuleList); + + /** * Get the documentation of macros, functions and variable documented * with CMake structured documentation in a CMake script. * (in fact it may be in any file which follow the structured doc format) @@ -140,7 +170,8 @@ public: * ## (double sharp) in column 1 & 2 immediately followed * by a markup. Those ## are ignored by the legacy module * documentation parser @see CreateSingleModule. - * Current markup are ##macro, ##function, ##variable and ##end. + * Current markup are ##section, ##module, + * ##macro, ##function, ##variable and ##end. * ##end is closing either of the previous ones. * @param[in] fname the script file name to be parsed for documentation * @param[in,out] commands the vector of command/macros documentation -- cgit v0.12 From 9002f73f311893be20d8d986de8e5239ed2afce2 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Mon, 6 Feb 2012 17:20:54 +0100 Subject: Fix non existent std::string::clear on VS6 --- Source/cmDocumentation.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index dde4953..02f69f1 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -786,7 +786,7 @@ int cmDocumentation::getDocumentedModulesListInDir( // No else if no section is found (undocumented module) } // No else cannot read first line (ignore this kind of error) - line.clear(); + line = ""; } } if (nbDocumentedModules>0) @@ -887,7 +887,7 @@ int cmDocumentation::GetStructuredDocFromFile( docCtxIdx++; docContextStack[docCtxIdx]=SDOC_SECTION; /* drop the rest of the line */ - line.clear(); + line = ""; newCtx = true; } else if (mkword.substr(0,3)=="end") -- cgit v0.12 From d4b77eba17e01badc836777dbb0c9ec287f098aa Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Tue, 7 Feb 2012 16:59:04 +0100 Subject: Avoid discovering system infos for documentation. Adding some path is enough. --- Source/CPack/cpack.cxx | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 3182915..c541610 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -304,30 +304,31 @@ int main (int argc, char *argv[]) help = false; } - // find out which system cpack is running on, so it can setup the search - // paths, so FIND_XXX() commands can be used in scripts // This part is used for cpack documentation lookup as well. cminst.AddCMakePaths(); - std::string systemFile = - globalMF->GetModulesFile("CMakeDetermineSystem.cmake"); - if (!globalMF->ReadListFile(0, systemFile.c_str())) - { - cmCPack_Log(&log, cmCPackLog::LOG_ERROR, - "Error reading CMakeDetermineSystem.cmake" << std::endl); - return 1; - } - - systemFile = - globalMF->GetModulesFile("CMakeSystemSpecificInformation.cmake"); - if (!globalMF->ReadListFile(0, systemFile.c_str())) - { - cmCPack_Log(&log, cmCPackLog::LOG_ERROR, - "Error reading CMakeSystemSpecificInformation.cmake" << std::endl); - return 1; - } if ( parsed && !help ) { + // find out which system cpack is running on, so it can setup the search + // paths, so FIND_XXX() commands can be used in scripts + std::string systemFile = + globalMF->GetModulesFile("CMakeDetermineSystem.cmake"); + if (!globalMF->ReadListFile(0, systemFile.c_str())) + { + cmCPack_Log(&log, cmCPackLog::LOG_ERROR, + "Error reading CMakeDetermineSystem.cmake" << std::endl); + return 1; + } + + systemFile = + globalMF->GetModulesFile("CMakeSystemSpecificInformation.cmake"); + if (!globalMF->ReadListFile(0, systemFile.c_str())) + { + cmCPack_Log(&log, cmCPackLog::LOG_ERROR, + "Error reading CMakeSystemSpecificInformation.cmake" << std::endl); + return 1; + } + if ( cmSystemTools::FileExists(cpackConfigFile.c_str()) ) { cpackConfigFile = -- cgit v0.12 From 10dfec3bb63a8f6552c1d343b6cad245e6b1abdf Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Sat, 11 Feb 2012 17:52:32 +0100 Subject: FindPerlLibs: properly detect libperl on Windows (#12224) This also cleans up a bunch of things on the way: -when perl was queried for paths they were not converted to CMake style on Windows. -the result when perl was queried for the perl library name was ignored since it was expanded with the possible paths, which is not a valid input for find_library(). If perl returns a library name we now will look only for this name and not for the default names and use the default names only when the executable does not give us a hint. -get rid of 2 variables that were only used at one place and directly put the values in the call to find_library() and find_path(). Inspired by Jeff Trull --- Modules/FindPerlLibs.cmake | 54 ++++++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 31 deletions(-) diff --git a/Modules/FindPerlLibs.cmake b/Modules/FindPerlLibs.cmake index 0ac8060..b2ffd3c 100644 --- a/Modules/FindPerlLibs.cmake +++ b/Modules/FindPerlLibs.cmake @@ -94,6 +94,7 @@ if (PERL_EXECUTABLE) ) if (NOT PERL_SITESEARCH_RESULT_VARIABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_SITESEARCH ${PERL_SITESEARCH_OUTPUT_VARIABLE}) + file(TO_CMAKE_PATH "${PERL_SITESEARCH}" PERL_SITESEARCH) endif (NOT PERL_SITESEARCH_RESULT_VARIABLE) ### PERL_SITELIB @@ -107,6 +108,7 @@ if (PERL_EXECUTABLE) ) if (NOT PERL_SITELIB_RESULT_VARIABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_SITELIB ${PERL_SITELIB_OUTPUT_VARIABLE}) + file(TO_CMAKE_PATH "${PERL_SITELIB}" PERL_SITELIB) endif (NOT PERL_SITELIB_RESULT_VARIABLE) ### PERL_VENDORARCH @@ -120,6 +122,7 @@ if (PERL_EXECUTABLE) ) if (NOT PERL_VENDORARCH_RESULT_VARIABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_VENDORARCH ${PERL_VENDORARCH_OUTPUT_VARIABLE}) + file(TO_CMAKE_PATH "${PERL_VENDORARCH}" PERL_VENDORARCH) endif (NOT PERL_VENDORARCH_RESULT_VARIABLE) ### PERL_VENDORLIB @@ -133,6 +136,7 @@ if (PERL_EXECUTABLE) ) if (NOT PERL_VENDORLIB_RESULT_VARIABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_VENDORLIB ${PERL_VENDORLIB_OUTPUT_VARIABLE}) + file(TO_CMAKE_PATH "${PERL_VENDORLIB}" PERL_VENDORLIB) endif (NOT PERL_VENDORLIB_RESULT_VARIABLE) macro(perl_adjust_darwin_lib_variable varname) @@ -173,6 +177,7 @@ if (PERL_EXECUTABLE) if (NOT PERL_ARCHLIB_RESULT_VARIABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_ARCHLIB ${PERL_ARCHLIB_OUTPUT_VARIABLE}) perl_adjust_darwin_lib_variable( ARCHLIB ) + file(TO_CMAKE_PATH "${PERL_ARCHLIB}" PERL_ARCHLIB) endif (NOT PERL_ARCHLIB_RESULT_VARIABLE) ### PERL_PRIVLIB @@ -187,28 +192,10 @@ if (PERL_EXECUTABLE) if (NOT PERL_PRIVLIB_RESULT_VARIABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_PRIVLIB ${PERL_PRIVLIB_OUTPUT_VARIABLE}) perl_adjust_darwin_lib_variable( PRIVLIB ) + file(TO_CMAKE_PATH "${PERL_PRIVLIB}" PERL_PRIVLIB) endif (NOT PERL_PRIVLIB_RESULT_VARIABLE) - - ### PERL_POSSIBLE_INCLUDE_PATHS - set(PERL_POSSIBLE_INCLUDE_PATHS - ${PERL_ARCHLIB}/CORE - /usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE - /usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE - /usr/lib/perl5/${PERL_VERSION_STRING}/CORE - /usr/lib/perl/${PERL_VERSION_STRING}/CORE - ) - - ### PERL_POSSIBLE_LIB_PATHS - set(PERL_POSSIBLE_LIB_PATHS - ${PERL_ARCHLIB}/CORE - /usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE - /usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE - /usr/lib/perl5/${PERL_VERSION_STRING}/CORE - /usr/lib/perl/${PERL_VERSION_STRING}/CORE - ) - - ### PERL_POSSIBLE_LIBRARY_NAME + ### PERL_POSSIBLE_LIBRARY_NAMES execute_process( COMMAND ${PERL_EXECUTABLE} -V:libperl @@ -218,10 +205,9 @@ if (PERL_EXECUTABLE) PERL_LIBRARY_RESULT_VARIABLE ) if (NOT PERL_LIBRARY_RESULT_VARIABLE) - foreach(_perl_lib_path ${PERL_POSSIBLE_LIB_PATHS}) - string(REGEX REPLACE "libperl='([^']+)'" "\\1" PERL_LIBRARY_OUTPUT_VARIABLE ${PERL_LIBRARY_OUTPUT_VARIABLE}) - set(PERL_POSSIBLE_LIBRARY_NAME ${PERL_POSSIBLE_LIBRARY_NAME} "${_perl_lib_path}/${PERL_LIBRARY_OUTPUT_VARIABLE}") - endforeach(_perl_lib_path ${PERL_POSSIBLE_LIB_PATHS}) + string(REGEX REPLACE "libperl='([^']+)'.*" "\\1" PERL_POSSIBLE_LIBRARY_NAMES ${PERL_LIBRARY_OUTPUT_VARIABLE}) + else (NOT PERL_LIBRARY_RESULT_VARIABLE) + set(PERL_POSSIBLE_LIBRARY_NAMES perl${PERL_VERSION_STRING} perl) endif (NOT PERL_LIBRARY_RESULT_VARIABLE) ### PERL_INCLUDE_PATH @@ -229,17 +215,23 @@ if (PERL_EXECUTABLE) NAMES perl.h PATHS - ${PERL_POSSIBLE_INCLUDE_PATHS} + ${PERL_ARCHLIB}/CORE + /usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE + /usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE + /usr/lib/perl5/${PERL_VERSION_STRING}/CORE + /usr/lib/perl/${PERL_VERSION_STRING}/CORE ) - + ### PERL_LIBRARY find_library(PERL_LIBRARY NAMES - ${PERL_POSSIBLE_LIBRARY_NAME} - perl${PERL_VERSION_STRING} - perl + ${PERL_POSSIBLE_LIBRARY_NAMES} PATHS - ${PERL_POSSIBLE_LIB_PATHS} + ${PERL_ARCHLIB}/CORE + /usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE + /usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE + /usr/lib/perl5/${PERL_VERSION_STRING}/CORE + /usr/lib/perl/${PERL_VERSION_STRING}/CORE ) endif (PERL_EXECUTABLE) @@ -254,7 +246,7 @@ find_package_handle_standard_args(PerlLibs REQUIRED_VARS PERL_LIBRARY PERL_INCLU set(PERL_INCLUDE_DIR ${PERL_INCLUDE_PATH}) set(PERL_INCLUDE_DIRS ${PERL_INCLUDE_PATH}) set(PERL_LIBRARIES ${PERL_LIBRARY}) -# For backward compatibility with CMake before 2.8.7 +# For backward compatibility with CMake before 2.8.8 set(PERL_VERSION ${PERL_VERSION_STRING}) mark_as_advanced( -- cgit v0.12 From a8b57149351168425f4040c8b99167238cca041d Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Wed, 15 Feb 2012 00:05:04 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index f50f803..0e6cf93 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 14) +SET(KWSYS_DATE_STAMP_DAY 15) -- cgit v0.12 From ffb27ca3d4c9a9f916d54d74e2bb3394a6fada04 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Wed, 15 Feb 2012 15:29:24 -0500 Subject: Teach CTest what a ninja error looks like. This will allow ninja dashboards to show ninja errors as well as compiler errors from the ninja build. --- CTestCustom.cmake.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index 1a46688..286b3c9 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -1,3 +1,7 @@ +SET(CTEST_CUSTOM_ERROR_MATCH + ${CTEST_CUSTOM_ERROR_MATCH} + "ERROR:") + SET(CTEST_CUSTOM_WARNING_EXCEPTION ${CTEST_CUSTOM_WARNING_EXCEPTION} "xtree.[0-9]+. : warning C4702: unreachable code" -- cgit v0.12 From 58d75e22ae3ed4279b0596eeab73063719bb61d0 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 15 Feb 2012 21:45:30 +0100 Subject: CTest: mark all gcov covered files as covered Even if there are no lines covered in the file the gcov coverage report still contains valueable information, the amount of uncovered lines and which exactly they are. Set 'Covered="true"' for files we have a gcov report for even if they have no lines covered. Otherwise CDash will neither show the uncovered line count nor the detailed coverage report for this file. When CTEST_EXTRA_COVERAGE_GLOB was used to collect otherwise uncovered files 'Covered="true"' was unconditionally set, so this can't be worse here. --- Source/CTest/cmCTestCoverageHandler.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 0b1c9fe..309abb1 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -555,7 +555,7 @@ int cmCTestCoverageHandler::ProcessHandler() covSumFile << "\tCTest->GetShortPathToFile(fullFileName.c_str())) - << "\" Covered=\"" << (tested > 0 ? "true":"false") << "\">\n" + << "\" Covered=\"" << (tested+untested > 0 ? "true":"false") << "\">\n" << "\t\t" << tested << "\n" << "\t\t" << untested << "\n" << "\t\t"; -- cgit v0.12 From 14dadbde809d5091de44ef880376f69f6be2e23e Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 8 Feb 2012 20:05:06 +0100 Subject: FindGLUT: honor REQUIRED (#12466) --- Modules/FindGLUT.cmake | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake index af88997..8205779 100644 --- a/Modules/FindGLUT.cmake +++ b/Modules/FindGLUT.cmake @@ -64,25 +64,23 @@ ELSE (WIN32) ENDIF (WIN32) -SET( GLUT_FOUND "NO" ) -IF(GLUT_INCLUDE_DIR) - IF(GLUT_glut_LIBRARY) - # Is -lXi and -lXmu required on all platforms that have it? - # If not, we need some way to figure out what platform we are on. - SET( GLUT_LIBRARIES - ${GLUT_glut_LIBRARY} - ${GLUT_Xmu_LIBRARY} - ${GLUT_Xi_LIBRARY} - ${GLUT_cocoa_LIBRARY} - ) - SET( GLUT_FOUND "YES" ) - - #The following deprecated settings are for backwards compatibility with CMake1.4 - SET (GLUT_LIBRARY ${GLUT_LIBRARIES}) - SET (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR}) +INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLUT REQUIRED_VARS GLUT_glut_LIBRARY GLUT_INCLUDE_DIR) + +IF (GLUT_FOUND) + # Is -lXi and -lXmu required on all platforms that have it? + # If not, we need some way to figure out what platform we are on. + SET( GLUT_LIBRARIES + ${GLUT_glut_LIBRARY} + ${GLUT_Xmu_LIBRARY} + ${GLUT_Xi_LIBRARY} + ${GLUT_cocoa_LIBRARY} + ) - ENDIF(GLUT_glut_LIBRARY) -ENDIF(GLUT_INCLUDE_DIR) + #The following deprecated settings are for backwards compatibility with CMake1.4 + SET (GLUT_LIBRARY ${GLUT_LIBRARIES}) + SET (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR}) +ENDIF(GLUT_FOUND) MARK_AS_ADVANCED( GLUT_INCLUDE_DIR -- cgit v0.12 From 087bea35c158f336a3193a97b06bdce3d8ce35f8 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Wed, 15 Feb 2012 22:42:31 -0500 Subject: Allow two cmake_add_fortran_subdirectory calls in the same project. Configure the build_mingw.cmake.in config_mingw.cmake.in files into the binary directory of the directory being built, not the top level binary directory for the project. --- Modules/CMakeAddFortranSubdirectory.cmake | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake index ddb79fb..abd9100 100644 --- a/Modules/CMakeAddFortranSubdirectory.cmake +++ b/Modules/CMakeAddFortranSubdirectory.cmake @@ -50,7 +50,7 @@ include(CheckLanguage) include(ExternalProject) include(CMakeParseArguments) -function(_setup_mingw_config_and_build source_dir) +function(_setup_mingw_config_and_build source_dir build_dir) # Look for a MinGW gfortran. find_program(MINGW_GFORTRAN NAMES gfortran @@ -91,11 +91,11 @@ function(_setup_mingw_config_and_build source_dir) string(REPLACE "\\" "\\\\" MINGW_PATH "${MINGW_PATH}") configure_file( ${_MS_MINGW_SOURCE_DIR}/CMakeAddFortranSubdirectory/config_mingw.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/config_mingw.cmake + ${build_dir}/config_mingw.cmake @ONLY) configure_file( ${_MS_MINGW_SOURCE_DIR}/CMakeAddFortranSubdirectory/build_mingw.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/build_mingw.cmake + ${build_dir}/build_mingw.cmake @ONLY) endfunction() @@ -144,15 +144,15 @@ function(cmake_add_fortran_subdirectory subdir) endif() endforeach() # create build and configure wrapper scripts - _setup_mingw_config_and_build(${source_dir}) + _setup_mingw_config_and_build("${source_dir}" "${build_dir}") # create the external project externalproject_add(${project_name}_build SOURCE_DIR ${source_dir} BINARY_DIR ${build_dir} CONFIGURE_COMMAND ${CMAKE_COMMAND} - -P ${CMAKE_CURRENT_BINARY_DIR}/config_mingw.cmake + -P ${build_dir}/config_mingw.cmake BUILD_COMMAND ${CMAKE_COMMAND} - -P ${CMAKE_CURRENT_BINARY_DIR}/build_mingw.cmake + -P ${build_dir}/build_mingw.cmake INSTALL_COMMAND "" ) # make the external project always run make with each build -- cgit v0.12 From e2042b68d36e0881bfc00f926a275dda3d6cbc9d Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Thu, 16 Feb 2012 00:05:07 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 0e6cf93..1c285d0 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 15) +SET(KWSYS_DATE_STAMP_DAY 16) -- cgit v0.12 From b2951624dc1f007b21f8b1ba12f5c60465172b37 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Thu, 16 Feb 2012 09:36:27 +0100 Subject: fix #6976: FindX11 also searches for X11_Xxf86vm_LIB This contains a change, which changes the behaviour a bit: now X11_xf86vmode_FOUND is only set to TRUE and the include directory is added to X11_INCLUDE_DIR, if additionally to X11_xf86vmode_INCLUDE_PATH also X11_Xxf86vm_LIB has been found. I hope this doesn't cause regressions somewhere. Alex --- Modules/FindX11.cmake | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake index 1735bd4..76fb3c9 100644 --- a/Modules/FindX11.cmake +++ b/Modules/FindX11.cmake @@ -20,7 +20,7 @@ # X11_XShm_INCLUDE_PATH, (in X11_Xext_LIB), X11_XShm_FOUND # X11_Xshape_INCLUDE_PATH, (in X11_Xext_LIB), X11_Xshape_FOUND # X11_xf86misc_INCLUDE_PATH, X11_Xxf86misc_LIB, X11_xf86misc_FOUND -# X11_xf86vmode_INCLUDE_PATH, X11_xf86vmode_FOUND +# X11_xf86vmode_INCLUDE_PATH, X11_Xxf86vm_LIB X11_xf86vmode_FOUND # X11_Xfixes_INCLUDE_PATH, X11_Xfixes_LIB, X11_Xfixes_FOUND # X11_Xft_INCLUDE_PATH, X11_Xft_LIB, X11_Xft_FOUND # X11_Xi_INCLUDE_PATH, X11_Xi_LIB, X11_Xi_FOUND @@ -146,6 +146,7 @@ IF (UNIX) FIND_LIBRARY(X11_XTest_LIB Xtst ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xv_LIB Xv ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xxf86misc_LIB Xxf86misc ${X11_LIB_SEARCH_PATH}) + FIND_LIBRARY(X11_Xxf86vm_LIB Xxf86vm ${X11_LIB_SEARCH_PATH}) SET(X11_LIBRARY_DIR "") IF(X11_X11_LIB) @@ -270,10 +271,10 @@ IF (UNIX) SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86misc_INCLUDE_PATH}) ENDIF (X11_xf86misc_INCLUDE_PATH AND X11_Xxf86misc_LIB) - IF (X11_xf86vmode_INCLUDE_PATH) + IF (X11_xf86vmode_INCLUDE_PATH AND X11_Xxf86vm_LIB) SET(X11_xf86vmode_FOUND TRUE) SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86vmode_INCLUDE_PATH}) - ENDIF (X11_xf86vmode_INCLUDE_PATH) + ENDIF (X11_xf86vmode_INCLUDE_PATH AND X11_Xxf86vm_LIB) IF (X11_Xcursor_INCLUDE_PATH AND X11_Xcursor_LIB) SET(X11_Xcursor_FOUND TRUE) @@ -443,6 +444,7 @@ IF (UNIX) X11_XRes_INCLUDE_PATH X11_Xxf86misc_LIB X11_xf86misc_INCLUDE_PATH + X11_Xxf86vm_LIB X11_xf86vmode_INCLUDE_PATH X11_Xi_LIB X11_Xi_INCLUDE_PATH -- cgit v0.12 From 4fbdce2b79b28566ae2c6708c99af5e0e8e0177b Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 13 Feb 2012 10:02:58 -0500 Subject: try_compile: Use random executable file name (#12957) Append a random number to the "cmTryCompileExec" file name to avoid rapid creation and deletion of the same executable file name. Some filesystems lock executable files when they are created and cause subsequent try-compile tests to fail arbitrarily. Use a different name each time to avoid conflict. --- Source/cmCoreTryCompile.cxx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index dca2fb3..7d84ba6 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -26,6 +26,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) const char* sourceDirectory = argv[2].c_str(); const char* projectName = 0; const char* targetName = 0; + char targetNameBuf[64]; int extraArgs = 0; // look for CMAKE_FLAGS and store them @@ -281,16 +282,20 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) cmakeFlags.push_back(flag); } + /* Use a random file name to avoid rapid creation and deletion + of the same executable name (some filesystems fail on that). */ + sprintf(targetNameBuf, "cmTryCompileExec%u", + cmSystemTools::RandomSeed()); + targetName = targetNameBuf; + /* Put the executable at a known location (for COPY_FILE). */ fprintf(fout, "SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n", this->BinaryDirectory.c_str()); /* Create the actual executable. */ - fprintf(fout, "ADD_EXECUTABLE(cmTryCompileExec \"%s\")\n",source.c_str()); - fprintf(fout, - "TARGET_LINK_LIBRARIES(cmTryCompileExec ${LINK_LIBRARIES})\n"); + fprintf(fout, "ADD_EXECUTABLE(%s \"%s\")\n", targetName, source.c_str()); + fprintf(fout, "TARGET_LINK_LIBRARIES(%s ${LINK_LIBRARIES})\n",targetName); fclose(fout); projectName = "CMAKE_TRY_COMPILE"; - targetName = "cmTryCompileExec"; // if the source is not in CMakeTmp if(source.find("CMakeTmp") == source.npos) { -- cgit v0.12 From f4f94f3b7f89f069725668c38d15ffe7526bfe45 Mon Sep 17 00:00:00 2001 From: David Cole Date: Thu, 16 Feb 2012 16:03:27 -0500 Subject: CTestCustom: Suppress clang warning on the dashboard "argument unused during compilation" -- well, thanks, but ... If somebody has a fix to eliminate this warning entirely, rather than simply suppressing it from our dashboard results, I'm all ears. --- CTestCustom.cmake.in | 1 + 1 file changed, 1 insertion(+) diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index 1a46688..c36cee4 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -44,6 +44,7 @@ SET(CTEST_CUSTOM_WARNING_EXCEPTION "cc-3968 CC: WARNING File.*" # "implicit" truncation by static_cast "ld: warning: directory not found for option .-(F|L)" "warning.*This version of Mac OS X is unsupported" + "clang.*: warning: argument unused during compilation: .-g" # Ignore clang's summary warning, assuming prior text has matched some # other warning expression: -- cgit v0.12 From 4585e573b8dc0473bd1caf56da85d9f6e57f0d8f Mon Sep 17 00:00:00 2001 From: Alexey Ozeritsky Date: Sun, 5 Feb 2012 18:01:38 +0400 Subject: FindBLAS/FindLAPACK: Work with MKL version 10.3 (#12924, #12925) --- Modules/FindBLAS.cmake | 204 ++++++++++++++++++++++------------------------- Modules/FindLAPACK.cmake | 91 ++++++++++++++------- 2 files changed, 154 insertions(+), 141 deletions(-) diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 9b76d90..9eadfd1 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -23,6 +23,7 @@ ########## ### List of vendors (BLA_VENDOR) valid in this module ## Goto,ATLAS PhiPACK,CXML,DXML,SunPerf,SCSL,SGIMATH,IBMESSL,Intel10_32 (intel mkl v10 32 bit),Intel10_64lp (intel mkl v10 64 bit,lp thread model, lp64 model), +## Intel10_64lp_seq (intel mkl v10 64 bit,sequential code, lp64 model), ## Intel( older versions of mkl 32 and 64 bit), ACML,ACML_MP,ACML_GPU,Apple, NAS, Generic # C/CXX should be enabled to use Intel mkl @@ -85,6 +86,7 @@ if (NOT _libdir) set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH) endif () endif () + foreach(_library ${_list}) set(_combined_name ${_combined_name}_${_library}) @@ -115,7 +117,7 @@ foreach(_library ${_list}) endforeach(_library ${_list}) if(_libraries_work) # Test this combination of libraries. - set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_threads}) + set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_thread}) # message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") if (_CHECK_FORTRAN) check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) @@ -460,117 +462,99 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") else(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) find_package(Threads REQUIRED) endif(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) - if (WIN32) + + set(BLAS_SEARCH_LIBS "") + if(BLA_F95) - if(NOT BLAS95_LIBRARIES) - check_fortran_libraries( - BLAS95_LIBRARIES - BLAS - sgemm - "" - "mkl_blas95;mkl_intel_c;mkl_intel_thread;mkl_core;libguide40" - "" - ) - endif(NOT BLAS95_LIBRARIES) - else(BLA_F95) - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - SGEMM - "" - "mkl_c_dll;mkl_intel_thread_dll;mkl_core_dll;libguide40" - "" - ) - endif(NOT BLAS_LIBRARIES) - endif(BLA_F95) - else(WIN32) - if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") - if(BLA_F95) - if(NOT BLAS95_LIBRARIES) - check_fortran_libraries( - BLAS95_LIBRARIES - BLAS - sgemm - "" - "mkl_blas95;mkl_intel;mkl_intel_thread;mkl_core;guide" - "${CMAKE_THREAD_LIBS_INIT};${LM}" - ) - endif(NOT BLAS95_LIBRARIES) - else(BLA_F95) - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "mkl_intel;mkl_intel_thread;mkl_core;guide" - "${CMAKE_THREAD_LIBS_INIT}" - "${LM}" - ) - endif(NOT BLAS_LIBRARIES) - endif(BLA_F95) - endif (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") - if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All") - if(BLA_F95) - if(NOT BLAS95_LIBRARIES) - check_fortran_libraries( - BLAS95_LIBRARIES - BLAS - sgemm - "" - "mkl_blas95;mkl_intel_lp64;mkl_intel_thread;mkl_core;guide" - "${CMAKE_THREAD_LIBS_INIT};${LM}" - ) - endif(NOT BLAS95_LIBRARIES) - else(BLA_F95) - if(NOT BLAS_LIBRARIES) + set(BLAS_mkl_SEARCH_SYMBOL SGEMM) + set(_LIBRARIES BLAS95_LIBRARIES) + if (WIN32) + list(APPEND BLAS_SEARCH_LIBS + "mkl_blas95 mkl_intel_c mkl_intel_thread mkl_core libguide40") + else (WIN32) + if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS + "mkl_blas95 mkl_intel mkl_intel_thread mkl_core guide") + endif () + if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All") + # old version + list(APPEND BLAS_SEARCH_LIBS + "mkl_blas95 mkl_intel_lp64 mkl_intel_thread mkl_core guide") + + # mkl >= 10.3 + if (CMAKE_C_COMPILER MATCHES ".+gcc.*") + list(APPEND BLAS_SEARCH_LIBS + "mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core") + set(LM "${LM};-lgomp") + else () + list(APPEND BLAS_SEARCH_LIBS + "mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core iomp5") + endif () + endif () + endif (WIN32) + if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS + "mkl_blas95_lp64 mkl_intel_lp64 mkl_sequential mkl_core") + endif () + else (BLA_F95) + set(BLAS_mkl_SEARCH_SYMBOL sgemm) + set(_LIBRARIES BLAS_LIBRARIES) + if (WIN32) + list(APPEND BLAS_SEARCH_LIBS + "mkl_c_dll mkl_intel_thread_dll mkl_core_dll libguide40") + else (WIN32) + if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS + "mkl_intel mkl_intel_thread mkl_core guide") + endif () + if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All") + + # old version + list(APPEND BLAS_SEARCH_LIBS + "mkl_intel_lp64 mkl_intel_thread mkl_core guide") + + # mkl >= 10.3 + if (CMAKE_C_COMPILER MATCHES ".+gcc.*") + list(APPEND BLAS_SEARCH_LIBS + "mkl_intel_lp64 mkl_gnu_thread mkl_core") + set(LM "${LM};-lgomp") + else () + list(APPEND BLAS_SEARCH_LIBS + "mkl_intel_lp64 mkl_intel_thread mkl_core iomp5") + endif () + endif () + + #older vesions of intel mkl libs + if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS + "mkl") + list(APPEND BLAS_SEARCH_LIBS + "mkl_ia32") + list(APPEND BLAS_SEARCH_LIBS + "mkl_em64t") + endif () + endif (WIN32) + if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS + "mkl_intel_lp64 mkl_sequential mkl_core") + endif () + endif (BLA_F95) + + foreach (IT ${BLAS_SEARCH_LIBS}) + string(REPLACE " " ";" SEARCH_LIBS ${IT}) + if (${_LIBRARIES}) + else () check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "mkl_intel_lp64;mkl_intel_thread;mkl_core;guide" - "${CMAKE_THREAD_LIBS_INIT};${LM}" - ) - endif(NOT BLAS_LIBRARIES) - endif(BLA_F95) - endif (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All") - endif (WIN32) - #older vesions of intel mkl libs - # BLAS in intel mkl library? (shared) - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "mkl;guide" - "${CMAKE_THREAD_LIBS_INIT};${LM}" - ) - endif(NOT BLAS_LIBRARIES) - #BLAS in intel mkl library? (static, 32bit) - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "mkl_ia32;guide" - "${CMAKE_THREAD_LIBS_INIT};${LM}" - ) - endif(NOT BLAS_LIBRARIES) - #BLAS in intel mkl library? (static, em64t 64bit) - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "mkl_em64t;guide" - "${CMAKE_THREAD_LIBS_INIT};${LM}" - ) - endif(NOT BLAS_LIBRARIES) + ${_LIBRARIES} + BLAS + ${BLAS_mkl_SEARCH_SYMBOL} + "" + "${SEARCH_LIBS}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" + ) + endif () + endforeach () + endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) endif (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 884266f..0ae98df 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -219,40 +219,69 @@ if (BLA_VENDOR STREQUAL "Generic" OR endif ( NOT LAPACK_LIBRARIES ) endif () #intel lapack - if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") +if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") + if (NOT WIN32) + set(LM "-lm") + endif () if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) - if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) + if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) find_PACKAGE(Threads) - else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) - find_package(Threads REQUIRED) - endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) - if (BLA_F95) - if(NOT LAPACK95_LIBRARIES) - check_lapack_libraries( - LAPACK95_LIBRARIES - LAPACK - cheev - "" - "mkl_lapack95" - "${BLAS95_LIBRARIES}" - "${CMAKE_THREAD_LIBS_INIT}" - ) - endif(NOT LAPACK95_LIBRARIES) - else(BLA_F95) - if(NOT LAPACK_LIBRARIES) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "mkl_lapack" - "${BLAS_LIBRARIES}" - "${CMAKE_THREAD_LIBS_INIT}" - ) - endif(NOT LAPACK_LIBRARIES) - endif(BLA_F95) + else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) + find_package(Threads REQUIRED) + endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) + if (BLA_F95) + if(NOT LAPACK95_LIBRARIES) + # old + check_lapack_libraries( + LAPACK95_LIBRARIES + LAPACK + cheev + "" + "mkl_lapack95" + "${BLAS95_LIBRARIES}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" + ) + endif(NOT LAPACK95_LIBRARIES) + if(NOT LAPACK95_LIBRARIES) + # new >= 10.3 + check_lapack_libraries( + LAPACK95_LIBRARIES + LAPACK + CHEEV + "" + "mkl_intel_lp64" + "${BLAS95_LIBRARIES}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" + ) + endif(NOT LAPACK95_LIBRARIES) + else(BLA_F95) + if(NOT LAPACK_LIBRARIES) + # old + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "mkl_lapack" + "${BLAS_LIBRARIES}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" + ) + endif(NOT LAPACK_LIBRARIES) + if(NOT LAPACK_LIBRARIES) + # new >= 10.3 + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "mkl_gf_lp64" + "${BLAS_LIBRARIES}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" + ) + endif(NOT LAPACK_LIBRARIES) + endif(BLA_F95) endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) - endif(BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") +endif(BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") else(BLAS_FOUND) message(STATUS "LAPACK requires BLAS") endif(BLAS_FOUND) -- cgit v0.12 From d03606a19cc05872baf23269ae8ec61d2e0719e8 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Fri, 17 Feb 2012 00:05:08 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 1c285d0..c80c53f 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 16) +SET(KWSYS_DATE_STAMP_DAY 17) -- cgit v0.12 From 854e76237ce3e8f03d9cabcad1f8f37e04992ad3 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Fri, 17 Feb 2012 18:06:07 +0100 Subject: FindRuby: clean up querying variables from Ruby Newer Ruby versions (from 1.9 onward) seem to warn if you query Config::CONFIG and print a warning to use RbConfig instead. RbConfig seems to also work in older versions, at least in 1.8. Use a macro to query RbConfig first and only if that doesn't give anything fall back to Config. --- Modules/FindRuby.cmake | 57 +++++++++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake index c4adfd1..5e973e4 100644 --- a/Modules/FindRuby.cmake +++ b/Modules/FindRuby.cmake @@ -61,49 +61,44 @@ FIND_PROGRAM(RUBY_EXECUTABLE NAMES ${_RUBY_POSSIBLE_EXECUTABLE_NAMES}) IF(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR) - # query the ruby version - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['MAJOR']" - OUTPUT_VARIABLE RUBY_VERSION_MAJOR) + FUNCTION(_RUBY_CONFIG_VAR RBVAR OUTVAR) + EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['${RBVAR}']" + RESULT_VARIABLE _RUBY_SUCCESS + OUTPUT_VARIABLE _RUBY_OUTPUT + ERROR_QUIET) + IF(_RUBY_SUCCESS OR NOT _RUBY_OUTPUT) + EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['${RBVAR}']" + RESULT_VARIABLE _RUBY_SUCCESS + OUTPUT_VARIABLE _RUBY_OUTPUT + ERROR_QUIET) + ENDIF(_RUBY_SUCCESS OR NOT _RUBY_OUTPUT) + SET(${OUTVAR} "${_RUBY_OUTPUT}" PARENT_SCOPE) + ENDFUNCTION(_RUBY_CONFIG_VAR) - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['MINOR']" - OUTPUT_VARIABLE RUBY_VERSION_MINOR) - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['TEENY']" - OUTPUT_VARIABLE RUBY_VERSION_PATCH) + # query the ruby version + _RUBY_CONFIG_VAR("MAJOR" RUBY_VERSION_MAJOR) + _RUBY_CONFIG_VAR("MINOR" RUBY_VERSION_MINOR) + _RUBY_CONFIG_VAR("TEENY" RUBY_VERSION_PATCH) # query the different directories - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['archdir']" - OUTPUT_VARIABLE RUBY_ARCH_DIR) - - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['arch']" - OUTPUT_VARIABLE RUBY_ARCH) - - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['rubyhdrdir']" - OUTPUT_VARIABLE RUBY_HDR_DIR) - - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['libdir']" - OUTPUT_VARIABLE RUBY_POSSIBLE_LIB_DIR) - - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['rubylibdir']" - OUTPUT_VARIABLE RUBY_RUBY_LIB_DIR) + _RUBY_CONFIG_VAR("archdir" RUBY_ARCH_DIR) + _RUBY_CONFIG_VAR("arch" RUBY_ARCH) + _RUBY_CONFIG_VAR("rubyhdrdir" RUBY_HDR_DIR) + _RUBY_CONFIG_VAR("libdir" RUBY_POSSIBLE_LIB_DIR) + _RUBY_CONFIG_VAR("rubylibdir" RUBY_RUBY_LIB_DIR) # site_ruby - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['sitearchdir']" - OUTPUT_VARIABLE RUBY_SITEARCH_DIR) - - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['sitelibdir']" - OUTPUT_VARIABLE RUBY_SITELIB_DIR) + _RUBY_CONFIG_VAR("sitearchdir" RUBY_SITEARCH_DIR) + _RUBY_CONFIG_VAR("sitelibdir" RUBY_SITELIB_DIR) # vendor_ruby available ? EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r vendor-specific -e "print 'true'" OUTPUT_VARIABLE RUBY_HAS_VENDOR_RUBY ERROR_QUIET) IF(RUBY_HAS_VENDOR_RUBY) - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['vendorlibdir']" - OUTPUT_VARIABLE RUBY_VENDORLIB_DIR) - - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['vendorarchdir']" - OUTPUT_VARIABLE RUBY_VENDORARCH_DIR) + _RUBY_CONFIG_VAR("vendorlibdir" RUBY_VENDORLIB_DIR) + _RUBY_CONFIG_VAR("vendorarchdir" RUBY_VENDORARCH_DIR) ENDIF(RUBY_HAS_VENDOR_RUBY) # save the results in the cache so we don't have to run ruby the next time again -- cgit v0.12 From 70697a85a0bd273c0b1773471b7ae11b2c7ceb57 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Fri, 17 Feb 2012 18:16:35 +0100 Subject: FindLibXslt: support version selection --- Modules/FindLibXslt.cmake | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Modules/FindLibXslt.cmake b/Modules/FindLibXslt.cmake index 1e42f42..dd5aac4 100644 --- a/Modules/FindLibXslt.cmake +++ b/Modules/FindLibXslt.cmake @@ -5,6 +5,7 @@ # LIBXSLT_INCLUDE_DIR - the LibXslt include directory # LIBXSLT_LIBRARIES - Link these to LibXslt # LIBXSLT_DEFINITIONS - Compiler switches required for using LibXslt +# LIBXSLT_VERSION_STRING - version of LibXslt found (since CMake 2.8.8) # Additionally, the following two variables are set (but not required for using xslt): # LIBXSLT_EXSLT_LIBRARIES - Link to these if you need to link against the exslt library # LIBXSLT_XSLTPROC_EXECUTABLE - Contains the full path to the xsltproc executable if found @@ -51,10 +52,21 @@ SET(LIBXSLT_EXSLT_LIBRARIES ${LIBXSLT_EXSLT_LIBRARY} ) FIND_PROGRAM(LIBXSLT_XSLTPROC_EXECUTABLE xsltproc) -# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if -# all listed variables are TRUE +IF(PC_LIBXSLT_VERSION) + SET(LIBXSLT_VERSION_STRING ${PC_LIBXSLT_VERSION}) +ELSEIF(LIBXSLT_INCLUDE_DIR AND EXISTS "${LIBXSLT_INCLUDE_DIR}/libxslt/xsltconfig.h") + FILE(STRINGS "${LIBXSLT_INCLUDE_DIR}/libxslt/xsltconfig.h" libxslt_version_str + REGEX "^#define[\t ]+LIBXSLT_DOTTED_VERSION[\t ]+\".*\"") + + STRING(REGEX REPLACE "^#define[\t ]+LIBXSLT_DOTTED_VERSION[\t ]+\"([^\"]*)\".*" "\\1" + LIBXSLT_VERSION_STRING "${libxslt_version_str}") + UNSET(libxslt_version_str) +ENDIF() + INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXslt DEFAULT_MSG LIBXSLT_LIBRARIES LIBXSLT_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXslt + REQUIRED_VARS LIBXSLT_LIBRARIES LIBXSLT_INCLUDE_DIR + VERSION_VAR LIBXSLT_VERSION_STRING) MARK_AS_ADVANCED(LIBXSLT_INCLUDE_DIR LIBXSLT_LIBRARIES -- cgit v0.12 From f58cce031e7c641c0ae216a66595837eb1b4dee7 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Fri, 17 Feb 2012 18:31:23 +0100 Subject: FindFreetype: support version selection --- Modules/FindFreetype.cmake | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake index 6251805..e6f6702 100644 --- a/Modules/FindFreetype.cmake +++ b/Modules/FindFreetype.cmake @@ -3,6 +3,7 @@ # FREETYPE_LIBRARIES, the library to link against # FREETYPE_FOUND, if false, do not try to link to FREETYPE # FREETYPE_INCLUDE_DIRS, where to find headers. +# FREETYPE_VERSION_STRING, the version of freetype found (since CMake 2.8.8) # This is the concatenation of the paths: # FREETYPE_INCLUDE_DIR_ft2build # FREETYPE_INCLUDE_DIR_freetype2 @@ -77,10 +78,33 @@ IF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2) ENDIF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2) SET(FREETYPE_LIBRARIES "${FREETYPE_LIBRARY}") +IF(FREETYPE_INCLUDE_DIR_freetype2 AND EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h") + FILE(STRINGS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h" freetype_version_str + REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$") + + UNSET(FREETYPE_VERSION_STRING) + FOREACH(VPART MAJOR MINOR PATCH) + FOREACH(VLINE ${freetype_version_str}) + IF(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}") + STRING(REGEX REPLACE "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$" "\\1" + FREETYPE_VERSION_PART "${VLINE}") + IF(FREETYPE_VERSION_STRING) + SET(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_STRING}.${FREETYPE_VERSION_PART}") + ELSE(FREETYPE_VERSION_STRING) + SET(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_PART}") + ENDIF(FREETYPE_VERSION_STRING) + UNSET(FREETYPE_VERSION_PART) + ENDIF() + ENDFOREACH(VLINE) + ENDFOREACH(VPART) +ENDIF(FREETYPE_INCLUDE_DIR_freetype2 AND EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h") + + # handle the QUIETLY and REQUIRED arguments and set FREETYPE_FOUND to TRUE if # all listed variables are TRUE INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Freetype DEFAULT_MSG FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS) - +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Freetype + REQUIRED_VARS FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS + VERSION_VAR FREETYPE_VERSION_STRING) MARK_AS_ADVANCED(FREETYPE_LIBRARY FREETYPE_INCLUDE_DIR_freetype2 FREETYPE_INCLUDE_DIR_ft2build) -- cgit v0.12 From 378f2291593c5b1d7d9fcd03029b931ce674a3d2 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Fri, 17 Feb 2012 21:02:08 +0100 Subject: Tests: document where to put tests --- Tests/README | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Tests/README diff --git a/Tests/README b/Tests/README new file mode 100644 index 0000000..9b0f5c1 --- /dev/null +++ b/Tests/README @@ -0,0 +1,34 @@ +If you think about adding a new testcase then here is a small checklist you +can run through to find a proper place for it. Go through the list from the +beginning and stop once you find something that matches your tests needs, +i.e. if you will test a module and only need the configure mode use the +instructions from section 2, not 3. + +1. Your testcase can run in CMake script mode, i.e. "cmake -P something" + +Put your test in Tests/CMakeTests/ directory as a .cmake.in file. It will be +put into the test binary directory by configure_file(... @ONLY) and run from +there. Use the AddCMakeTest() macro in Tests/CMakeTests/CMakeLists.txt to add +your test to the test runs. + +2. Your test needs CMake to run in configure mode, but will not build anything + +This includes tests that will build something using try_compile() and friends, +but nothing that expects add_executable(), add_library(), or add_test() to run. + +If this matches your test you should put it into the Tests/CMakeOnly/ directory. +Create a subdirectory named like your test and write the CMakeLists.txt you +need into that subdirectory. Use the add_CMakeOnly_test() macro from +Tests/CMakeOnly/CMakeLists.txt to add your test to the test runs. + +3. If you are testing something from the Modules directory + +Put your test in the Tests/Modules/ directory. Create a subdirectory there +named after your test. Use the ADD_TEST_MACRO macro from Tests/CMakeLists.txt +to add your test to the test run. If you have put your stuff in +Tests/Modules/Foo then you call it using ADD_TEST_MACRO(Module.Foo Foo). + +4. You are doing other stuff. + +Find a good place ;) In doubt mail to cmake-developers@cmake.org and ask for +advise. -- cgit v0.12 From bfbb57508603ab6c7007d75718b21868b690e151 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sat, 18 Feb 2012 00:05:12 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index c80c53f..2bf0e14 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 17) +SET(KWSYS_DATE_STAMP_DAY 18) -- cgit v0.12 From 27501155c7bcc04ada498407ad3d6fd40dbea2bd Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Sat, 18 Feb 2012 11:57:38 +0100 Subject: FindPkgConfig: support version selection of pkg-config itself --- Modules/FindPkgConfig.cmake | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index ce58899..5d93ab1 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -13,14 +13,17 @@ # When the 'QUIET' argument is set, no status messages will be printed. # # It sets the following variables: -# PKG_CONFIG_FOUND ... true if pkg-config works on the system -# PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program -# _FOUND ... set to 1 if module(s) exist +# PKG_CONFIG_FOUND ... true if pkg-config works on the system +# PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program +# PKG_CONFIG_VERSION_STRING ... the version of the pkg-config program found +# (since CMake 2.8.8) +# PKG_CONFIG_FOUND ... if pkg-config executable was found # # For the following variables two sets of values exist; first one is the # common one and has the given PREFIX. The second set contains flags # which are given out when pkgconfig was called with the '--static' # option. +# _FOUND ... set to 1 if module(s) exist # _LIBRARIES ... only the libraries (w/o the '-l') # _LIBRARY_DIRS ... the paths of the libraries (w/o the '-L') # _LDFLAGS ... all required linker flags @@ -89,9 +92,17 @@ set(PKG_CONFIG_VERSION 1) find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config DOC "pkg-config executable") mark_as_advanced(PKG_CONFIG_EXECUTABLE) -include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -find_package_handle_standard_args(PkgConfig DEFAULT_MSG PKG_CONFIG_EXECUTABLE) +if (PKG_CONFIG_EXECUTABLE) + execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --version + OUTPUT_VARIABLE PKG_CONFIG_VERSION_STRING + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) +endif (PKG_CONFIG_EXECUTABLE) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +find_package_handle_standard_args(PkgConfig + REQUIRED_VARS PKG_CONFIG_EXECUTABLE + VERSION_VAR PKG_CONFIG_VERSION_STRING) # Unsets the given variables macro(_pkgconfig_unset var) -- cgit v0.12 From d36d29f1f079c58bf7d5993da442e4296c7f82a8 Mon Sep 17 00:00:00 2001 From: Modestas Vainius Date: Sat, 18 Feb 2012 16:11:18 +0100 Subject: various typo and formatting fixes in manual pages (#12975) The patch fixes the following lintian warnings: W: cmake-data: manpage-has-errors-from-man usr/share/man/man1/cmakemodules.1.gz 2728: warning: macro `..' not defined I: cmake-data: spelling-error-in-manpage usr/share/man/man1/cmakemodules.1.gz overriden overridden I: cmake-data: spelling-error-in-manpage usr/share/man/man1/cmakemodules.1.gz overriden overridden I: cmake-data: spelling-error-in-manpage usr/share/man/man1/cmakemodules.1.gz explicitely explicitly I: cmake-data: spelling-error-in-manpage usr/share/man/man1/cmakemodules.1.gz jave java W: cmake-data: manpage-has-errors-from-man usr/share/man/man1/cmakeprops.1.gz 1040: warning [p 25, 3.7i]: can't break line W: cmake: manpage-has-errors-from-man usr/share/man/man1/cmake.1.gz 4233: warning [p 85, 1.3i]: can't break line I: cmake: spelling-error-in-manpage usr/share/man/man1/cmake.1.gz overriden overridden I: cmake: spelling-error-in-manpage usr/share/man/man1/cmake.1.gz overriden overridden I: cmake: spelling-error-in-manpage usr/share/man/man1/cmake.1.gz explicitely explicitly I: cmake: spelling-error-in-manpage usr/share/man/man1/cmake.1.gz jave java --- Modules/CPackRPM.cmake | 6 +++--- Modules/FeatureSummary.cmake | 2 +- Modules/UseJava.cmake | 2 +- Source/cmTarget.cxx | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index f76e91e..9b6329a 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -183,7 +183,7 @@ # The refered script file(s) will be read and directly # put after the %pre or %preun section # If CPACK_RPM_COMPONENT_INSTALL is set to ON the (un)install script for -# each component can be overriden with +# each component can be overridden with # CPACK_RPM__PRE_INSTALL_SCRIPT_FILE and # CPACK_RPM__PRE_UNINSTALL_SCRIPT_FILE # One may verify which scriptlet has been included with @@ -198,7 +198,7 @@ # The refered script file(s) will be read and directly # put after the %post or %postun section # If CPACK_RPM_COMPONENT_INSTALL is set to ON the (un)install script for -# each component can be overriden with +# each component can be overridden with # CPACK_RPM__POST_INSTALL_SCRIPT_FILE and # CPACK_RPM__POST_UNINSTALL_SCRIPT_FILE # One may verify which scriptlet has been included with @@ -209,7 +209,7 @@ # CPACK_RPM__USER_FILELIST # Mandatory : NO # Default : - -# May be used to explicitely specify %() file line +# May be used to explicitly specify %() file line # in the spec file. Like %config(noreplace) or any other directive # that be found in the %files section. Since CPackRPM is generating # the list of files (and directories) the user specified files of diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake index eb10cbc..cef647e 100644 --- a/Modules/FeatureSummary.cmake +++ b/Modules/FeatureSummary.cmake @@ -125,7 +125,7 @@ # # set_package_properties(LibXml2 PROPERTIES TYPE RECOMMENDED # PURPOSE "Enables HTML-import in MyWordProcessor") -# ... +# ... # set_package_properties(LibXml2 PROPERTIES TYPE OPTIONAL # PURPOSE "Enables odt-export in MyWordProcessor") # diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index 1dfa3c0..84d0afd 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -121,7 +121,7 @@ # [VERSION TRUE|FALSE] # ) # -# Create jave documentation based on files or packages. For more +# Create java documentation based on files or packages. For more # details please read the javadoc manpage. # # There are two main signatures for create_javadoc. The first diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index ae5596b..0c79b30 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1047,10 +1047,10 @@ void cmTarget::DefineProperties(cmake *cm) "Can be set to one or more UUIDs recognized by Visual Studio " "to indicate the type of project. This value is copied " "verbatim into the generated project file. Example for a " - "managed C++ unit testing project: \"" - "{3AC096D0-A1C2-E12C-1390-A8335801FDAB};" - "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\". UUIDs are " - "semicolon-delimited."); + "managed C++ unit testing project:\n" + " {3AC096D0-A1C2-E12C-1390-A8335801FDAB};" + "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\n" + "UUIDs are semicolon-delimited."); cm->DefineProperty ("VS_GLOBAL_KEYWORD", cmProperty::TARGET, "Visual Studio project keyword.", -- cgit v0.12 From 7ec2ebdbcfcc90fca928ca79cb3b719177503d2d Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Sat, 18 Feb 2012 16:13:34 +0100 Subject: fix the same typos as found by Debian in other places, too --- Modules/FindCUDA.cmake | 2 +- Modules/FindImageMagick.cmake | 2 +- Tests/CMakeOnly/AllFindModules/CMakeLists.txt | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 4d91a92..9f8d575 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -906,7 +906,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) message( FATAL_ERROR "Invalid format flag passed to CUDA_WRAP_SRCS: '${format}'. Use OBJ or PTX.") endif() - # Set up all the command line flags here, so that they can be overriden on a per target basis. + # Set up all the command line flags here, so that they can be overridden on a per target basis. set(nvcc_flags "") diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake index 75523f4..52d575b 100644 --- a/Modules/FindImageMagick.cmake +++ b/Modules/FindImageMagick.cmake @@ -169,7 +169,7 @@ FOREACH(component ${ImageMagick_FIND_COMPONENTS} LIST(APPEND ImageMagick_REQUIRED_VARS ImageMagick_${component}_EXECUTABLE) ENDIF(is_requested GREATER -1) ELSEIF(ImageMagick_${component}_EXECUTABLE) - # if no components were requested explicitely put all (default) executables + # if no components were requested explicitly put all (default) executables # in the list LIST(APPEND ImageMagick_DEFAULT_EXECUTABLES "${ImageMagick_${component}_EXECUTABLE}") ENDIF(ImageMagick_FIND_COMPONENTS) diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index f76f0d9..ec09aa5 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -16,16 +16,16 @@ macro(do_find MODULE_NAME) endmacro(do_find) # It is only possible to use either Qt3 or Qt4 in one project. -# Since FindQt will complain if both are found we explicitely -# filter out this and FindQt3. FindKDE3 also depends on Qt3 and +# Since FindQt will complain if both are found we explicitly request Qt4 here +# and filter out FindQt3. FindKDE3 also depends on Qt3 and # is therefore also blocked +set(DESIRED_QT_VERSION 4) set(NO_QT4_MODULES "Qt3" "KDE3") # These modules are named Find*.cmake, but are nothing that works in # find_package(). set(NO_FIND_MODULES "PackageHandleStandardArgs" "PackageMessage") -set(DESIRED_QT_VERSION 4) foreach(FIND_MODULE ${FIND_MODULES}) string(REGEX REPLACE ".*/Find(.*)\\.cmake$" "\\1" MODULE_NAME "${FIND_MODULE}") -- cgit v0.12 From 70f362305f20cc1e915a8b0289751d4ed41b60ca Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 15 Feb 2012 19:55:57 +0100 Subject: Find_library(): allow searching for versioned shared objects This did not work because find_library() did only treat the given name as complete filename if is matched "PREFIX.*SUFFIX": find_library(MYLIB libfoo.so.2) Now it is also taken as a whole if the name matches "PREFIX.*SUFFIX\..*". --- Source/cmFindLibraryCommand.cxx | 18 ++++++++++++++---- Tests/Complex/CMakeLists.txt | 32 +++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 2fa2cca..a726849 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -354,13 +354,23 @@ void cmFindLibraryHelper::RegexFromList(std::string& out, //---------------------------------------------------------------------------- bool cmFindLibraryHelper::HasValidSuffix(std::string const& name) { - // Check if the given name ends in a valid library suffix. for(std::vector::const_iterator si = this->Suffixes.begin(); si != this->Suffixes.end(); ++si) { - std::string const& suffix = *si; - if(name.length() > suffix.length() && - name.substr(name.size()-suffix.length()) == suffix) + std::string suffix = *si; + if(name.length() <= suffix.length()) + { + continue; + } + // Check if the given name ends in a valid library suffix. + if(name.substr(name.size()-suffix.length()) == suffix) + { + return true; + } + // Check if a valid library suffix is somewhere in the name, + // this may happen e.g. for versioned shared libraries: libfoo.so.2 + suffix += "."; + if(name.find(suffix) != name.npos) { return true; } diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index b505019..ec3ad39 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -199,7 +199,9 @@ CONFIGURE_FILE( ${Complex_SOURCE_DIR}/Library/dummy ${Complex_BINARY_DIR}/Library/dummylib.lib COPYONLY IMMEDIATE) -FOREACH (ext ${CMAKE_SHLIB_SUFFIX};.so;.a;.sl) +FOREACH (ext ${CMAKE_SHLIB_SUFFIX};.so;.a;.sl + ${CMAKE_SHARED_LIBRARY_SUFFIX}.2 + ${CMAKE_STATIC_LIBRARY_SUFFIX}.2) CONFIGURE_FILE( ${Complex_SOURCE_DIR}/Library/dummy ${Complex_BINARY_DIR}/Library/libdummylib${ext} @@ -216,6 +218,34 @@ FIND_LIBRARY(FIND_DUMMY_LIB PATHS ${Complex_BINARY_DIR}/Library DOC "find dummy lib") +# This doesn't work for platforms that have a shared library and an import +# library, like Windows with .dll and .lib. Limit is to ".so" now because it's +# known to work there. +IF(CMAKE_SHARED_LIBRARY_SUFFIX STREQUAL ".so") + FIND_LIBRARY(FIND_DUMMY_SHLIB_VERSIONED + NAMES libdummylib${CMAKE_SHARED_LIBRARY_SUFFIX}.2 + PATHS ${Complex_BINARY_DIR}/Library + DOC "find versioned dummy shared lib" + NO_DEFAULT_PATH) + + IF(NOT FIND_DUMMY_SHLIB_VERSIONED MATCHES "/libdummylib${CMAKE_SHARED_LIBRARY_SUFFIX}.2") + MESSAGE(SEND_ERROR "FIND_DUMMY_SHLIB_VERSIONED is not set correctly: " + "${FIND_DUMMY_SHLIB_VERSIONED}") + ENDIF() +ENDIF() + +# Static library, should work everywhere +FIND_LIBRARY(FIND_DUMMY_STLIB_VERSIONED + NAMES libdummylib${CMAKE_STATIC_LIBRARY_SUFFIX}.2 + PATHS ${Complex_BINARY_DIR}/Library + DOC "find versioned dummy static lib" + NO_DEFAULT_PATH) + +IF(NOT FIND_DUMMY_STLIB_VERSIONED MATCHES "/libdummylib${CMAKE_STATIC_LIBRARY_SUFFIX}.2") + MESSAGE(SEND_ERROR "FIND_DUMMY_STLIB_VERSIONED is not set correctly: " + "${FIND_DUMMY_STLIB_VERSIONED}") +ENDIF() + # # Test SET_SOURCE_FILES_PROPERTIES # -- cgit v0.12 From 540db7e5b9bea875894ae5ed70499f1984b75e4d Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Fri, 17 Feb 2012 18:46:23 +0100 Subject: AllFindModules test: expect more modules to have a version number available For all current build machines the modules FindPkgConfig, FindFreetype, and FindLibXslt return a version number. Enforce this to early catch when this is not always the case. --- Tests/CMakeOnly/AllFindModules/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index f76f0d9..7a8a575 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -48,8 +48,9 @@ endif (NOT QT4_FOUND) # If any of these modules reported that it was found a version number should have been # reported. set(VERSIONS_REQUIRED - ALSA BISON BZIP2 CUPS CURL DOXYGEN EXPAT FLEX GETTEXT GIF GIT - ImageMagick JASPER LibArchive LIBXML2 PERL PostgreSQL SWIG TIFF ZLIB) + ALSA BISON BZIP2 CUPS CURL DOXYGEN EXPAT FLEX FREETYPE GETTEXT GIF GIT + ImageMagick JASPER LibArchive LIBXML2 LIBXSLT PERL PKG_CONFIG PostgreSQL + SWIG TIFF ZLIB) foreach(VTEST ${VERSIONS_REQUIRED}) if (${VTEST}_FOUND) -- cgit v0.12 From 6f573ac9ee95cb7c05c8b37c9b192f4616747214 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 8 Feb 2012 19:23:38 +0100 Subject: FindOpenMP: try the most likely flags first Since we know which compiler we have we can test those OpenMP flags first that are likely to be correct. This doesn't make any difference for GNU compilers, but it should avoid useless try_compiles and output cluttering for all others. --- Modules/FindOpenMP.cmake | 99 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 67 insertions(+), 32 deletions(-) diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index ceac8d2..e1af15e 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -1,7 +1,7 @@ # - Finds OpenMP support # This module can be used to detect OpenMP support in a compiler. # If the compiler supports OpenMP, the flags required to compile with -# openmp support are set. +# openmp support are set. # # The following variables are set: # OpenMP_C_FLAGS - flags to add to the C compiler for OpenMP support @@ -13,6 +13,7 @@ #============================================================================= # Copyright 2009 Kitware, Inc. # Copyright 2008-2009 André Rigland Brodtkorb +# Copyright 2012 Rolf Eike Beer # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -31,27 +32,52 @@ unset(_ENABLED_LANGUAGES) set(_OPENMP_REQUIRED_VARS) -set(OpenMP_C_FLAG_CANDIDATES - #Gnu - "-fopenmp" - #Microsoft Visual Studio - "/openmp" - #Intel windows - "-Qopenmp" - #Intel - "-openmp" - #Empty, if compiler automatically accepts openmp - " " - #Sun - "-xopenmp" - #HP - "+Oopenmp" - #IBM XL C/c++ - "-qsmp" - #Portland Group - "-mp" -) -set(OpenMP_CXX_FLAG_CANDIDATES ${OpenMP_C_FLAG_CANDIDATES}) +function(_OPENMP_FLAG_CANDIDATES LANG) + set(OpenMP_FLAG_CANDIDATES + #GNU + "-fopenmp" + #Microsoft Visual Studio + "/openmp" + #Intel windows + "-Qopenmp" + #PathScale, Intel + "-openmp" + #Empty, if compiler automatically accepts openmp + " " + #Sun + "-xopenmp" + #HP + "+Oopenmp" + #IBM XL C/c++ + "-qsmp" + #Portland Group, MIPSpro + "-mp" + ) + + set(OMP_FLAG_GNU "-fopenmp") + set(OMP_FLAG_HP "+Oopenmp") + if(WIN32) + set(OMP_FLAG_Intel "-Qopenmp") + else() + set(OMP_FLAG_Intel "-openmp") + endif() + set(OMP_FLAG_MIPSpro "-mp") + set(OMP_FLAG_MSVC "/openmp") + set(OMP_FLAG_PathScale "-openmp") + set(OMP_FLAG_PGI "-mp") + set(OMP_FLAG_SunPro "-xopenmp") + set(OMP_FLAG_XL "-qsmp") + + # Move the flag that matches the compiler to the head of the list, + # this is faster and doesn't clutter the output that much. If that + # flag doesn't work we will still try all. + if(OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID}) + list(REMOVE_ITEM OpenMP_FLAG_CANDIDATES "${OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID}}") + list(INSERT OpenMP_FLAG_CANDIDATES 0 "${OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID}}") + endif() + + set(OpenMP_${LANG}_FLAG_CANDIDATES "${OpenMP_FLAG_CANDIDATES}" PARENT_SCOPE) +endfunction(_OPENMP_FLAG_CANDIDATES) # sample openmp source code to test set(OpenMP_C_TEST_SOURCE @@ -65,16 +91,17 @@ int main() { #endif } ") -# if these are set then do not try to find them again, -# by avoiding any try_compiles for the flags -if(DEFINED OpenMP_C_FLAGS AND DEFINED OpenMP_CXX_FLAGS) - set(OpenMP_C_FLAG_CANDIDATES) - set(OpenMP_CXX_FLAG_CANDIDATES) -endif(DEFINED OpenMP_C_FLAGS AND DEFINED OpenMP_CXX_FLAGS) # check c compiler if(NOT _HAVE_LANGUAGE_C EQUAL -1) - include(CheckCSourceCompiles) + # if these are set then do not try to find them again, + # by avoiding any try_compiles for the flags + if(OpenMP_C_FLAGS) + unset(OpenMP_C_FLAG_CANDIDATES) + else() + _OPENMP_FLAG_CANDIDATES("C") + include(CheckCSourceCompiles) + endif() foreach(FLAG ${OpenMP_C_FLAG_CANDIDATES}) set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") @@ -98,9 +125,17 @@ endif() # check cxx compiler if(NOT _HAVE_LANGUAGE_CXX EQUAL -1) - include(CheckCXXSourceCompiles) - # use the same source for CXX as C for now - set(OpenMP_CXX_TEST_SOURCE ${OpenMP_C_TEST_SOURCE}) + # if these are set then do not try to find them again, + # by avoiding any try_compiles for the flags + if(OpenMP_CXX_FLAGS) + unset(OpenMP_CXX_FLAG_CANDIDATES) + else() + _OPENMP_FLAG_CANDIDATES("CXX") + include(CheckCXXSourceCompiles) + + # use the same source for CXX as C for now + set(OpenMP_CXX_TEST_SOURCE ${OpenMP_C_TEST_SOURCE}) + endif() foreach(FLAG ${OpenMP_CXX_FLAG_CANDIDATES}) set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") -- cgit v0.12 From 54e1f6f5a572e47c5598fd53e3b9eb0a66739def Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Sat, 18 Feb 2012 20:58:19 +0100 Subject: GenerateExportHeader: use double quotes around _gcc_version The GenerateExportHeaders test was failing on one machine, the version could not be determined there, so the _gcc_version was empty, so the first argument to if() was empty, so it complained: http://open.cdash.org/testDetails.php?test=135623436&build=2016288 Use double quotes to turn the non-existant first argument into an empty string. Alex --- Modules/GenerateExportHeader.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index 781b6e7..f3f61f6 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -173,7 +173,7 @@ macro(_test_compiler_hidden_visibility) _gcc_version "${_gcc_version_info}") endif() - if(${_gcc_version} VERSION_LESS "4.2") + if("${_gcc_version}" VERSION_LESS "4.2") set(GCC_TOO_OLD TRUE) message(WARNING "GCC version older than 4.2") endif() -- cgit v0.12 From a6bce55aefd332f148a2753d5be0ec4383534473 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 18 Feb 2012 22:07:39 +0100 Subject: Dynamically add documentation section specified in documented script. Modify CPackDeb and CPackRPM as an example --- Modules/CPackDeb.cmake | 2 +- Modules/CPackRPM.cmake | 2 +- Source/CPack/cpack.cxx | 3 +-- Source/cmDocumentation.cxx | 21 ++++++++++++++++++--- Source/cmDocumentation.h | 6 ++++-- 5 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 0916843..fe81dc9 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -1,4 +1,4 @@ -##section Variables specific to a CPack generator +##section Variables specific to CPack Debian (DEB) generator ##end ##module # - The builtin (binary) CPack Deb generator (Unix only) diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index f76e91e..ae81ab7 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -1,4 +1,4 @@ -##section Variables specific to a CPack generator +##section Variables specific to CPack RPM generator ##end ##module # - The builtin (binary) CPack RPM generator (Unix only) diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index c541610..6f5055c 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -514,7 +514,6 @@ int main (int argc, char *argv[]) if ( help ) { // Construct and print requested documentation. - std::vector variables; doc.SetName("cpack"); doc.SetSection("Name",cmDocumentationName); @@ -545,7 +544,7 @@ int main (int argc, char *argv[]) { doc.GetStructuredDocFromFile( (docedIt->first).c_str(), - commands,&cminst,(docedIt->second).c_str()); + commands,&cminst); } std::map propDocs; diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 02f69f1..17e35d8 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -745,6 +745,18 @@ void cmDocumentation::addCPackStandardDocSections() "Variables specific to a CPack generator"); } +void cmDocumentation::addAutomaticVariableSections(const std::string& section) +{ + std::vector::iterator it; + it = find(this->VariableSections.begin(), + this->VariableSections.end(), + section); + /* if the section does not exist then add it */ + if (it==this->VariableSections.end()) + { + this->VariableSections.push_back(section); + } +} //---------------------------------------------------------------------------- int cmDocumentation::getDocumentedModulesListInDir( std::string path, @@ -818,8 +830,7 @@ static void trim(std::string& s) int cmDocumentation::GetStructuredDocFromFile( const char* fname, std::vector& commands, - cmake* cm, - const char *docSection) + cmake* cm) { typedef enum sdoce { SDOC_NONE, SDOC_MODULE, SDOC_MACRO, SDOC_FUNCTION, SDOC_VARIABLE, @@ -835,6 +846,7 @@ int cmDocumentation::GetStructuredDocFromFile( { return nbDocItemFound; } + std::string section; std::string name; std::string full; std::string brief; @@ -886,6 +898,8 @@ int cmDocumentation::GetStructuredDocFromFile( { docCtxIdx++; docContextStack[docCtxIdx]=SDOC_SECTION; + // 10 is the size of '##section' + 1 + section = line.substr(10,std::string::npos); /* drop the rest of the line */ line = ""; newCtx = true; @@ -900,11 +914,12 @@ int cmDocumentation::GetStructuredDocFromFile( brief.c_str(),full.c_str())); break; case SDOC_VARIABLE: + this->addAutomaticVariableSections(section); cm->DefineProperty (name.c_str(), cmProperty::VARIABLE, brief.c_str(), full.c_str(),false, - docSection); + section.c_str()); break; case SDOC_MODULE: /* not implemented */ diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index 00dba1a..11bef16 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -147,6 +147,9 @@ public: /** Add the CPack standard documentation section(s) */ void addCPackStandardDocSections(); + /** Add automatic variables sections */ + void addAutomaticVariableSections(const std::string& section); + /** * Retrieve the list of documented module located in * path which match the globing expression globExpr. @@ -185,8 +188,7 @@ public: */ int GetStructuredDocFromFile(const char* fname, std::vector& commands, - cmake* cm, - const char *docSection); + cmake* cm); private: void SetForm(Form f); void SetDocName(const char* docname); -- cgit v0.12 From b8a274c091b63e6203b61f5aee40393d1409c9fc Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 18 Feb 2012 22:10:19 +0100 Subject: Add structured documentation for NSIS --- Modules/CPackNSIS.cmake | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/Modules/CPackNSIS.cmake b/Modules/CPackNSIS.cmake index d9dab53..093d0fc 100644 --- a/Modules/CPackNSIS.cmake +++ b/Modules/CPackNSIS.cmake @@ -1,70 +1,112 @@ +##section Variables specific to CPack Debian (DEB) generator +##end +##module # - CPack NSIS generator specific options # # The following variables are specific to the graphical installers built # on Windows using the Nullsoft Installation System. +##end # +##variable # CPACK_PACKAGE_INSTALL_REGISTRY_KEY - Registry key used when # installing this project. +##end # +##variable # CPACK_NSIS_INSTALL_ROOT - The default installation directory presented # to the end user by the NSIS installer is under this root dir. The full # directory presented to the end user is: # ${CPACK_NSIS_INSTALL_ROOT}/${CPACK_PACKAGE_INSTALL_DIRECTORY} +##end # +##variable # CPACK_NSIS_MUI_ICON - The icon file (.ico) for the generated # install program. +##end # +##variable # CPACK_NSIS_MUI_UNIICON - The icon file (.ico) for the generated # uninstall program. +##end # +##variable # CPACK_PACKAGE_ICON - A branding image that will be displayed inside # the installer. +##end # +##variable # CPACK_NSIS_EXTRA_INSTALL_COMMANDS - Extra NSIS commands that will # be added to the install Section. +##end # +##variable # CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS - Extra NSIS commands that will # be added to the uninstall Section. +##end # +##variable # CPACK_NSIS_COMPRESSOR - The arguments that will be passed to the # NSIS SetCompressor command. +##end # +##variable # CPACK_NSIS_MODIFY_PATH - If this is set to "ON", then an extra page # will appear in the installer that will allow the user to choose # whether the program directory should be added to the system PATH # variable. +##end # +##variable # CPACK_NSIS_DISPLAY_NAME - The display name string that appears in # the Windows Add/Remove Program control panel +##end # +##variable # CPACK_NSIS_PACKAGE_NAME - The title displayed at the top of the # installer. +##end # +##variable # CPACK_NSIS_INSTALLED_ICON_NAME - A path to the executable that # contains the installer icon. +##end # +##variable # CPACK_NSIS_HELP_LINK - URL to a web site providing assistance in # installing your application. +##end # +##variable # CPACK_NSIS_URL_INFO_ABOUT - URL to a web site providing more # information about your application. +##end # +##variable # CPACK_NSIS_CONTACT - Contact information for questions and comments # about the installation process. +##end # +##variable # CPACK_NSIS_CREATE_ICONS_EXTRA - Additional NSIS commands for # creating start menu shortcuts. +##end # +##variable # CPACK_NSIS_DELETE_ICONS_EXTRA -Additional NSIS commands to # uninstall start menu shortcuts. +##end # +##variable # CPACK_NSIS_EXECUTABLES_DIRECTORY - Creating NSIS start menu links # assumes that they are in 'bin' unless this variable is set. # For example, you would set this to 'exec' if your executables are # in an exec directory. +##end # +##variable # CPACK_NSIS_MUI_FINISHPAGE_RUN - Specify an executable to add an option # to run on the finish page of the NSIS installer. +##end #============================================================================= # Copyright 2006-2009 Kitware, Inc. -- cgit v0.12 From 7a8f44a2d6d23ec0345a1413f3a79c21f9566456 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 18 Feb 2012 22:14:45 +0100 Subject: Add structure documentation for CPack Bundle generator --- Modules/CPackBundle.cmake | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Modules/CPackBundle.cmake b/Modules/CPackBundle.cmake index 3ac4ea8..007fc04 100644 --- a/Modules/CPackBundle.cmake +++ b/Modules/CPackBundle.cmake @@ -1,25 +1,37 @@ +##section Variables specific to CPack Bundle generator +##end +##module # - CPack Bundle generator (Mac OS X) specific options # # Installers built on Mac OS X using the Bundle generator use the # aforementioned DragNDrop variables, plus the following Bundle-specific # parameters: +##end # +##variable # CPACK_BUNDLE_NAME - The name of the generated bundle. This # appears in the OSX finder as the bundle name. Required. +##end # +##variable # CPACK_BUNDLE_PLIST - Path to an OSX plist file that will be used # as the Info.plist for the generated bundle. This assumes that # the caller has generated or specified their own Info.plist file. # Required. +##end # +##variable # CPACK_BUNDLE_ICON - Path to an OSX icns file that will be used as # the icon for the generated bundle. This is the icon that appears # in the OSX finder for the bundle, and in the OSX dock when the # bundle is opened. Required. +##end # +##variable # CPACK_BUNDLE_STARTUP_SCRIPT - Path to an executable or script that # will be run whenever an end-user double-clicks the generated bundle # in the OSX Finder. Optional. +##end #============================================================================= # Copyright 2006-2009 Kitware, Inc. -- cgit v0.12 From 9717727d5fa29a993b22b9437e67cc28d8eaf52c Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 18 Feb 2012 22:30:57 +0100 Subject: Suppress unecessary (now empty) doc sections --- Source/cmDocumentation.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 17e35d8..1fb8ab6 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -741,8 +741,6 @@ void cmDocumentation::addCPackStandardDocSections() this->VariableSections.push_back( "Variables common to all CPack generators"); - this->VariableSections.push_back( - "Variables specific to a CPack generator"); } void cmDocumentation::addAutomaticVariableSections(const std::string& section) -- cgit v0.12 From b4abcfecbe281373fd3c28adccf4c3002b7909c4 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 18 Feb 2012 22:31:43 +0100 Subject: Correct copy/paste section name mistake --- Modules/CPackNSIS.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/CPackNSIS.cmake b/Modules/CPackNSIS.cmake index 093d0fc..97179d7 100644 --- a/Modules/CPackNSIS.cmake +++ b/Modules/CPackNSIS.cmake @@ -1,4 +1,4 @@ -##section Variables specific to CPack Debian (DEB) generator +##section Variables specific to CPack NSIS generator ##end ##module # - CPack NSIS generator specific options -- cgit v0.12 From dee0a38648195786bae0abce437ef4617ea0912e Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 18 Feb 2012 22:33:10 +0100 Subject: Put CPack DMG and PackageMaker doc in separate files --- Modules/CPack.cmake | 55 -------------------------------- Modules/CPackDMG.cmake | 70 +++++++++++++++++++++++++++++++++++++++++ Modules/CPackPackageMaker.cmake | 34 ++++++++++++++++++++ 3 files changed, 104 insertions(+), 55 deletions(-) create mode 100644 Modules/CPackDMG.cmake create mode 100644 Modules/CPackPackageMaker.cmake diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 8a44991..e0a5518 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -187,61 +187,6 @@ # list of patterns, e.g., /CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~;cscope.* ##end # -# The following variables are specific to the DragNDrop installers -# built on Mac OS X: -# -# CPACK_DMG_VOLUME_NAME - The volume name of the generated disk -# image. Defaults to CPACK_PACKAGE_FILE_NAME. -# -# CPACK_DMG_FORMAT - The disk image format. Common values are UDRO -# (UDIF read-only), UDZO (UDIF zlib-compressed) or UDBZ (UDIF -# bzip2-compressed). Refer to hdiutil(1) for more information on -# other available formats. -# -# CPACK_DMG_DS_STORE - Path to a custom .DS_Store file which e.g. -# can be used to specify the Finder window position/geometry and -# layout (such as hidden toolbars, placement of the icons etc.). -# This file has to be generated by the Finder (either manually or -# through OSA-script) using a normal folder from which the .DS_Store -# file can then be extracted. -# -# CPACK_DMG_BACKGROUND_IMAGE - Path to an image file which is to be -# used as the background for the Finder Window when the disk image -# is opened. By default no background image is set. The background -# image is applied after applying the custom .DS_Store file. -# -# CPACK_COMMAND_HDIUTIL - Path to the hdiutil(1) command used to -# operate on disk image files on Mac OS X. This variable can be used -# to override the automatically detected command (or specify its -# location if the auto-detection fails to find it.) -# -# CPACK_COMMAND_SETFILE - Path to the SetFile(1) command used to set -# extended attributes on files and directories on Mac OS X. This -# variable can be used to override the automatically detected -# command (or specify its location if the auto-detection fails to -# find it.) -# -# CPACK_COMMAND_REZ - Path to the Rez(1) command used to compile -# resources on Mac OS X. This variable can be used to override the -# automatically detected command (or specify its location if the -# auto-detection fails to find it.) -# -# The following variable is specific to installers build on Mac OS X -# using PackageMaker: -# -# CPACK_OSX_PACKAGE_VERSION - The version of Mac OS X that the -# resulting PackageMaker archive should be compatible -# with. Different versions of Mac OS X support different -# features. For example, CPack can only build component-based -# installers for Mac OS X 10.4 or newer, and can only build -# installers that download component son-the-fly for Mac OS X 10.5 -# or newer. If left blank, this value will be set to the minimum -# version of Mac OS X that supports the requested features. Set this -# variable to some value (e.g., 10.4) only if you want to guarantee -# that your installer will work on that version of Mac OS X, and -# don't mind missing extra features available in the installer -# shipping with later versions of Mac OS X. -# # The following variables are for advanced uses of CPack: # ##variable diff --git a/Modules/CPackDMG.cmake b/Modules/CPackDMG.cmake new file mode 100644 index 0000000..08a19d9 --- /dev/null +++ b/Modules/CPackDMG.cmake @@ -0,0 +1,70 @@ +##section Variables specific to CPack DragNDrop generator +##end +##module +# - DragNDrop CPack generator (Mac OS X). +# The following variables are specific to the DragNDrop installers +# built on Mac OS X: +#end +# +##variable +# CPACK_DMG_VOLUME_NAME - The volume name of the generated disk +# image. Defaults to CPACK_PACKAGE_FILE_NAME. +##end +# +##variable +# CPACK_DMG_FORMAT - The disk image format. Common values are UDRO +# (UDIF read-only), UDZO (UDIF zlib-compressed) or UDBZ (UDIF +# bzip2-compressed). Refer to hdiutil(1) for more information on +# other available formats. +##end +# +##variable +# CPACK_DMG_DS_STORE - Path to a custom .DS_Store file which e.g. +# can be used to specify the Finder window position/geometry and +# layout (such as hidden toolbars, placement of the icons etc.). +# This file has to be generated by the Finder (either manually or +# through OSA-script) using a normal folder from which the .DS_Store +# file can then be extracted. +##end +# +##variable +# CPACK_DMG_BACKGROUND_IMAGE - Path to an image file which is to be +# used as the background for the Finder Window when the disk image +# is opened. By default no background image is set. The background +# image is applied after applying the custom .DS_Store file. +##end +# +##variable +# CPACK_COMMAND_HDIUTIL - Path to the hdiutil(1) command used to +# operate on disk image files on Mac OS X. This variable can be used +# to override the automatically detected command (or specify its +# location if the auto-detection fails to find it.) +##end +# +##variable +# CPACK_COMMAND_SETFILE - Path to the SetFile(1) command used to set +# extended attributes on files and directories on Mac OS X. This +# variable can be used to override the automatically detected +# command (or specify its location if the auto-detection fails to +# find it.) +##end +# +##variable +# CPACK_COMMAND_REZ - Path to the Rez(1) command used to compile +# resources on Mac OS X. This variable can be used to override the +# automatically detected command (or specify its location if the +# auto-detection fails to find it.) +##end + +#============================================================================= +# Copyright 2006-2012 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) diff --git a/Modules/CPackPackageMaker.cmake b/Modules/CPackPackageMaker.cmake new file mode 100644 index 0000000..8fe423c --- /dev/null +++ b/Modules/CPackPackageMaker.cmake @@ -0,0 +1,34 @@ +##section Variables specific to CPack PackageMaker generator +##end +##module +# - PackageMaker CPack generator (Mac OS X). +# The following variable is specific to installers build on Mac OS X +# using PackageMaker: +# +##variable +# CPACK_OSX_PACKAGE_VERSION - The version of Mac OS X that the +# resulting PackageMaker archive should be compatible +# with. Different versions of Mac OS X support different +# features. For example, CPack can only build component-based +# installers for Mac OS X 10.4 or newer, and can only build +# installers that download component son-the-fly for Mac OS X 10.5 +# or newer. If left blank, this value will be set to the minimum +# version of Mac OS X that supports the requested features. Set this +# variable to some value (e.g., 10.4) only if you want to guarantee +# that your installer will work on that version of Mac OS X, and +# don't mind missing extra features available in the installer +# shipping with later versions of Mac OS X. +##end + +#============================================================================= +# Copyright 2006-2012 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) -- cgit v0.12 From cfac874b7783a5c464334bfc13d969a667f1c397 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 18 Feb 2012 23:10:14 +0100 Subject: More documentation concerning CPack Components --- Modules/CPackComponent.cmake | 47 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake index 016cb8c..1598703 100644 --- a/Modules/CPackComponent.cmake +++ b/Modules/CPackComponent.cmake @@ -1,4 +1,4 @@ -##section Variables common to all CPack generators +##section Variables concerning CPack Components ##end ##module # - Build binary and source package installers @@ -25,6 +25,51 @@ # CPack commands: ##end # +##variable +# CPACK_COMPONENTS_ALL - The list of component to install. +# +# The default value of this variable is computed by CPack +# and contains all components defined by the project. The +# user may set it to only include the specified components. +##end +# +##variable +# CPACK__COMPONENT_INSTALL - Enable/Disable component install for +# CPack generator . +# +# Each CPack Generator (RPM, DEB, ARCHIVE, NSIS, DMG, etc...) has a legacy +# default behavior. e.g. RPM builds monolithic whereas NSIS builds component. +# One can change the default behavior by setting this variable to 0/1 or OFF/ON. +##end +##variable +# CPACK_COMPONENTS_GROUPING - Specify how components are grouped for multi-package +# component-aware CPack generators. +# +# Some generators like RPM or ARCHIVE family (TGZ, ZIP, ...) generates several +# packages files when asked for component packaging. They group the component +# differently depending on the value of this variable: +# - ONE_PER_GROUP (default): creates one package file per component group +# - ALL_COMPONENTS_IN_ONE : creates a single package with all (requested) component +# - IGNORE : creates one package per component, i.e. IGNORE component group +# One can specify different grouping for different CPack generator by using +# a CPACK_PROJECT_CONFIG_FILE. +##end +##variable +# CPACK_COMPONENT__DISPLAY_NAME - The name to be displayed for a component. +##end +##variable +# CPACK_COMPONENT__DESCRIPTION - The description of a component. +##end +##variable +# CPACK_COMPONENT__GROUP - The group of a component. +##end +##variable +# CPACK_COMPONENT__DEPENDS - The dependencies (list of components) +# on which this component depends. +##end +##variable +# CPACK_COMPONENT__REQUIRED - True is this component is required. +##end ##macro # cpack_add_component - Describes a CPack installation component # named by the COMPONENT argument to a CMake INSTALL command. -- cgit v0.12 From 4da2223ab768e44b7ef6e789ab193ea54c9b5e27 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 18 Feb 2012 23:13:45 +0100 Subject: Fix typo in end markup --- Modules/CPackDMG.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/CPackDMG.cmake b/Modules/CPackDMG.cmake index 08a19d9..caa8dc8 100644 --- a/Modules/CPackDMG.cmake +++ b/Modules/CPackDMG.cmake @@ -4,7 +4,7 @@ # - DragNDrop CPack generator (Mac OS X). # The following variables are specific to the DragNDrop installers # built on Mac OS X: -#end +##end # ##variable # CPACK_DMG_VOLUME_NAME - The volume name of the generated disk -- cgit v0.12 From 9a8103e929de7569fd2e5459a6676dff64d88892 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sun, 19 Feb 2012 00:01:39 +0100 Subject: Try to fix compile error on Win32-vs70 --- Source/cmDocumentation.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 1fb8ab6..904a157 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -16,6 +16,7 @@ #include #include +#include //---------------------------------------------------------------------------- static const char *cmDocumentationStandardOptions[][3] = @@ -746,9 +747,9 @@ void cmDocumentation::addCPackStandardDocSections() void cmDocumentation::addAutomaticVariableSections(const std::string& section) { std::vector::iterator it; - it = find(this->VariableSections.begin(), - this->VariableSections.end(), - section); + it = std::find(this->VariableSections.begin(), + this->VariableSections.end(), + section); /* if the section does not exist then add it */ if (it==this->VariableSections.end()) { -- cgit v0.12 From e316cbbbc32bd7711c4bbd96ab34adfa79722d79 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sun, 19 Feb 2012 00:05:09 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 2bf0e14..437a70f 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 18) +SET(KWSYS_DATE_STAMP_DAY 19) -- cgit v0.12 From 67494502f5f9990e457d3afe0af872838d5905d2 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sun, 19 Feb 2012 20:50:27 +0100 Subject: Do not build RPM if path of the build tree contains space --- Tests/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 9c97828..af1df22 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -585,6 +585,14 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ set(CTEST_package_X11_TEST ${CTEST_TEST_CPACK}) set(CTEST_RUN_CPackComponentsForAll ${CTEST_TEST_CPACK}) + if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT CMAKE_CURRENT_BINARY_DIR MATCHES ".* .*") + find_program(RPMBUILD NAMES rpmbuild) + endif(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT CMAKE_CURRENT_BINARY_DIR MATCHES ".* .*") + # Do not try to build RPM + if (NOT RPMBUILD) + set(CPACK_BINARY_RPM OFF) + endif(NOT RPMBUILD) + find_program(NSIS_MAKENSIS_EXECUTABLE NAMES makensis PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS] DOC "makensis program location" -- cgit v0.12 From dc4c24ac79e739212004e66acc33996f6b3431cf Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Mon, 20 Feb 2012 00:05:06 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 437a70f..c832bfb 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 19) +SET(KWSYS_DATE_STAMP_DAY 20) -- cgit v0.12 From aabf65a073e812afd9ba417fd56c25017166a43e Mon Sep 17 00:00:00 2001 From: Modestas Vainius Date: Mon, 20 Feb 2012 09:39:03 -0500 Subject: KWIML: Teach ABI.h that MIPS is biendian MIPS machines are biendian hence they can run both big endian kernels e.g. Debian mips architecture, and little endian kernels e.g. Debian mipsel architecture. Use predefined macros to distinguish them. --- ABI.h.in | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ABI.h.in b/ABI.h.in index e95a4ff..e85a1c5 100644 --- a/ABI.h.in +++ b/ABI.h.in @@ -380,7 +380,15 @@ suppression macro @KWIML@_ABI_NO_VERIFY was defined. #elif defined(__m68k__) || defined(M68000) # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG -/* MIPS */ +/* MIPSel (MIPS little endian) */ +#elif defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE + +/* MIPSeb (MIPS big endian) */ +#elif defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG + +/* MIPS (fallback, big endian) */ #elif defined(__mips) || defined(__mips__) || defined(__MIPS__) # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG -- cgit v0.12 From f5066217db3911754006ae64e2a9001382ff66e1 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Mon, 20 Feb 2012 13:02:11 -0700 Subject: Fix paths/hints for finding qtmain. --- Modules/FindQt3.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake index bacbb07..86236cc 100644 --- a/Modules/FindQt3.cmake +++ b/Modules/FindQt3.cmake @@ -183,11 +183,14 @@ ENDIF(QT_UIC_EXECUTABLE) IF (WIN32) FIND_LIBRARY(QT_QTMAIN_LIBRARY qtmain + HINTS + $ENV{QTDIR}/lib "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/lib" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/lib" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/lib" + PATHS "$ENV{ProgramFiles}/qt/lib" - $ENV{QTDIR}/lib "C:/Program Files/qt/lib" + "C:/Program Files/qt/lib" DOC "This Library is only needed by and included with Qt3 on MSWindows. It should be NOTFOUND, undefined or IGNORE otherwise." ) ENDIF (WIN32) -- cgit v0.12 From cffebe643c9002ee3411c8f293abdf7c23fc622c Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Tue, 21 Feb 2012 00:05:05 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index c832bfb..e1ef1f8 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 20) +SET(KWSYS_DATE_STAMP_DAY 21) -- cgit v0.12 From 628f36514070037dd3dc4f09c61c4df8688e3a2b Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Wed, 18 Jan 2012 21:55:52 +0100 Subject: -remove trailing whitespace Alex --- Modules/CheckCSourceRuns.cmake | 6 +++--- Modules/CheckCXXSourceRuns.cmake | 10 +++++----- Modules/CheckFortranFunctionExists.cmake | 4 ++-- Modules/CheckFunctionExists.cmake | 6 +++--- Modules/CheckLibraryExists.cmake | 10 +++++----- Modules/CheckVariableExists.cmake | 8 ++++---- Source/cmBootstrapCommands.cxx | 4 ++-- Source/cmWhileCommand.cxx | 18 +++++++++--------- Utilities/cmcurl/CMakeLists.txt | 26 +++++++++++++------------- 9 files changed, 46 insertions(+), 46 deletions(-) diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake index 764c756..cdcde04 100644 --- a/Modules/CheckCSourceRuns.cmake +++ b/Modules/CheckCSourceRuns.cmake @@ -26,7 +26,7 @@ MACRO(CHECK_C_SOURCE_RUNS SOURCE VAR) IF("${VAR}" MATCHES "^${VAR}$") - SET(MACRO_CHECK_FUNCTION_DEFINITIONS + SET(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") IF(CMAKE_REQUIRED_LIBRARIES) SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES @@ -61,7 +61,7 @@ MACRO(CHECK_C_SOURCE_RUNS SOURCE VAR) IF("${${VAR}_EXITCODE}" EQUAL 0) SET(${VAR} 1 CACHE INTERNAL "Test ${VAR}") MESSAGE(STATUS "Performing Test ${VAR} - Success") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n" "${OUTPUT}\n" "Return value: ${${VAR}}\n" @@ -74,7 +74,7 @@ MACRO(CHECK_C_SOURCE_RUNS SOURCE VAR) ENDIF(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN") MESSAGE(STATUS "Performing Test ${VAR} - Failed") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing C SOURCE FILE Test ${VAR} failed with the following output:\n" "${OUTPUT}\n" "Return value: ${${VAR}_EXITCODE}\n" diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake index ace60d1..dc00701 100644 --- a/Modules/CheckCXXSourceRuns.cmake +++ b/Modules/CheckCXXSourceRuns.cmake @@ -26,7 +26,7 @@ MACRO(CHECK_CXX_SOURCE_RUNS SOURCE VAR) IF("${VAR}" MATCHES "^${VAR}$") - SET(MACRO_CHECK_FUNCTION_DEFINITIONS + SET(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") IF(CMAKE_REQUIRED_LIBRARIES) SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES @@ -62,9 +62,9 @@ MACRO(CHECK_CXX_SOURCE_RUNS SOURCE VAR) IF("${${VAR}_EXITCODE}" EQUAL 0) SET(${VAR} 1 CACHE INTERNAL "Test ${VAR}") MESSAGE(STATUS "Performing Test ${VAR} - Success") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n" - "${OUTPUT}\n" + "${OUTPUT}\n" "Return value: ${${VAR}}\n" "Source file was:\n${SOURCE}\n") ELSE("${${VAR}_EXITCODE}" EQUAL 0) @@ -75,9 +75,9 @@ MACRO(CHECK_CXX_SOURCE_RUNS SOURCE VAR) ENDIF(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN") MESSAGE(STATUS "Performing Test ${VAR} - Failed") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n" - "${OUTPUT}\n" + "${OUTPUT}\n" "Return value: ${${VAR}_EXITCODE}\n" "Source file was:\n${SOURCE}\n") ENDIF("${${VAR}_EXITCODE}" EQUAL 0) diff --git a/Modules/CheckFortranFunctionExists.cmake b/Modules/CheckFortranFunctionExists.cmake index 6e932d0..e0f0158 100644 --- a/Modules/CheckFortranFunctionExists.cmake +++ b/Modules/CheckFortranFunctionExists.cmake @@ -50,13 +50,13 @@ macro(CHECK_FORTRAN_FUNCTION_EXISTS FUNCTION VARIABLE) if(${VARIABLE}) set(${VARIABLE} 1 CACHE INTERNAL "Have Fortran function ${FUNCTION}") message(STATUS "Looking for Fortran ${FUNCTION} - found") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the Fortran ${FUNCTION} exists passed with the following output:\n" "${OUTPUT}\n\n") else(${VARIABLE}) message(STATUS "Looking for Fortran ${FUNCTION} - not found") set(${VARIABLE} "" CACHE INTERNAL "Have Fortran function ${FUNCTION}") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the Fortran ${FUNCTION} exists failed with the following output:\n" "${OUTPUT}\n\n") endif(${VARIABLE}) diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake index 0ba36d9..6f9e9d1 100644 --- a/Modules/CheckFunctionExists.cmake +++ b/Modules/CheckFunctionExists.cmake @@ -29,7 +29,7 @@ MACRO(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) IF("${VARIABLE}" MATCHES "^${VARIABLE}$") - SET(MACRO_CHECK_FUNCTION_DEFINITIONS + SET(MACRO_CHECK_FUNCTION_DEFINITIONS "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}") MESSAGE(STATUS "Looking for ${FUNCTION}") IF(CMAKE_REQUIRED_LIBRARIES) @@ -55,13 +55,13 @@ MACRO(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) IF(${VARIABLE}) SET(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}") MESSAGE(STATUS "Looking for ${FUNCTION} - found") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the function ${FUNCTION} exists passed with the following output:\n" "${OUTPUT}\n\n") ELSE(${VARIABLE}) MESSAGE(STATUS "Looking for ${FUNCTION} - not found") SET(${VARIABLE} "" CACHE INTERNAL "Have function ${FUNCTION}") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the function ${FUNCTION} exists failed with the following output:\n" "${OUTPUT}\n\n") ENDIF(${VARIABLE}) diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake index caf4f4c..a170e7a 100644 --- a/Modules/CheckLibraryExists.cmake +++ b/Modules/CheckLibraryExists.cmake @@ -28,19 +28,19 @@ MACRO(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE) IF("${VARIABLE}" MATCHES "^${VARIABLE}$") - SET(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION + SET(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}") MESSAGE(STATUS "Looking for ${FUNCTION} in ${LIBRARY}") SET(CHECK_LIBRARY_EXISTS_LIBRARIES ${LIBRARY}) IF(CMAKE_REQUIRED_LIBRARIES) - SET(CHECK_LIBRARY_EXISTS_LIBRARIES + SET(CHECK_LIBRARY_EXISTS_LIBRARIES ${CHECK_LIBRARY_EXISTS_LIBRARIES} ${CMAKE_REQUIRED_LIBRARIES}) ENDIF(CMAKE_REQUIRED_LIBRARIES) TRY_COMPILE(${VARIABLE} ${CMAKE_BINARY_DIR} ${CMAKE_ROOT}/Modules/CheckFunctionExists.c COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} - CMAKE_FLAGS + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_LIBRARY_EXISTS_DEFINITION} -DLINK_DIRECTORIES:STRING=${LOCATION} "-DLINK_LIBRARIES:STRING=${CHECK_LIBRARY_EXISTS_LIBRARIES}" @@ -49,14 +49,14 @@ MACRO(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE) IF(${VARIABLE}) MESSAGE(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - found") SET(${VARIABLE} 1 CACHE INTERNAL "Have library ${LIBRARY}") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the function ${FUNCTION} exists in the ${LIBRARY} " "passed with the following output:\n" "${OUTPUT}\n\n") ELSE(${VARIABLE}) MESSAGE(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - not found") SET(${VARIABLE} "" CACHE INTERNAL "Have library ${LIBRARY}") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the function ${FUNCTION} exists in the ${LIBRARY} " "failed with the following output:\n" "${OUTPUT}\n\n") diff --git a/Modules/CheckVariableExists.cmake b/Modules/CheckVariableExists.cmake index 9832891..8517002 100644 --- a/Modules/CheckVariableExists.cmake +++ b/Modules/CheckVariableExists.cmake @@ -1,6 +1,6 @@ # - Check if the variable exists. # CHECK_VARIABLE_EXISTS(VAR VARIABLE) -# +# # VAR - the name of the variable # VARIABLE - variable to store the result # @@ -28,7 +28,7 @@ MACRO(CHECK_VARIABLE_EXISTS VAR VARIABLE) IF("${VARIABLE}" MATCHES "^${VARIABLE}$") - SET(MACRO_CHECK_VARIABLE_DEFINITIONS + SET(MACRO_CHECK_VARIABLE_DEFINITIONS "-DCHECK_VARIABLE_EXISTS=${VAR} ${CMAKE_REQUIRED_FLAGS}") MESSAGE(STATUS "Looking for ${VAR}") IF(CMAKE_REQUIRED_LIBRARIES) @@ -47,13 +47,13 @@ MACRO(CHECK_VARIABLE_EXISTS VAR VARIABLE) IF(${VARIABLE}) SET(${VARIABLE} 1 CACHE INTERNAL "Have variable ${VAR}") MESSAGE(STATUS "Looking for ${VAR} - found") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the variable ${VAR} exists passed with the following output:\n" "${OUTPUT}\n\n") ELSE(${VARIABLE}) SET(${VARIABLE} "" CACHE INTERNAL "Have variable ${VAR}") MESSAGE(STATUS "Looking for ${VAR} - not found") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the variable ${VAR} exists failed with the following output:\n" "${OUTPUT}\n\n") ENDIF(${VARIABLE}) diff --git a/Source/cmBootstrapCommands.cxx b/Source/cmBootstrapCommands.cxx index 554f452..cb5dc4c 100644 --- a/Source/cmBootstrapCommands.cxx +++ b/Source/cmBootstrapCommands.cxx @@ -12,7 +12,7 @@ // This file is used to compile all the commands // that CMake knows about at compile time. // This is sort of a boot strapping approach since you would -// like to have CMake to build CMake. +// like to have CMake to build CMake. #include "cmCommands.h" #include "cmAddCustomCommandCommand.cxx" #include "cmAddCustomTargetCommand.cxx" @@ -111,7 +111,7 @@ void GetBootstrapCommands(std::list& commands) commands.push_back(new cmDefinePropertyCommand); commands.push_back(new cmElseCommand); commands.push_back(new cmEnableLanguageCommand); - commands.push_back(new cmEnableTestingCommand); + commands.push_back(new cmEnableTestingCommand); commands.push_back(new cmEndForEachCommand); commands.push_back(new cmEndFunctionCommand); commands.push_back(new cmEndIfCommand); diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx index 7eafda2..4000345 100644 --- a/Source/cmWhileCommand.cxx +++ b/Source/cmWhileCommand.cxx @@ -25,7 +25,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, else if (!cmSystemTools::Strucmp(lff.Name.c_str(),"endwhile")) { // if this is the endwhile for this while loop then execute - if (!this->Depth) + if (!this->Depth) { // Remove the function blocker for this scope or bail. cmsys::auto_ptr @@ -33,16 +33,16 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, if(!fb.get()) { return false; } std::string errorString; - + std::vector expandedArguments; mf.ExpandArguments(this->Args, expandedArguments); cmake::MessageType messageType; - bool isTrue = + bool isTrue = cmIfCommand::IsTrue(expandedArguments,errorString, &mf, messageType); while (isTrue) - { + { if (errorString.size()) { std::string err = "had incorrect arguments: "; @@ -86,7 +86,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, } expandedArguments.clear(); mf.ExpandArguments(this->Args, expandedArguments); - isTrue = + isTrue = cmIfCommand::IsTrue(expandedArguments,errorString, &mf, messageType); } @@ -101,7 +101,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, // record the command this->Functions.push_back(lff); - + // always return true return true; } @@ -123,7 +123,7 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile& ) } bool cmWhileCommand -::InvokeInitialPass(const std::vector& args, +::InvokeInitialPass(const std::vector& args, cmExecutionStatus &) { if(args.size() < 1) @@ -131,12 +131,12 @@ bool cmWhileCommand this->SetError("called with incorrect number of arguments"); return false; } - + // create a function blocker cmWhileFunctionBlocker *f = new cmWhileFunctionBlocker(); f->Args = args; this->Makefile->AddFunctionBlocker(f); - + return true; } diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index 7030b2e..e700ed8 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -139,7 +139,7 @@ ENDIF(WIN32) # does, it appends library to the list. SET(CURL_LIBS "") MACRO(CHECK_LIBRARY_EXISTS_CONCAT LIBRARY SYMBOL VARIABLE) - CHECK_LIBRARY_EXISTS("${LIBRARY};${CURL_LIBS}" ${SYMBOL} "" + CHECK_LIBRARY_EXISTS("${LIBRARY};${CURL_LIBS}" ${SYMBOL} "" ${VARIABLE}) IF(${VARIABLE}) SET(CURL_LIBS ${CURL_LIBS} ${LIBRARY}) @@ -180,7 +180,7 @@ IF(CMAKE_USE_OPENSSL) SET(USE_SSLEAY TRUE) SET(USE_OPENSSL TRUE) IF(WIN32) - FIND_PATH(SSLINCLUDE openssl/crypto.h + FIND_PATH(SSLINCLUDE openssl/crypto.h PATHS c:/hoffman/Tools/openssl_w32vc6-0.9.8g/inc32) INCLUDE_DIRECTORIES(${SSLINCLUDE}) FIND_LIBRARY(LIBEAY NAMES libeay32) @@ -221,7 +221,7 @@ IF(HAVE_FEATURES_H) getenv.c hash.c http.c - if2ip.c + if2ip.c mprintf.c multi.c sendf.c @@ -287,9 +287,9 @@ ENDIF(NOT CURL_SPECIAL_LIBZ) CHECK_INCLUDE_FILE_CONCAT("sys/socket.h" HAVE_SYS_SOCKET_H) CHECK_INCLUDE_FILE_CONCAT("netinet/in.h" HAVE_NETINET_IN_H) CHECK_INCLUDE_FILE_CONCAT("net/if.h" HAVE_NET_IF_H) -CHECK_INCLUDE_FILE_CONCAT("netinet/if_ether.h" +CHECK_INCLUDE_FILE_CONCAT("netinet/if_ether.h" HAVE_NETINET_IF_ETHER_H) -CHECK_INCLUDE_FILE_CONCAT("netinet/tcp.h" +CHECK_INCLUDE_FILE_CONCAT("netinet/tcp.h" HAVE_NETINET_TCP_H) CHECK_INCLUDE_FILE_CONCAT("sys/select.h" HAVE_SYS_SELECT_H) CHECK_INCLUDE_FILE_CONCAT("utime.h" HAVE_UTIME_H) @@ -421,7 +421,7 @@ IF(CMAKE_USE_OPENSSL) CHECK_SYMBOL_EXISTS(RAND_status "${CURL_INCLUDES}" HAVE_RAND_STATUS) CHECK_SYMBOL_EXISTS(RAND_screen "${CURL_INCLUDES}" HAVE_RAND_SCREEN) CHECK_SYMBOL_EXISTS(RAND_egd "${CURL_INCLUDES}" HAVE_RAND_EGD) - CHECK_SYMBOL_EXISTS(CRYPTO_cleanup_all_ex_data "${CURL_INCLUDES}" + CHECK_SYMBOL_EXISTS(CRYPTO_cleanup_all_ex_data "${CURL_INCLUDES}" HAVE_CRYPTO_CLEANUP_ALL_EX_DATA) ENDIF(CMAKE_USE_OPENSSL) CHECK_SYMBOL_EXISTS(gmtime_r "${CURL_INCLUDES}" HAVE_GMTIME_R) @@ -485,7 +485,7 @@ ENDIF(NOT HAVE_SIGSETJMP) # For other curl specific tests, use this macro. MACRO(CURL_INTERNAL_TEST CURL_TEST) IF("${CURL_TEST}" MATCHES "^${CURL_TEST}$") - SET(MACRO_CHECK_FUNCTION_DEFINITIONS + SET(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${CURL_TEST} ${CMAKE_REQUIRED_FLAGS}") IF(CMAKE_REQUIRED_LIBRARIES) SET(CURL_TEST_ADD_LIBRARIES @@ -502,18 +502,18 @@ MACRO(CURL_INTERNAL_TEST CURL_TEST) IF(${CURL_TEST}) SET(${CURL_TEST} 1 CACHE INTERNAL "Curl test ${FUNCTION}") MESSAGE(STATUS "Performing Curl Test ${CURL_TEST} - Success") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing Curl Test ${CURL_TEST} passed with the following output:\n" "${OUTPUT}\n") ELSE(${CURL_TEST}) MESSAGE(STATUS "Performing Curl Test ${CURL_TEST} - Failed") SET(${CURL_TEST} "" CACHE INTERNAL "Curl test ${FUNCTION}") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing Curl Test ${CURL_TEST} failed with the following output:\n" "${OUTPUT}\n") ENDIF(${CURL_TEST}) ENDIF("${CURL_TEST}" MATCHES "^${CURL_TEST}$") -ENDMACRO(CURL_INTERNAL_TEST) +ENDMACRO(CURL_INTERNAL_TEST) # Do curl specific tests #OPTION(CURL_HAVE_DISABLED_NONBLOCKING "Disable non-blocking socket detection" OFF) @@ -527,7 +527,7 @@ IF(NOT CURL_HAVE_DISABLED_NONBLOCKING) HAVE_SO_NONBLOCK ) ENDIF(NOT CURL_HAVE_DISABLED_NONBLOCKING) -FOREACH(CURL_TEST +FOREACH(CURL_TEST ${CURL_NONBLOCKING_TESTS} TIME_WITH_SYS_TIME HAVE_O_NONBLOCKHAVE_GETHOSTBYADDR_R_5 @@ -627,12 +627,12 @@ SET(CMAKE_REQUIRED_FLAGS) # Check for nonblocking SET(HAVE_DISABLED_NONBLOCKING 1) -IF(HAVE_FIONBIO OR +IF(HAVE_FIONBIO OR HAVE_IOCTLSOCKET OR HAVE_IOCTLSOCKET_CASE OR HAVE_O_NONBLOCK) SET(HAVE_DISABLED_NONBLOCKING) -ENDIF(HAVE_FIONBIO OR +ENDIF(HAVE_FIONBIO OR HAVE_IOCTLSOCKET OR HAVE_IOCTLSOCKET_CASE OR HAVE_O_NONBLOCK) -- cgit v0.12 From c9f2886b3db9783eaa455c21288eabdc7e6366a1 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Thu, 16 Feb 2012 10:31:32 +0100 Subject: -don't pull in CheckTypeSize.cmake from the cmake which is being built We can be sure that at least cmake 2.6.3 is used when building cmcurl. This means we always get in the first branch of the if(). I think it is not a good idea to pull a cmake module from the cmake which is being built in, since this may use features which are not supported in the cmake which is used to build cmake (e.g. CMAKE_CURRENT_LIST_DIR which does not exist in cmake 2.6.3 which is the minimum for cmcurl). A bit further below there is anyway code to handle the case that cmake is older than 2.8.0, so it should be ok. Alex --- Utilities/cmcurl/CMakeLists.txt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index e700ed8..ef300bd 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -33,12 +33,7 @@ INCLUDE (CheckIncludeFile) INCLUDE (CheckIncludeFiles) INCLUDE (CheckLibraryExists) INCLUDE (CheckSymbolExists) -IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4 - AND CMake_SOURCE_DIR) - INCLUDE (${CMake_SOURCE_DIR}/Modules/CheckTypeSize.cmake) -ELSE() - INCLUDE (CheckTypeSize) -ENDIF() +INCLUDE (CheckTypeSize) SET(libCurl_SRCS # amigaos.c - does not build on AmigaOS -- cgit v0.12 From 61cb4ea72e608370b581bae9d9810ca6ae8f84d0 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Fri, 17 Feb 2012 16:42:06 +0100 Subject: bootstrap: move while() and endwhile() into the bootstrap build Alex --- Source/cmBootstrapCommands.cxx | 4 ++++ Source/cmCommands.cxx | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/cmBootstrapCommands.cxx b/Source/cmBootstrapCommands.cxx index cb5dc4c..9097a74 100644 --- a/Source/cmBootstrapCommands.cxx +++ b/Source/cmBootstrapCommands.cxx @@ -38,6 +38,7 @@ #include "cmEndFunctionCommand.cxx" #include "cmEndIfCommand.cxx" #include "cmEndMacroCommand.cxx" +#include "cmEndWhileCommand.cxx" #include "cmExecProgramCommand.cxx" #include "cmExecuteProcessCommand.cxx" #include "cmExternalMakefileProjectGenerator.cxx" @@ -91,6 +92,7 @@ #include "cmTryCompileCommand.cxx" #include "cmTryRunCommand.cxx" #include "cmUnsetCommand.cxx" +#include "cmWhileCommand.cxx" void GetBootstrapCommands(std::list& commands) { @@ -116,6 +118,7 @@ void GetBootstrapCommands(std::list& commands) commands.push_back(new cmEndFunctionCommand); commands.push_back(new cmEndIfCommand); commands.push_back(new cmEndMacroCommand); + commands.push_back(new cmEndWhileCommand); commands.push_back(new cmExecProgramCommand); commands.push_back(new cmExecuteProcessCommand); commands.push_back(new cmFileCommand); @@ -164,4 +167,5 @@ void GetBootstrapCommands(std::list& commands) commands.push_back(new cmTryCompileCommand); commands.push_back(new cmTryRunCommand); commands.push_back(new cmUnsetCommand); + commands.push_back(new cmWhileCommand); } diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index bb1e4e2..49ed967 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -14,7 +14,6 @@ #include "cmAuxSourceDirectoryCommand.cxx" #include "cmBuildNameCommand.cxx" #include "cmElseIfCommand.cxx" -#include "cmEndWhileCommand.cxx" #include "cmExportCommand.cxx" #include "cmExportLibraryDependencies.cxx" #include "cmFLTKWrapUICommand.cxx" @@ -34,7 +33,6 @@ #include "cmVariableRequiresCommand.cxx" #include "cmVariableWatchCommand.cxx" -#include "cmWhileCommand.cxx" #include "cmWriteFileCommand.cxx" // This one must be last because it includes windows.h and @@ -53,7 +51,6 @@ void GetPredefinedCommands(std::list& commands.push_back(new cmAuxSourceDirectoryCommand); commands.push_back(new cmBuildNameCommand); commands.push_back(new cmElseIfCommand); - commands.push_back(new cmEndWhileCommand); commands.push_back(new cmExportCommand); commands.push_back(new cmExportLibraryDependenciesCommand); commands.push_back(new cmFLTKWrapUICommand); @@ -73,7 +70,6 @@ void GetPredefinedCommands(std::list& commands.push_back(new cmUtilitySourceCommand); commands.push_back(new cmVariableRequiresCommand); commands.push_back(new cmVariableWatchCommand); - commands.push_back(new cmWhileCommand); commands.push_back(new cmWriteFileCommand); #endif } -- cgit v0.12 From 35c48e12706f9426eda43b3b077925a2fab0df44 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Thu, 16 Feb 2012 23:35:43 +0100 Subject: Check*.cmake: Expand imported targets in CMAKE_REQUIRED_LIBRARIES Add the function cmake_expand_imported_targets() to expand imported targets in a list of libraries into their on-disk file names for a particular configuration. Adapt the implementation from KDE's HANDLE_IMPORTED_TARGETS_IN_CMAKE_REQUIRED_LIBRARIES which has been in use for over 2 years. Call the function from all the Check*.cmake macros to handle imported targets named in CMAKE_REQUIRED_LIBRARIES. Alex --- Modules/CMakeExpandImportedTargets.cmake | 129 +++++++++++++++++++++++++++++ Modules/CheckCSourceCompiles.cmake | 7 +- Modules/CheckCSourceRuns.cmake | 7 +- Modules/CheckCXXSourceCompiles.cmake | 7 +- Modules/CheckCXXSourceRuns.cmake | 7 +- Modules/CheckFortranFunctionExists.cmake | 7 +- Modules/CheckFunctionExists.cmake | 7 +- Modules/CheckLibraryExists.cmake | 7 +- Modules/CheckPrototypeDefinition.cmake | 7 +- Modules/CheckSymbolExists.cmake | 7 +- Modules/CheckTypeSize.cmake | 7 +- Modules/CheckVariableExists.cmake | 7 +- Tests/ExportImport/Import/A/CMakeLists.txt | 11 +++ 13 files changed, 206 insertions(+), 11 deletions(-) create mode 100644 Modules/CMakeExpandImportedTargets.cmake diff --git a/Modules/CMakeExpandImportedTargets.cmake b/Modules/CMakeExpandImportedTargets.cmake new file mode 100644 index 0000000..fba071a --- /dev/null +++ b/Modules/CMakeExpandImportedTargets.cmake @@ -0,0 +1,129 @@ +# CMAKE_EXPAND_IMPORTED_TARGETS( LIBRARIES lib1 lib2...libN +# [CONFIGURATION ] ) +# +# CMAKE_EXPAND_IMPORTED_TARGETS() takes a list of libraries and replaces +# all imported targets contained in this list with their actual file paths +# of the referenced libraries on disk, including the libraries from their +# link interfaces. +# If a CONFIGURATION is given, it uses the respective configuration of the +# imported targets if it exists. If no CONFIGURATION is given, it uses +# the first configuration from ${CMAKE_CONFIGURATION_TYPES} if set, otherwise +# ${CMAKE_BUILD_TYPE}. +# This macro is used by all Check*.cmake files which use +# TRY_COMPILE() or TRY_RUN() and support CMAKE_REQUIRED_LIBRARIES , so that +# these checks support imported targets in CMAKE_REQUIRED_LIBRARIES: +# cmake_expand_imported_targets(expandedLibs LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} +# CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}" ) + + +#============================================================================= +# Copyright 2012 Kitware, Inc. +# Copyright 2009-2012 Alexander Neundorf +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +include(CMakeParseArguments) + +function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT ) + + set(options ) + set(oneValueArgs CONFIGURATION ) + set(multiValueArgs LIBRARIES ) + + cmake_parse_arguments(CEIT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(CEIT_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unknown keywords given to CMAKE_EXPAND_IMPORTED_TARGETS(): \"${CEIT_UNPARSED_ARGUMENTS}\"") + endif() + + if(NOT CEIT_CONFIGURATION) + if(CMAKE_CONFIGURATION_TYPES) + list(GET CMAKE_CONFIGURATION_TYPES 0 CEIT_CONFIGURATION) + else() + set(CEIT_CONFIGURATION ${CMAKE_BUILD_TYPE}) + endif() + endif() + + # handle imported library targets + + set(_CCSR_REQ_LIBS ${CEIT_LIBRARIES}) + + set(_CHECK_FOR_IMPORTED_TARGETS TRUE) + set(_CCSR_LOOP_COUNTER 0) + while(_CHECK_FOR_IMPORTED_TARGETS) + math(EXPR _CCSR_LOOP_COUNTER "${_CCSR_LOOP_COUNTER} + 1 ") + set(_CCSR_NEW_REQ_LIBS ) + set(_CHECK_FOR_IMPORTED_TARGETS FALSE) + foreach(_CURRENT_LIB ${_CCSR_REQ_LIBS}) + get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS) + if (_importedConfigs) +# message(STATUS "Detected imported target ${_CURRENT_LIB}") + # Ok, so this is an imported target. + # First we get the imported configurations. + # Then we get the location of the actual library on disk of the first configuration. + # then we'll get its link interface libraries property, + # iterate through it and replace all imported targets we find there + # with there actual location. + + # guard against infinite loop: abort after 100 iterations ( 100 is arbitrary chosen) + if ("${_CCSR_LOOP_COUNTER}" LESS 100) + set(_CHECK_FOR_IMPORTED_TARGETS TRUE) +# else ("${_CCSR_LOOP_COUNTER}" LESS 1) +# message(STATUS "********* aborting loop, counter : ${_CCSR_LOOP_COUNTER}") + endif ("${_CCSR_LOOP_COUNTER}" LESS 100) + + # if one of the imported configurations equals ${CMAKE_TRY_COMPILE_CONFIGURATION}, + # use it, otherwise simply use the first one: + list(FIND _importedConfigs "${CEIT_CONFIGURATION}" _configIndexToUse) + if("${_configIndexToUse}" EQUAL -1) + set(_configIndexToUse 0) + endif("${_configIndexToUse}" EQUAL -1) + list(GET _importedConfigs ${_configIndexToUse} _importedConfigToUse) + + get_target_property(_importedLocation "${_CURRENT_LIB}" IMPORTED_LOCATION_${_importedConfigToUse}) + get_target_property(_linkInterfaceLibs "${_CURRENT_LIB}" IMPORTED_LINK_INTERFACE_LIBRARIES_${_importedConfigToUse} ) + + list(APPEND _CCSR_NEW_REQ_LIBS "${_importedLocation}") +# message(STATUS "Appending lib ${_CURRENT_LIB} as ${_importedLocation}") + if(_linkInterfaceLibs) + foreach(_currentLinkInterfaceLib ${_linkInterfaceLibs}) +# message(STATUS "Appending link interface lib ${_currentLinkInterfaceLib}") + if(_currentLinkInterfaceLib) + list(APPEND _CCSR_NEW_REQ_LIBS "${_currentLinkInterfaceLib}" ) + endif(_currentLinkInterfaceLib) + endforeach(_currentLinkInterfaceLib "${_linkInterfaceLibs}") + endif(_linkInterfaceLibs) + else(_importedConfigs) + # "Normal" libraries are just used as they are. + list(APPEND _CCSR_NEW_REQ_LIBS "${_CURRENT_LIB}" ) +# message(STATUS "Appending lib directly: ${_CURRENT_LIB}") + endif(_importedConfigs) + endforeach(_CURRENT_LIB ${_CCSR_REQ_LIBS}) + + set(_CCSR_REQ_LIBS ${_CCSR_NEW_REQ_LIBS} ) + endwhile(_CHECK_FOR_IMPORTED_TARGETS) + + # Finally we iterate once more over all libraries. This loop only removes + # all remaining imported target names (there shouldn't be any left anyway). + set(_CCSR_NEW_REQ_LIBS ) + foreach(_CURRENT_LIB ${_CCSR_REQ_LIBS}) + get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS) + if (NOT _importedConfigs) + list(APPEND _CCSR_NEW_REQ_LIBS "${_CURRENT_LIB}" ) +# message(STATUS "final: appending ${_CURRENT_LIB}") + else (NOT _importedConfigs) +# message(STATUS "final: skipping ${_CURRENT_LIB}") + endif (NOT _importedConfigs) + endforeach(_CURRENT_LIB ${_CCSR_REQ_LIBS}) +# message(STATUS "setting -${_RESULT}- to -${_CCSR_NEW_REQ_LIBS}-") + set(${_RESULT} "${_CCSR_NEW_REQ_LIBS}" PARENT_SCOPE) + +endfunction() diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake index d59fe55..2669336 100644 --- a/Modules/CheckCSourceCompiles.cmake +++ b/Modules/CheckCSourceCompiles.cmake @@ -24,6 +24,9 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") + + MACRO(CHECK_C_SOURCE_COMPILES SOURCE VAR) IF("${VAR}" MATCHES "^${VAR}$") SET(_FAIL_REGEX) @@ -40,8 +43,10 @@ MACRO(CHECK_C_SOURCE_COMPILES SOURCE VAR) SET(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") IF(CMAKE_REQUIRED_LIBRARIES) + # this one translates potentially used imported library targets to their files on disk + CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") ELSE(CMAKE_REQUIRED_LIBRARIES) SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) ENDIF(CMAKE_REQUIRED_LIBRARIES) diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake index cdcde04..feee93a 100644 --- a/Modules/CheckCSourceRuns.cmake +++ b/Modules/CheckCSourceRuns.cmake @@ -24,13 +24,18 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") + + MACRO(CHECK_C_SOURCE_RUNS SOURCE VAR) IF("${VAR}" MATCHES "^${VAR}$") SET(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") IF(CMAKE_REQUIRED_LIBRARIES) + # this one translates potentially used imported library targets to their files on disk + CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") ELSE(CMAKE_REQUIRED_LIBRARIES) SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) ENDIF(CMAKE_REQUIRED_LIBRARIES) diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake index 0491b37..7f7336e 100644 --- a/Modules/CheckCXXSourceCompiles.cmake +++ b/Modules/CheckCXXSourceCompiles.cmake @@ -24,6 +24,9 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") + + MACRO(CHECK_CXX_SOURCE_COMPILES SOURCE VAR) IF("${VAR}" MATCHES "^${VAR}$") SET(_FAIL_REGEX) @@ -41,8 +44,10 @@ MACRO(CHECK_CXX_SOURCE_COMPILES SOURCE VAR) SET(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") IF(CMAKE_REQUIRED_LIBRARIES) + # this one translates potentially used imported library targets to their files on disk + CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") ELSE(CMAKE_REQUIRED_LIBRARIES) SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES) ENDIF(CMAKE_REQUIRED_LIBRARIES) diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake index dc00701..cd68d57 100644 --- a/Modules/CheckCXXSourceRuns.cmake +++ b/Modules/CheckCXXSourceRuns.cmake @@ -24,13 +24,18 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") + + MACRO(CHECK_CXX_SOURCE_RUNS SOURCE VAR) IF("${VAR}" MATCHES "^${VAR}$") SET(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") IF(CMAKE_REQUIRED_LIBRARIES) + # this one translates potentially used imported library targets to their files on disk + CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") ELSE(CMAKE_REQUIRED_LIBRARIES) SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES) ENDIF(CMAKE_REQUIRED_LIBRARIES) diff --git a/Modules/CheckFortranFunctionExists.cmake b/Modules/CheckFortranFunctionExists.cmake index e0f0158..abec9f7 100644 --- a/Modules/CheckFortranFunctionExists.cmake +++ b/Modules/CheckFortranFunctionExists.cmake @@ -22,12 +22,17 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") + + macro(CHECK_FORTRAN_FUNCTION_EXISTS FUNCTION VARIABLE) if(NOT DEFINED ${VARIABLE}) message(STATUS "Looking for Fortran ${FUNCTION}") if(CMAKE_REQUIRED_LIBRARIES) + # this one translates potentially used imported library targets to their files on disk + cmake_expand_imported_targets(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") else(CMAKE_REQUIRED_LIBRARIES) set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) endif(CMAKE_REQUIRED_LIBRARIES) diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake index 6f9e9d1..8c469f0 100644 --- a/Modules/CheckFunctionExists.cmake +++ b/Modules/CheckFunctionExists.cmake @@ -27,14 +27,19 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") + + MACRO(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) IF("${VARIABLE}" MATCHES "^${VARIABLE}$") SET(MACRO_CHECK_FUNCTION_DEFINITIONS "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}") MESSAGE(STATUS "Looking for ${FUNCTION}") IF(CMAKE_REQUIRED_LIBRARIES) + # this one translates potentially used imported library targets to their files on disk + CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") SET(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") ELSE(CMAKE_REQUIRED_LIBRARIES) SET(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) ENDIF(CMAKE_REQUIRED_LIBRARIES) diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake index a170e7a..59fca0a 100644 --- a/Modules/CheckLibraryExists.cmake +++ b/Modules/CheckLibraryExists.cmake @@ -26,6 +26,9 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") + + MACRO(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE) IF("${VARIABLE}" MATCHES "^${VARIABLE}$") SET(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION @@ -33,8 +36,10 @@ MACRO(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE) MESSAGE(STATUS "Looking for ${FUNCTION} in ${LIBRARY}") SET(CHECK_LIBRARY_EXISTS_LIBRARIES ${LIBRARY}) IF(CMAKE_REQUIRED_LIBRARIES) + # this one translates potentially used imported library targets to their files on disk + CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") SET(CHECK_LIBRARY_EXISTS_LIBRARIES - ${CHECK_LIBRARY_EXISTS_LIBRARIES} ${CMAKE_REQUIRED_LIBRARIES}) + ${CHECK_LIBRARY_EXISTS_LIBRARIES} ${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}) ENDIF(CMAKE_REQUIRED_LIBRARIES) TRY_COMPILE(${VARIABLE} ${CMAKE_BINARY_DIR} diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake index 244b9b5..63d4242 100644 --- a/Modules/CheckPrototypeDefinition.cmake +++ b/Modules/CheckPrototypeDefinition.cmake @@ -34,8 +34,11 @@ # License text for the above reference.) # +include("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") + get_filename_component(__check_proto_def_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) + function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIABLE) if ("${_VARIABLE}" MATCHES "^${_VARIABLE}$") @@ -43,8 +46,10 @@ function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIAB set(CHECK_PROTOTYPE_DEFINITION_FLAGS ${CMAKE_REQUIRED_FLAGS}) if (CMAKE_REQUIRED_LIBRARIES) + # this one translates potentially used imported library targets to their files on disk + cmake_expand_imported_targets(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") set(CHECK_PROTOTYPE_DEFINITION_LIBS - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") else(CMAKE_REQUIRED_LIBRARIES) set(CHECK_PROTOTYPE_DEFINITION_LIBS) endif(CMAKE_REQUIRED_LIBRARIES) diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake index 515319d..e6e677d 100644 --- a/Modules/CheckSymbolExists.cmake +++ b/Modules/CheckSymbolExists.cmake @@ -35,6 +35,9 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") + + MACRO(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE) _CHECK_SYMBOL_EXISTS("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c" "${SYMBOL}" "${FILES}" "${VARIABLE}" ) ENDMACRO(CHECK_SYMBOL_EXISTS) @@ -44,8 +47,10 @@ MACRO(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE) SET(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n") SET(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS}) IF(CMAKE_REQUIRED_LIBRARIES) + # this one translates potentially used imported library targets to their files on disk + CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") SET(CHECK_SYMBOL_EXISTS_LIBS - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") ELSE(CMAKE_REQUIRED_LIBRARIES) SET(CHECK_SYMBOL_EXISTS_LIBS) ENDIF(CMAKE_REQUIRED_LIBRARIES) diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake index 5d5c931..1717718 100644 --- a/Modules/CheckTypeSize.cmake +++ b/Modules/CheckTypeSize.cmake @@ -47,6 +47,7 @@ # License text for the above reference.) include(CheckIncludeFile) +include("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") cmake_policy(PUSH) cmake_minimum_required(VERSION 2.6 FATAL_ERROR) @@ -76,6 +77,10 @@ function(__check_type_size_impl type var map builtin) endforeach() # Perform the check. + + # this one translates potentially used imported library targets to their files on disk + cmake_expand_imported_targets(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") + set(src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${var}.c) set(bin ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${var}.bin) configure_file(${__check_type_size_dir}/CheckTypeSize.c.in ${src} @ONLY) @@ -84,7 +89,7 @@ function(__check_type_size_impl type var map builtin) CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${CMAKE_REQUIRED_FLAGS}" "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}" - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}" + "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}" OUTPUT_VARIABLE output COPY_FILE ${bin} ) diff --git a/Modules/CheckVariableExists.cmake b/Modules/CheckVariableExists.cmake index 8517002..7d6c794 100644 --- a/Modules/CheckVariableExists.cmake +++ b/Modules/CheckVariableExists.cmake @@ -26,14 +26,19 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake") + + MACRO(CHECK_VARIABLE_EXISTS VAR VARIABLE) IF("${VARIABLE}" MATCHES "^${VARIABLE}$") SET(MACRO_CHECK_VARIABLE_DEFINITIONS "-DCHECK_VARIABLE_EXISTS=${VAR} ${CMAKE_REQUIRED_FLAGS}") MESSAGE(STATUS "Looking for ${VAR}") IF(CMAKE_REQUIRED_LIBRARIES) + # this one translates potentially used imported library targets to their files on disk + CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") SET(CHECK_VARIABLE_EXISTS_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") ELSE(CMAKE_REQUIRED_LIBRARIES) SET(CHECK_VARIABLE_EXISTS_ADD_LIBRARIES) ENDIF(CMAKE_REQUIRED_LIBRARIES) diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index e65e362..a21e1b0 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -137,3 +137,14 @@ add_library(imp_lib1 STATIC imp_lib1.c) target_link_libraries(imp_lib1 exp_testLib2) add_library(imp_lib1b STATIC imp_lib1.c) target_link_libraries(imp_lib1b bld_testLib2) + +#----------------------------------------------------------------------------- +# Test that handling imported targets, including transitive dependencies, +# works in CheckFunctionExists (...and hopefully all other try_compile() checks +include(CheckFunctionExists) +unset(HAVE_TESTLIB1_FUNCTION CACHE) +set(CMAKE_REQUIRED_LIBRARIES exp_testLib2) +check_function_exists(testLib1 HAVE_TESTLIB1_FUNCTION) +if (NOT HAVE_TESTLIB1_FUNCTION) + message(SEND_ERROR "Using imported target testLib2 in check_function_exists() failed !") +endif() -- cgit v0.12 From 6a1c5a356911d3b75e60ecad86d7538e6de888f9 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Wed, 22 Feb 2012 00:01:03 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index e1ef1f8..baf15ad 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 21) +SET(KWSYS_DATE_STAMP_DAY 22) -- cgit v0.12 From edd5303949f9d0e1b4b11e83aecd34bfdb2700ce Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 4 Dec 2011 16:36:48 +0100 Subject: Refactor GetIncludeFlags to take includes instead of fetching them --- Source/cmLocalGenerator.cxx | 15 +++++++++------ Source/cmLocalGenerator.h | 4 ++-- Source/cmMakefileTargetGenerator.cxx | 6 +++++- Source/cmake.cxx | 6 +++++- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index ffbeb48..b02fc36 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -574,7 +574,11 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, std::string flags; flags += this->Makefile->GetSafeDefinition(varString.c_str()); flags += " "; - flags += this->GetIncludeFlags(lang); + { + std::vector includes; + this->GetIncludeDirectories(includes, lang); + flags += this->GetIncludeFlags(includes, lang); + } flags += this->Makefile->GetDefineFlags(); // Construct the command lines. @@ -1192,8 +1196,9 @@ cmLocalGenerator::ConvertToIncludeReference(std::string const& path) } //---------------------------------------------------------------------------- -const char* cmLocalGenerator::GetIncludeFlags(const char* lang, - bool forResponseFile) +const char* cmLocalGenerator::GetIncludeFlags( + const std::vector &includes, + const char* lang, bool forResponseFile) { if(!lang) { @@ -1207,9 +1212,6 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang, } cmOStringStream includeFlags; - std::vector includes; - this->GetIncludeDirectories(includes, lang); - std::vector::iterator i; std::string flagVar = "CMAKE_INCLUDE_FLAG_"; flagVar += lang; @@ -1251,6 +1253,7 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang, #ifdef __APPLE__ emitted.insert("/System/Library/Frameworks"); #endif + std::vector::const_iterator i; for(i = includes.begin(); i != includes.end(); ++i) { if(this->Makefile->IsOn("APPLE") diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 0c5b9d0..7e737ef 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -146,8 +146,8 @@ public: ///! Append flags to a string. virtual void AppendFlags(std::string& flags, const char* newFlags); ///! Get the include flags for the current makefile and language - const char* GetIncludeFlags(const char* lang, - bool forResponseFile = false); + const char* GetIncludeFlags(const std::vector &includes, + const char* lang, bool forResponseFile = false); /** * Encode a list of preprocessor definitions for the compiler diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index a3a832b..dd982fb 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1829,8 +1829,12 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags, responseVar += "_USE_RESPONSE_FILE_FOR_INCLUDES"; bool useResponseFile = this->Makefile->IsOn(responseVar.c_str()); + + std::vector includes; + this->LocalGenerator->GetIncludeDirectories(includes, lang); + std::string includeFlags = - this->LocalGenerator->GetIncludeFlags(lang, useResponseFile); + this->LocalGenerator->GetIncludeFlags(includes, lang, useResponseFile); if(includeFlags.empty()) { return; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index cce5080..749caf5 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -605,7 +605,11 @@ bool cmake::FindPackage(const std::vector& args) mf->AddIncludeDirectory(dirIt->c_str(), false); } - std::string includeFlags = lg->GetIncludeFlags(language.c_str(), false); + std::vector includeDirectories; + lg->GetIncludeDirectories(includeDirectories, language.c_str()); + std::string includeFlags = lg->GetIncludeFlags(includeDirectories, + language.c_str(), false); + std::string definitions = mf->GetSafeDefinition("PACKAGE_DEFINITIONS"); printf("%s %s\n", includeFlags.c_str(), definitions.c_str()); } -- cgit v0.12 From 97a5faa85895ca77679d794788731cf76b8704ce Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 4 Dec 2011 16:45:39 +0100 Subject: Make it safe to call this method without creating duplicates. --- Source/cmLocalGenerator.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index b02fc36..961de37 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1378,8 +1378,12 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, // Store the automatic include paths. if(includeBinaryDir) { - dirs.push_back(this->Makefile->GetStartOutputDirectory()); - emitted.insert(this->Makefile->GetStartOutputDirectory()); + if(emitted.find( + this->Makefile->GetStartOutputDirectory()) == emitted.end()) + { + dirs.push_back(this->Makefile->GetStartOutputDirectory()); + emitted.insert(this->Makefile->GetStartOutputDirectory()); + } } if(includeSourceDir) { -- cgit v0.12 From 7620932d8259572dc737d97cec83779efadab5a3 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 7 Nov 2011 11:49:33 +0100 Subject: Remove include flags memoization. --- Source/cmLocalGenerator.cxx | 15 ++------------- Source/cmLocalGenerator.h | 3 +-- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 961de37..fe481fa 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1196,7 +1196,7 @@ cmLocalGenerator::ConvertToIncludeReference(std::string const& path) } //---------------------------------------------------------------------------- -const char* cmLocalGenerator::GetIncludeFlags( +std::string cmLocalGenerator::GetIncludeFlags( const std::vector &includes, const char* lang, bool forResponseFile) { @@ -1204,12 +1204,6 @@ const char* cmLocalGenerator::GetIncludeFlags( { return ""; } - std::string key = lang; - key += forResponseFile? "@" : ""; - if(this->LanguageToIncludeFlags.count(key)) - { - return this->LanguageToIncludeFlags[key].c_str(); - } cmOStringStream includeFlags; @@ -1314,12 +1308,7 @@ const char* cmLocalGenerator::GetIncludeFlags( { flags[flags.size()-1] = ' '; } - this->LanguageToIncludeFlags[key] = flags; - - // Use this temorary variable for the return value to work-around a - // bogus GCC 2.95 warning. - const char* ret = this->LanguageToIncludeFlags[key].c_str(); - return ret; + return flags; } //---------------------------------------------------------------------------- diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 7e737ef..77ffd09 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -146,7 +146,7 @@ public: ///! Append flags to a string. virtual void AppendFlags(std::string& flags, const char* newFlags); ///! Get the include flags for the current makefile and language - const char* GetIncludeFlags(const std::vector &includes, + std::string GetIncludeFlags(const std::vector &includes, const char* lang, bool forResponseFile = false); /** @@ -392,7 +392,6 @@ protected: std::vector StartOutputDirectoryComponents; cmLocalGenerator* Parent; std::vector Children; - std::map LanguageToIncludeFlags; std::map UniqueObjectNamesMap; std::string::size_type ObjectPathMax; std::set ObjectMaxPathViolations; -- cgit v0.12 From 8adaee2b0b2651cfd93bb4a915d11bdd4cba1b51 Mon Sep 17 00:00:00 2001 From: David Cole Date: Tue, 24 Jan 2012 11:54:46 -0500 Subject: CMake: Eliminate cmMakefile::IncludeDirectories Instead, re-implement it in terms of the directory property INCLUDE_DIRECTORIES. --- Source/cmLocalGenerator.cxx | 6 +- Source/cmMakefile.cxx | 132 ++++++++++++++++++++++---------------------- Source/cmMakefile.h | 17 +----- 3 files changed, 71 insertions(+), 84 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index fe481fa..27b1b1b 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1399,7 +1399,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, } // Get the project-specified include directories. - std::vector& includes = + const std::vector& includes = this->Makefile->GetIncludeDirectories(); // Support putting all the in-project include directories first if @@ -1408,7 +1408,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, { const char* topSourceDir = this->Makefile->GetHomeDirectory(); const char* topBinaryDir = this->Makefile->GetHomeOutputDirectory(); - for(std::vector::iterator i = includes.begin(); + for(std::vector::const_iterator i = includes.begin(); i != includes.end(); ++i) { // Emit this directory only if it is a subdirectory of the @@ -1427,7 +1427,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, } // Construct the final ordered include directory list. - for(std::vector::iterator i = includes.begin(); + for(std::vector::const_iterator i = includes.begin(); i != includes.end(); ++i) { if(emitted.insert(*i).second) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index fdf5b31..cdb699e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -116,7 +116,6 @@ cmMakefile::cmMakefile(const cmMakefile& mf): Internal(new Internals) this->Targets = mf.Targets; this->SourceFiles = mf.SourceFiles; this->Tests = mf.Tests; - this->IncludeDirectories = mf.IncludeDirectories; this->LinkDirectories = mf.LinkDirectories; this->SystemIncludeDirectories = mf.SystemIncludeDirectories; this->ListFiles = mf.ListFiles; @@ -278,8 +277,6 @@ void cmMakefile::Print() this->cmHomeDirectory.c_str() << std::endl; std::cout << " this->ProjectName; " << this->ProjectName.c_str() << std::endl; - this->PrintStringVector("this->IncludeDirectories;", - this->IncludeDirectories); this->PrintStringVector("this->LinkDirectories", this->LinkDirectories); #if defined(CMAKE_BUILD_WITH_CMAKE) for( std::vector::const_iterator i = @@ -1478,7 +1475,8 @@ void cmMakefile::InitializeFromParent() this->Internal->VarStack.top() = parent->Internal->VarStack.top().Closure(); // copy include paths - this->IncludeDirectories = parent->IncludeDirectories; + this->SetProperty("INCLUDE_DIRECTORIES", + parent->GetProperty("INCLUDE_DIRECTORIES")); this->SystemIncludeDirectories = parent->SystemIncludeDirectories; // define flags @@ -1603,43 +1601,77 @@ void cmMakefile::AddSubDirectory(const char* srcPath, const char *binPath, } } -void cmMakefile::AddIncludeDirectory(const char* inc, bool before) +//---------------------------------------------------------------------------- +void AddStringToProperty(cmProperty *prop, const char* name, const char* s, + bool before) { - // if there is a newline then break it into multiple arguments - if (!inc) + if (!prop) { return; } - // Don't add an include directory that is already present. Yes, - // this linear search results in n^2 behavior, but n won't be - // getting much bigger than 20. We cannot use a set because of - // order dependency of the include path. - std::vector::iterator i = - std::find(this->IncludeDirectories.begin(), - this->IncludeDirectories.end(), inc); - if(i == this->IncludeDirectories.end()) + // Don't worry about duplicates at this point. We eliminate them when + // we convert the property to a vector in GetIncludeDirectories. + + if (before) { - if (before) + const char *val = prop->GetValue(); + cmOStringStream oss; + + if(val && *val) { - // WARNING: this *is* expensive (linear time) since it's a vector - this->IncludeDirectories.insert(this->IncludeDirectories.begin(), inc); + oss << s << ";" << val; } else { - this->IncludeDirectories.push_back(inc); + oss << s; } + + std::string newVal = oss.str(); + prop->Set(name, newVal.c_str()); } else { - if(before) + prop->Append(name, s); + } +} + +//---------------------------------------------------------------------------- +void cmMakefile::AddIncludeDirectory(const char* inc, bool before) +{ + if (!inc) + { + return; + } + + // Directory property: + cmProperty *prop = + this->GetProperties().GetOrCreateProperty("INCLUDE_DIRECTORIES"); + AddStringToProperty(prop, "INCLUDE_DIRECTORIES", inc, before); +} + +//---------------------------------------------------------------------------- +std::vector cmMakefile::GetIncludeDirectories() +{ + std::vector includes; + const char *val = this->GetProperty("INCLUDE_DIRECTORIES"); + if(val) + { + cmSystemTools::ExpandListArgument(val, includes); + } + + std::set uniqueIncludes; + std::vector orderedAndUniqueIncludes; + for(std::vector::const_iterator + li = includes.begin(); li != includes.end(); ++li) + { + if(uniqueIncludes.insert(*li).second) { - // if this before and already in the path then remove it - this->IncludeDirectories.erase(i); - // WARNING: this *is* expensive (linear time) since it's a vector - this->IncludeDirectories.insert(this->IncludeDirectories.begin(), inc); + orderedAndUniqueIncludes.push_back(*li); } } + + return orderedAndUniqueIncludes; } //---------------------------------------------------------------------------- @@ -2093,17 +2125,23 @@ void cmMakefile::AddExtraDirectory(const char* dir) } -// expance CMAKE_BINARY_DIR and CMAKE_SOURCE_DIR in the +// expand CMAKE_BINARY_DIR and CMAKE_SOURCE_DIR in the // include and library directories. void cmMakefile::ExpandVariables() { // Now expand variables in the include and link strings - for(std::vector::iterator d = this->IncludeDirectories.begin(); - d != this->IncludeDirectories.end(); ++d) + + // May not be necessary anymore... But may need a policy for strict + // backwards compatibility + const char *includeDirs = this->GetProperty("INCLUDE_DIRECTORIES"); + if (includeDirs) { - this->ExpandVariablesInString(*d, true, true); + std::string dirs = includeDirs; + this->ExpandVariablesInString(dirs, true, true); + this->SetProperty("INCLUDE_DIRECTORIES", dirs.c_str()); } + for(std::vector::iterator d = this->LinkDirectories.begin(); d != this->LinkDirectories.end(); ++d) { @@ -3317,16 +3355,6 @@ void cmMakefile::SetProperty(const char* prop, const char* value) // handle special props std::string propname = prop; - if ( propname == "INCLUDE_DIRECTORIES" ) - { - std::vector varArgsExpanded; - if(value) - { - cmSystemTools::ExpandListArgument(value, varArgsExpanded); - } - this->SetIncludeDirectories(varArgsExpanded); - return; - } if ( propname == "LINK_DIRECTORIES" ) { @@ -3368,17 +3396,6 @@ void cmMakefile::AppendProperty(const char* prop, const char* value, // handle special props std::string propname = prop; - if ( propname == "INCLUDE_DIRECTORIES" ) - { - std::vector varArgsExpanded; - cmSystemTools::ExpandListArgument(value, varArgsExpanded); - for(std::vector::const_iterator vi = varArgsExpanded.begin(); - vi != varArgsExpanded.end(); ++vi) - { - this->AddIncludeDirectory(vi->c_str()); - } - return; - } if ( propname == "LINK_DIRECTORIES" ) { @@ -3474,23 +3491,6 @@ const char *cmMakefile::GetProperty(const char* prop, output += this->DefineFlagsOrig; return output.c_str(); } - else if (!strcmp("INCLUDE_DIRECTORIES",prop) ) - { - cmOStringStream str; - for (std::vector::const_iterator - it = this->GetIncludeDirectories().begin(); - it != this->GetIncludeDirectories().end(); - ++ it ) - { - if ( it != this->GetIncludeDirectories().begin()) - { - str << ";"; - } - str << it->c_str(); - } - output = str.str(); - return output.c_str(); - } else if (!strcmp("LINK_DIRECTORIES",prop)) { cmOStringStream str; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 1c46a73..5e5310f 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -524,18 +524,7 @@ public: /** * Get a list of include directories in the build. */ - std::vector& GetIncludeDirectories() - { - return this->IncludeDirectories; - } - const std::vector& GetIncludeDirectories() const - { - return this->IncludeDirectories; - } - void SetIncludeDirectories(const std::vector& vec) - { - this->IncludeDirectories = vec; - } + std::vector GetIncludeDirectories(); /** * Mark include directories as system directories. @@ -880,9 +869,7 @@ protected: // Tests std::map Tests; - // The include and link-library paths. These may have order - // dependency, so they must be vectors (not set). - std::vector IncludeDirectories; + // The link-library paths. Order matters, use std::vector (not std::set). std::vector LinkDirectories; // The set of include directories that are marked as system include -- cgit v0.12 From a4d5f7b9b270d3fa85e8a0a1608c4205dff744d9 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 4 Dec 2011 16:32:13 +0100 Subject: Add API to get the ordered includes for a target. --- Source/cmTarget.cxx | 24 ++++++++++++++++++++++++ Source/cmTarget.h | 3 +++ 2 files changed, 27 insertions(+) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 0c79b30..5c902e1 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -4676,6 +4676,30 @@ cmTarget::GetLinkInformation(const char* config) } //---------------------------------------------------------------------------- +std::vector cmTarget::GetIncludeDirectories() +{ + std::vector includes; + const char *prop = this->GetProperty("INCLUDE_DIRECTORIES"); + if(prop) + { + cmSystemTools::ExpandListArgument(prop, includes); + } + + std::set uniqueIncludes; + std::vector orderedAndUniqueIncludes; + for(std::vector::const_iterator + li = includes.begin(); li != includes.end(); ++li) + { + if(uniqueIncludes.insert(*li).second) + { + orderedAndUniqueIncludes.push_back(*li); + } + } + + return orderedAndUniqueIncludes; +} + +//---------------------------------------------------------------------------- cmTargetLinkInformationMap ::cmTargetLinkInformationMap(cmTargetLinkInformationMap const& r): derived() { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 59f0184..dfed499 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -458,6 +458,9 @@ public: directory. */ bool UsesDefaultOutputDir(const char* config, bool implib); + /** Get the include directories for this target. */ + std::vector GetIncludeDirectories(); + private: /** * A list of direct dependencies. Use in conjunction with DependencyMap. -- cgit v0.12 From 840509babb2d1c8fc5167c4580fef58546c06700 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 4 Dec 2011 16:40:39 +0100 Subject: Keep the INCLUDE_DIRECTORIES target property up to date. The directory level property changes need to be added to it. --- Source/cmMakefile.cxx | 9 +++++++++ Source/cmTarget.cxx | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index cdb699e..6290412 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1648,6 +1648,15 @@ void cmMakefile::AddIncludeDirectory(const char* inc, bool before) cmProperty *prop = this->GetProperties().GetOrCreateProperty("INCLUDE_DIRECTORIES"); AddStringToProperty(prop, "INCLUDE_DIRECTORIES", inc, before); + + // Property on each target: + for (cmTargets::iterator l = this->Targets.begin(); + l != this->Targets.end(); ++l) + { + cmTarget &t = l->second; + prop = t.GetProperties().GetOrCreateProperty("INCLUDE_DIRECTORIES"); + AddStringToProperty(prop, "INCLUDE_DIRECTORIES", inc, before); + } } //---------------------------------------------------------------------------- diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 5c902e1..cd816a6 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1279,6 +1279,11 @@ void cmTarget::SetMakefile(cmMakefile* mf) // Save the backtrace of target construction. this->Makefile->GetBacktrace(this->Internal->Backtrace); + // Initialize the INCLUDE_DIRECTORIES property based on the current value + // of the same directory property: + this->SetProperty("INCLUDE_DIRECTORIES", + this->Makefile->GetProperty("INCLUDE_DIRECTORIES")); + // Record current policies for later use. this->PolicyStatusCMP0003 = this->Makefile->GetPolicyStatus(cmPolicies::CMP0003); -- cgit v0.12 From 9106b564ae5bf0bf1c1ff4a3fca484bcfd40e183 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 5 Nov 2011 16:17:49 +0100 Subject: Extract and use the INCLUDE_DIRECTORIES target properties. Eliminate callers of cmMakefile::GetIncludeDirectories. All callers of GetIncludeDirectories should go through the local generator object. Only the local generator calls cmTarget::GetIncludeDirectories directly. --- Source/cmDepends.cxx | 14 ++- Source/cmExtraCodeBlocksGenerator.cxx | 11 ++- Source/cmExtraEclipseCDT4Generator.cxx | 10 +- Source/cmGlobalGenerator.cxx | 39 ++++---- Source/cmGlobalXCodeGenerator.cxx | 2 +- Source/cmLocalGenerator.cxx | 14 ++- Source/cmLocalGenerator.h | 1 + Source/cmLocalUnixMakefileGenerator3.cxx | 22 ----- Source/cmLocalVisualStudio6Generator.cxx | 105 ++++++++++++--------- Source/cmLocalVisualStudio6Generator.h | 2 +- Source/cmLocalVisualStudio7Generator.cxx | 2 +- Source/cmMakeDepend.cxx | 22 +++-- Source/cmMakefileTargetGenerator.cxx | 35 ++++++- Source/cmVisualStudio10TargetGenerator.cxx | 2 +- Source/cmake.cxx | 10 +- Tests/IncludeDirectories/CMakeLists.txt | 2 + .../TargetIncludeDirectories/CMakeLists.txt | 26 +++++ .../TargetIncludeDirectories/main.cpp | 10 ++ 18 files changed, 204 insertions(+), 125 deletions(-) create mode 100644 Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt create mode 100644 Tests/IncludeDirectories/TargetIncludeDirectories/main.cpp diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 19558fa..94ff471 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -260,12 +260,24 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends, //---------------------------------------------------------------------------- void cmDepends::SetIncludePathFromLanguage(const char* lang) { + // Look for the new per "TARGET_" variant first: std::string includePathVar = "CMAKE_"; includePathVar += lang; - includePathVar += "_INCLUDE_PATH"; + includePathVar += "_TARGET_INCLUDE_PATH"; cmMakefile* mf = this->LocalGenerator->GetMakefile(); if(const char* includePath = mf->GetDefinition(includePathVar.c_str())) { cmSystemTools::ExpandListArgument(includePath, this->IncludePath); } + else + { + // Fallback to the old directory level variable if no per-target var: + includePathVar = "CMAKE_"; + includePathVar += lang; + includePathVar += "_INCLUDE_PATH"; + if(const char* includePath = mf->GetDefinition(includePathVar.c_str())) + { + cmSystemTools::ExpandListArgument(includePath, this->IncludePath); + } + } } diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 38002ec..b5cba8e 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -600,16 +600,17 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, // the include directories for this target std::set uniqIncludeDirs; - const std::vector& incDirs = - target->GetMakefile()->GetIncludeDirectories(); - for(std::vector::const_iterator dirIt=incDirs.begin(); - dirIt != incDirs.end(); + + std::vector includes; + target->GetMakefile()->GetLocalGenerator()-> + GetIncludeDirectories(includes, target); + for(std::vector::const_iterator dirIt=includes.begin(); + dirIt != includes.end(); ++dirIt) { uniqIncludeDirs.insert(*dirIt); } - std::string systemIncludeDirs = makefile->GetSafeDefinition( "CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS"); if (!systemIncludeDirs.empty()) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 07549e9..19372c8 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -893,9 +893,13 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const it != this->GlobalGenerator->GetLocalGenerators().end(); ++it) { - const std::vector& includeDirs - = (*it)->GetMakefile()->GetIncludeDirectories(); - this->AppendIncludeDirectories(fout, includeDirs, emmited); + cmTargets & targets = (*it)->GetMakefile()->GetTargets(); + for (cmTargets::iterator l = targets.begin(); l != targets.end(); ++l) + { + std::vector includeDirs; + (*it)->GetIncludeDirectories(includeDirs, &l->second); + this->AppendIncludeDirectories(fout, includeDirs, emmited); + } } // now also the system include directories, in case we found them in // CMakeSystemSpecificInformation.cmake. This makes Eclipse find the diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 8dce053..a988844 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1067,9 +1067,9 @@ void cmGlobalGenerator::CheckLocalGenerators() { manager = this->LocalGenerators[i]->GetMakefile()->GetCacheManager(); this->LocalGenerators[i]->ConfigureFinalPass(); - const cmTargets & targets = + cmTargets & targets = this->LocalGenerators[i]->GetMakefile()->GetTargets(); - for (cmTargets::const_iterator l = targets.begin(); + for (cmTargets::iterator l = targets.begin(); l != targets.end(); l++) { const cmTarget::LinkLibraryVectorType& libs = @@ -1095,27 +1095,28 @@ void cmGlobalGenerator::CheckLocalGenerators() notFoundMap[varName] = text; } } - } - const std::vector& incs = - this->LocalGenerators[i]->GetMakefile()->GetIncludeDirectories(); + std::vector incs; + this->LocalGenerators[i]->GetIncludeDirectories(incs, &l->second); - for( std::vector::const_iterator incDir = incs.begin(); - incDir != incs.end(); ++incDir) - { - if(incDir->size() > 9 && - cmSystemTools::IsNOTFOUND(incDir->c_str())) + for( std::vector::const_iterator incDir = incs.begin(); + incDir != incs.end(); ++incDir) { - std::string varName = incDir->substr(0, incDir->size()-9); - cmCacheManager::CacheIterator it = - manager->GetCacheIterator(varName.c_str()); - if(it.GetPropertyAsBool("ADVANCED")) + if(incDir->size() > 9 && + cmSystemTools::IsNOTFOUND(incDir->c_str())) { - varName += " (ADVANCED)"; + std::string varName = incDir->substr(0, incDir->size()-9); + cmCacheManager::CacheIterator it = + manager->GetCacheIterator(varName.c_str()); + if(it.GetPropertyAsBool("ADVANCED")) + { + varName += " (ADVANCED)"; + } + std::string text = notFoundMap[varName]; + text += "\n used as include directory in directory "; + text += this->LocalGenerators[i] + ->GetMakefile()->GetCurrentDirectory(); + notFoundMap[varName] = text; } - std::string text = notFoundMap[varName]; - text += "\n used as include directory in directory "; - text += this->LocalGenerators[i]->GetMakefile()->GetCurrentDirectory(); - notFoundMap[varName] = text; } } this->CMakeInstance->UpdateProgress diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 859503f..cb74746 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1811,7 +1811,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, BuildObjectListOrString dirs(this, this->XcodeVersion >= 30); BuildObjectListOrString fdirs(this, this->XcodeVersion >= 30); std::vector includes; - this->CurrentLocalGenerator->GetIncludeDirectories(includes); + this->CurrentLocalGenerator->GetIncludeDirectories(includes, &target); std::set emitted; emitted.insert("/System/Library/Frameworks"); for(std::vector::iterator i = includes.begin(); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 27b1b1b..4f5af0a 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -556,7 +556,7 @@ void cmLocalGenerator::GenerateTargetManifest() void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, const char* lang, cmSourceFile& source, - cmTarget& ) + cmTarget& target) { std::string objectDir = cmSystemTools::GetFilenamePath(std::string(ofname)); objectDir = this->Convert(objectDir.c_str(),START_OUTPUT,SHELL); @@ -576,7 +576,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, flags += " "; { std::vector includes; - this->GetIncludeDirectories(includes, lang); + this->GetIncludeDirectories(includes, &target, lang); flags += this->GetIncludeFlags(includes, lang); } flags += this->Makefile->GetDefineFlags(); @@ -1313,6 +1313,7 @@ std::string cmLocalGenerator::GetIncludeFlags( //---------------------------------------------------------------------------- void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, + cmTarget* target, const char* lang) { // Need to decide whether to automatically include the source and @@ -1398,9 +1399,12 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, } } - // Get the project-specified include directories. - const std::vector& includes = - this->Makefile->GetIncludeDirectories(); + // Get the target-specific include directories. + std::vector includes; + if(target) + { + includes = target->GetIncludeDirectories(); + } // Support putting all the in-project include directories first if // it is requested by the project. diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 77ffd09..77c8862 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -195,6 +195,7 @@ public: /** Get the include flags for the current makefile and language. */ void GetIncludeDirectories(std::vector& dirs, + cmTarget* target, const char* lang = "C"); /** Compute the language used to compile the given source file. */ diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index dd313ca..75226b5 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -452,28 +452,6 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() << "\n"; } - // Store the include search path for this directory. - infoFileStream - << "# The C and CXX include file search paths:\n"; - infoFileStream - << "SET(CMAKE_C_INCLUDE_PATH\n"; - std::vector includeDirs; - this->GetIncludeDirectories(includeDirs); - for(std::vector::iterator i = includeDirs.begin(); - i != includeDirs.end(); ++i) - { - infoFileStream - << " \"" << this->Convert(i->c_str(),HOME_OUTPUT).c_str() << "\"\n"; - } - infoFileStream - << " )\n"; - infoFileStream - << "SET(CMAKE_CXX_INCLUDE_PATH ${CMAKE_C_INCLUDE_PATH})\n"; - infoFileStream - << "SET(CMAKE_Fortran_INCLUDE_PATH ${CMAKE_C_INCLUDE_PATH})\n"; - infoFileStream - << "SET(CMAKE_ASM_INCLUDE_PATH ${CMAKE_C_INCLUDE_PATH})\n"; - // Store the include regular expressions for this directory. infoFileStream << "\n" diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 1dfcbea..c846d6b 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -103,52 +103,9 @@ void cmLocalVisualStudio6Generator::OutputDSPFile() } } - // Setup /I and /LIBPATH options for the resulting DSP file. VS 6 - // truncates long include paths so make it as short as possible if - // the length threatens this problem. - unsigned int maxIncludeLength = 3000; - bool useShortPath = false; - for(int j=0; j < 2; ++j) - { - std::vector includes; - this->GetIncludeDirectories(includes); - std::vector::iterator i; - for(i = includes.begin(); i != includes.end(); ++i) - { - std::string tmp = - this->ConvertToOptionallyRelativeOutputPath(i->c_str()); - if(useShortPath) - { - cmSystemTools::GetShortPath(tmp.c_str(), tmp); - } - this->IncludeOptions += " /I "; - - // quote if not already quoted - if (tmp[0] != '"') - { - this->IncludeOptions += "\""; - this->IncludeOptions += tmp; - this->IncludeOptions += "\""; - } - else - { - this->IncludeOptions += tmp; - } - } - if(j == 0 && this->IncludeOptions.size() > maxIncludeLength) - { - this->IncludeOptions = ""; - useShortPath = true; - } - else - { - break; - } - } - // Create the DSP or set of DSP's for libraries and executables - cmTargets &tgts = this->Makefile->GetTargets(); + cmTargets &tgts = this->Makefile->GetTargets(); for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) { @@ -895,6 +852,61 @@ inline std::string removeQuotes(const std::string& s) return s; } + +std::string +cmLocalVisualStudio6Generator::GetTargetIncludeOptions(cmTarget &target) +{ + std::string includeOptions; + + // Setup /I and /LIBPATH options for the resulting DSP file. VS 6 + // truncates long include paths so make it as short as possible if + // the length threatens this problem. + unsigned int maxIncludeLength = 3000; + bool useShortPath = false; + for(int j=0; j < 2; ++j) + { + std::vector includes; + this->GetIncludeDirectories(includes, &target); + + std::vector::iterator i; + for(i = includes.begin(); i != includes.end(); ++i) + { + std::string tmp = + this->ConvertToOptionallyRelativeOutputPath(i->c_str()); + if(useShortPath) + { + cmSystemTools::GetShortPath(tmp.c_str(), tmp); + } + includeOptions += " /I "; + + // quote if not already quoted + if (tmp[0] != '"') + { + includeOptions += "\""; + includeOptions += tmp; + includeOptions += "\""; + } + else + { + includeOptions += tmp; + } + } + + if(j == 0 && includeOptions.size() > maxIncludeLength) + { + includeOptions = ""; + useShortPath = true; + } + else + { + break; + } + } + + return includeOptions; +} + + // Code in blocks surrounded by a test for this definition is needed // only for compatibility with user project's replacement DSP // templates. The CMake templates no longer use them. @@ -1132,6 +1144,9 @@ void cmLocalVisualStudio6Generator } #endif + // Get include options for this target. + std::string includeOptions = this->GetTargetIncludeOptions(target); + // Get extra linker options for this target type. std::string extraLinkOptions; std::string extraLinkOptionsDebug; @@ -1510,7 +1525,7 @@ void cmLocalVisualStudio6Generator optionsRelWithDebInfo.c_str()); cmSystemTools::ReplaceString(line, "BUILD_INCLUDES", - this->IncludeOptions.c_str()); + includeOptions.c_str()); cmSystemTools::ReplaceString(line, "TARGET_VERSION_FLAG", targetVersionFlag.c_str()); cmSystemTools::ReplaceString(line, "TARGET_IMPLIB_FLAG_DEBUG", diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h index 195d654..c9c5dd1 100644 --- a/Source/cmLocalVisualStudio6Generator.h +++ b/Source/cmLocalVisualStudio6Generator.h @@ -89,7 +89,7 @@ private: void ComputeLinkOptions(cmTarget& target, const char* configName, const std::string extraOptions, std::string& options); - std::string IncludeOptions; + std::string GetTargetIncludeOptions(cmTarget &target); std::vector Configurations; std::string GetConfigName(std::string const& configuration) const; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 11a0387..1743517 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -807,7 +807,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, targetOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); fout << "\t\t\t\tAdditionalIncludeDirectories=\""; std::vector includes; - this->GetIncludeDirectories(includes); + this->GetIncludeDirectories(includes, &target); std::vector::iterator i = includes.begin(); for(;i != includes.end(); ++i) { diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx index 0b4eea5..03fe33d 100644 --- a/Source/cmMakeDepend.cxx +++ b/Source/cmMakeDepend.cxx @@ -54,16 +54,20 @@ void cmMakeDepend::SetMakefile(cmMakefile* makefile) this->Makefile->IncludeFileRegularExpression.c_str()); this->ComplainFileRegularExpression.compile( this->Makefile->ComplainFileRegularExpression.c_str()); - - // Now extract any include paths from the makefile flags - const std::vector& includes = - this->Makefile->GetIncludeDirectories(); - for(std::vector::const_iterator j = includes.begin(); - j != includes.end(); ++j) + + // Now extract any include paths from the targets + cmTargets & targets = this->Makefile->GetTargets(); + for (cmTargets::iterator l = targets.begin(); l != targets.end(); ++l) { - std::string path = *j; - this->Makefile->ExpandVariablesInString(path); - this->AddSearchPath(path.c_str()); + const std::vector& includes = + l->second.GetIncludeDirectories(); + for(std::vector::const_iterator j = includes.begin(); + j != includes.end(); ++j) + { + std::string path = *j; + this->Makefile->ExpandVariablesInString(path); + this->AddSearchPath(path.c_str()); + } } } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index dd982fb..e5be4aa 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1069,6 +1069,35 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() << "SET(CMAKE_Fortran_TARGET_MODULE_DIR \"" << mdir << "\")\n"; } + // Target-specific include directories: + *this->InfoFileStream + << "\n" + << "# The include file search paths:\n"; + *this->InfoFileStream + << "SET(CMAKE_C_TARGET_INCLUDE_PATH\n"; + std::vector includes; + this->LocalGenerator->GetIncludeDirectories(includes, this->Target); + for(std::vector::iterator i = includes.begin(); + i != includes.end(); ++i) + { + *this->InfoFileStream + << " \"" + << this->LocalGenerator->Convert(i->c_str(), + cmLocalGenerator::HOME_OUTPUT) + << "\"\n"; + } + *this->InfoFileStream + << " )\n"; + *this->InfoFileStream + << "SET(CMAKE_CXX_TARGET_INCLUDE_PATH " + << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; + *this->InfoFileStream + << "SET(CMAKE_Fortran_TARGET_INCLUDE_PATH " + << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; + *this->InfoFileStream + << "SET(CMAKE_ASM_TARGET_INCLUDE_PATH " + << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; + // and now write the rule to use it std::vector depends; std::vector commands; @@ -1534,7 +1563,7 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags() emitted.insert("/System/Library/Frameworks"); #endif std::vector includes; - this->LocalGenerator->GetIncludeDirectories(includes); + this->LocalGenerator->GetIncludeDirectories(includes, this->Target); std::vector::iterator i; // check all include directories for frameworks as this // will already have added a -F for the framework @@ -1831,7 +1860,7 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags, std::vector includes; - this->LocalGenerator->GetIncludeDirectories(includes, lang); + this->LocalGenerator->GetIncludeDirectories(includes, this->Target, lang); std::string includeFlags = this->LocalGenerator->GetIncludeFlags(includes, lang, useResponseFile); @@ -1934,7 +1963,7 @@ void cmMakefileTargetGenerator::AddFortranFlags(std::string& flags) this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG")) { std::vector includes; - this->LocalGenerator->GetIncludeDirectories(includes); + this->LocalGenerator->GetIncludeDirectories(includes, this->Target); for(std::vector::const_iterator idi = includes.begin(); idi != includes.end(); ++idi) { diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 9418761..f9148a1 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1586,7 +1586,7 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups() static_cast (this->GlobalGenerator)->GetConfigurations(); std::vector includes; - this->LocalGenerator->GetIncludeDirectories(includes); + this->LocalGenerator->GetIncludeDirectories(includes, this->Target); for(std::vector::iterator i = configs->begin(); i != configs->end(); ++i) { diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 749caf5..fc530f9 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -598,16 +598,8 @@ bool cmake::FindPackage(const std::vector& args) std::string includes = mf->GetSafeDefinition("PACKAGE_INCLUDE_DIRS"); std::vector includeDirs; cmSystemTools::ExpandListArgument(includes, includeDirs); - for(std::vector::const_iterator dirIt=includeDirs.begin(); - dirIt != includeDirs.end(); - ++dirIt) - { - mf->AddIncludeDirectory(dirIt->c_str(), false); - } - std::vector includeDirectories; - lg->GetIncludeDirectories(includeDirectories, language.c_str()); - std::string includeFlags = lg->GetIncludeFlags(includeDirectories, + std::string includeFlags = lg->GetIncludeFlags(includeDirs, language.c_str(), false); std::string definitions = mf->GetSafeDefinition("PACKAGE_DEFINITIONS"); diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt index 60b8c22..60f5e5e 100644 --- a/Tests/IncludeDirectories/CMakeLists.txt +++ b/Tests/IncludeDirectories/CMakeLists.txt @@ -45,3 +45,5 @@ else() set_target_properties(IncludeDirectories PROPERTIES COMPILE_FLAGS "-ITarProp") endif() + +add_subdirectory(TargetIncludeDirectories) diff --git a/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt new file mode 100644 index 0000000..2cf36f5 --- /dev/null +++ b/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt @@ -0,0 +1,26 @@ + +cmake_minimum_required(VERSION 2.8) + +project(TargetIncludeDirectories) + +macro(create_header _name) + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${_name}") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${_name}/${_name}.h" + "//${_name}.h + ") +endmacro() + +create_header(bar) +create_header(bat) +create_header(foo) +create_header(baz) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +include_directories("${CMAKE_CURRENT_BINARY_DIR}/bar") + +add_executable(TargetIncludeDirectories main.cpp) +set_property(TARGET TargetIncludeDirectories APPEND PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/bat") +set_property(TARGET TargetIncludeDirectories APPEND PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/foo") + +include_directories("${CMAKE_CURRENT_BINARY_DIR}/baz") diff --git a/Tests/IncludeDirectories/TargetIncludeDirectories/main.cpp b/Tests/IncludeDirectories/TargetIncludeDirectories/main.cpp new file mode 100644 index 0000000..8aa3532 --- /dev/null +++ b/Tests/IncludeDirectories/TargetIncludeDirectories/main.cpp @@ -0,0 +1,10 @@ + +#include "bar.h" +#include "bat.h" +#include "foo.h" +#include "baz.h" + +int main(int, char**) +{ + return 0; +} -- cgit v0.12 From 22021f07f80163979e8dedfcefccee53f4693fae Mon Sep 17 00:00:00 2001 From: David Cole Date: Wed, 22 Feb 2012 07:25:43 -0500 Subject: Remove cmMakefile::GetIncludeDirectories After making the changes to use the new target level INCLUDE_DIRECTORIES property, there are no more callers of this method. --- Source/cmMakefile.cxx | 24 ------------------------ Source/cmMakefile.h | 5 ----- 2 files changed, 29 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 6290412..818bb1b 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1660,30 +1660,6 @@ void cmMakefile::AddIncludeDirectory(const char* inc, bool before) } //---------------------------------------------------------------------------- -std::vector cmMakefile::GetIncludeDirectories() -{ - std::vector includes; - const char *val = this->GetProperty("INCLUDE_DIRECTORIES"); - if(val) - { - cmSystemTools::ExpandListArgument(val, includes); - } - - std::set uniqueIncludes; - std::vector orderedAndUniqueIncludes; - for(std::vector::const_iterator - li = includes.begin(); li != includes.end(); ++li) - { - if(uniqueIncludes.insert(*li).second) - { - orderedAndUniqueIncludes.push_back(*li); - } - } - - return orderedAndUniqueIncludes; -} - -//---------------------------------------------------------------------------- void cmMakefile::AddSystemIncludeDirectory(const char* dir) { this->SystemIncludeDirectories.insert(dir); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 5e5310f..c2939fb 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -522,11 +522,6 @@ public: cmTarget* FindTargetToUse(const char* name); /** - * Get a list of include directories in the build. - */ - std::vector GetIncludeDirectories(); - - /** * Mark include directories as system directories. */ void AddSystemIncludeDirectory(const char* dir); -- cgit v0.12 From c21db870a5912015a3fe64753a7df49318ceff1e Mon Sep 17 00:00:00 2001 From: David Cole Date: Wed, 22 Feb 2012 07:23:06 -0500 Subject: Make search paths ordered and unique Avoid duplicates. Same as before the introduction of the INCLUDE_DIRECTORIES target property. --- Source/cmMakeDepend.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx index 03fe33d..6055c55 100644 --- a/Source/cmMakeDepend.cxx +++ b/Source/cmMakeDepend.cxx @@ -56,6 +56,8 @@ void cmMakeDepend::SetMakefile(cmMakefile* makefile) this->Makefile->ComplainFileRegularExpression.c_str()); // Now extract any include paths from the targets + std::set uniqueIncludes; + std::vector orderedAndUniqueIncludes; cmTargets & targets = this->Makefile->GetTargets(); for (cmTargets::iterator l = targets.begin(); l != targets.end(); ++l) { @@ -66,9 +68,20 @@ void cmMakeDepend::SetMakefile(cmMakefile* makefile) { std::string path = *j; this->Makefile->ExpandVariablesInString(path); - this->AddSearchPath(path.c_str()); + if(uniqueIncludes.insert(path).second) + { + orderedAndUniqueIncludes.push_back(path); + } } } + + for(std::vector::const_iterator + it = orderedAndUniqueIncludes.begin(); + it != orderedAndUniqueIncludes.end(); + ++it) + { + this->AddSearchPath(it->c_str()); + } } -- cgit v0.12 From d899eb71b52616c9e3f3f5987f229619605e632b Mon Sep 17 00:00:00 2001 From: David Cole Date: Wed, 22 Feb 2012 07:14:11 -0500 Subject: Call ExpandVariablesInString for each target's INCLUDE_DIRECTORIES For strict backwards compatibility only. This should be unnecessary at this point, but introducing a policy to deprecate it properly is a whole different topic branch... --- Source/cmMakefile.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 818bb1b..84dc872 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2127,6 +2127,20 @@ void cmMakefile::ExpandVariables() this->SetProperty("INCLUDE_DIRECTORIES", dirs.c_str()); } + // Also for each target's INCLUDE_DIRECTORIES property: + for (cmTargets::iterator l = this->Targets.begin(); + l != this->Targets.end(); ++l) + { + cmTarget &t = l->second; + const char *includeDirs = t.GetProperty("INCLUDE_DIRECTORIES"); + if (includeDirs) + { + std::string dirs = includeDirs; + this->ExpandVariablesInString(dirs, true, true); + t.SetProperty("INCLUDE_DIRECTORIES", dirs.c_str()); + } + } + for(std::vector::iterator d = this->LinkDirectories.begin(); d != this->LinkDirectories.end(); ++d) { -- cgit v0.12 From 8233636dbe531ccf36510242e7c997dfa6529bde Mon Sep 17 00:00:00 2001 From: David Cole Date: Wed, 22 Feb 2012 14:30:00 -0500 Subject: Update the documentation regarding INCLUDE_DIRECTORIES. It is now a target property and is affected by the use of the include_directories command. --- Source/cmIncludeDirectoryCommand.h | 22 +++++++++++++++------- Source/cmMakefile.cxx | 19 ++++++++++++++++--- Source/cmTarget.cxx | 20 ++++++++++++++++++++ 3 files changed, 51 insertions(+), 10 deletions(-) diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h index 3b35d55..cbe344f 100644 --- a/Source/cmIncludeDirectoryCommand.h +++ b/Source/cmIncludeDirectoryCommand.h @@ -58,13 +58,21 @@ public: { return " include_directories([AFTER|BEFORE] [SYSTEM] dir1 dir2 ...)\n" - "Add the given directories to those searched by the compiler for " - "include files. By default the directories are appended onto " - "the current list of directories. This default behavior can be " - "changed by setting CMAKE_INCLUDE_DIRECTORIES_BEFORE to ON. " - "By using BEFORE or AFTER you can select between appending and " - "prepending, independent from the default. " - "If the SYSTEM option is given the compiler will be told that the " + "Add the given directories to those the compiler uses to search " + "for include files. " + "These directories are added to the directory property " + "INCLUDE_DIRECTORIES for the current CMakeLists file. " + "They are also added to the target property INCLUDE_DIRECTORIES " + "for each target in the current CMakeLists file. " + "The target property values are the ones used by the generators." + "\n" + "By default the directories are appended onto the current list of " + "directories. " + "This default behavior can be changed by setting " + "CMAKE_INCLUDE_DIRECTORIES_BEFORE to ON. " + "By using AFTER or BEFORE explicitly, you can select between " + "appending and prepending, independent of the default. " + "If the SYSTEM option is given, the compiler will be told the " "directories are meant as system include directories on some " "platforms."; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 84dc872..d206d32 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3860,9 +3860,22 @@ void cmMakefile::DefineProperties(cmake *cm) cm->DefineProperty ("INCLUDE_DIRECTORIES", cmProperty::DIRECTORY, "List of preprocessor include file search directories.", - "This read-only property specifies the list of directories given " - "so far to the include_directories command. " - "It is intended for debugging purposes.", false); + "This property specifies the list of directories given " + "so far to the include_directories command. " + "This property exists on directories and targets. " + "In addition to accepting values from the include_directories " + "command, values may be set directly on any directory or any " + "target using the set_property command. " + "A target gets its initial value for this property from the value " + "of the directory property. " + "A directory gets its initial value from its parent directory if " + "it has one. " + "Both directory and target property values are adjusted by calls " + "to the include_directories command." + "\n" + "The target property values are used by the generators to set " + "the include paths for the compiler. " + "See also the include_directories command."); cm->DefineProperty ("LINK_DIRECTORIES", cmProperty::DIRECTORY, diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index cd816a6..e618bee 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -486,6 +486,26 @@ void cmTarget::DefineProperties(cmake *cm) "undefined behavior."); cm->DefineProperty + ("INCLUDE_DIRECTORIES", cmProperty::TARGET, + "List of preprocessor include file search directories.", + "This property specifies the list of directories given " + "so far to the include_directories command. " + "This property exists on directories and targets. " + "In addition to accepting values from the include_directories " + "command, values may be set directly on any directory or any " + "target using the set_property command. " + "A target gets its initial value for this property from the value " + "of the directory property. " + "A directory gets its initial value from its parent directory if " + "it has one. " + "Both directory and target property values are adjusted by calls " + "to the include_directories command." + "\n" + "The target property values are used by the generators to set " + "the include paths for the compiler. " + "See also the include_directories command."); + + cm->DefineProperty ("INSTALL_NAME_DIR", cmProperty::TARGET, "Mac OSX directory name for installed targets.", "INSTALL_NAME_DIR is a string specifying the " -- cgit v0.12