From 6fe5b3db0b2ca3f9203a54589de0d744d59744c0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 7 Dec 2010 13:44:54 -0500 Subject: Simplify VS generator ConstructScript interface Pass to cmLocalVisualStudioGenerator::ConstructScript a cmCustomCommand instance instead of extracting arguments at all call sites. --- Source/cmLocalVisualStudio6Generator.cxx | 15 ++------------- Source/cmLocalVisualStudio7Generator.cxx | 14 ++------------ Source/cmLocalVisualStudioGenerator.cxx | 10 ++++++---- Source/cmLocalVisualStudioGenerator.h | 6 ++---- Source/cmVisualStudio10TargetGenerator.cxx | 16 ++-------------- 5 files changed, 14 insertions(+), 47 deletions(-) diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index b50c133..851c526 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -65,13 +65,7 @@ public: { this->Code += "\\\n\t"; } - this->Code += - this->LG->ConstructScript(cc.GetCommandLines(), - cc.GetWorkingDirectory(), - this->Config, - cc.GetEscapeOldStyle(), - cc.GetEscapeAllowMakeVars(), - "\\\n\t"); + this->Code += this->LG->ConstructScript(cc, this->Config, "\\\n\t"); } private: cmLocalVisualStudio6Generator* LG; @@ -659,12 +653,7 @@ cmLocalVisualStudio6Generator { std::string config = this->GetConfigName(*i); std::string script = - this->ConstructScript(command.GetCommandLines(), - command.GetWorkingDirectory(), - config.c_str(), - command.GetEscapeOldStyle(), - command.GetEscapeAllowMakeVars(), - "\\\n\t"); + this->ConstructScript(command, config.c_str(), "\\\n\t"); if (i == this->Configurations.begin()) { diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 9a87cc4..b22c429 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -546,12 +546,7 @@ public: { this->Stream << this->LG->EscapeForXML("\n"); } - std::string script = - this->LG->ConstructScript(cc.GetCommandLines(), - cc.GetWorkingDirectory(), - this->Config, - cc.GetEscapeOldStyle(), - cc.GetEscapeAllowMakeVars()); + std::string script = this->LG->ConstructScript(cc, this->Config); this->Stream << this->LG->EscapeForXML(script.c_str()); } private: @@ -1591,12 +1586,7 @@ WriteCustomRule(std::ostream& fout, << this->EscapeForXML(fc.CompileFlags.c_str()) << "\"/>\n"; } - std::string script = - this->ConstructScript(command.GetCommandLines(), - command.GetWorkingDirectory(), - i->c_str(), - command.GetEscapeOldStyle(), - command.GetEscapeAllowMakeVars()); + std::string script = this->ConstructScript(command, i->c_str()); fout << "\t\t\t\t\tend(); ++i) { std::string script = - cmVS10EscapeXML( - lg->ConstructScript(command.GetCommandLines(), - command.GetWorkingDirectory(), - i->c_str(), - command.GetEscapeOldStyle(), - command.GetEscapeAllowMakeVars()) - ); + cmVS10EscapeXML(lg->ConstructScript(command, i->c_str())); this->WritePlatformConfigTag("Message",i->c_str(), 3); (*this->BuildFileStream ) << cmVS10EscapeXML(comment) << "\n"; this->WritePlatformConfigTag("Command", i->c_str(), 3); @@ -1460,13 +1454,7 @@ void cmVisualStudio10TargetGenerator::WriteEvent( script += pre; pre = "\n"; script += - cmVS10EscapeXML( - lg->ConstructScript(command.GetCommandLines(), - command.GetWorkingDirectory(), - configName.c_str(), - command.GetEscapeOldStyle(), - command.GetEscapeAllowMakeVars()) - ); + cmVS10EscapeXML(lg->ConstructScript(command, configName.c_str())); } comment = cmVS10EscapeComment(comment); this->WriteString("",3); -- cgit v0.12 From 542b517449e8c7101ac6fbd316749bd461b48588 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 7 Dec 2010 16:23:38 -0500 Subject: Factor out common custom command generator The Makefile, VS, and Xcode generators previously duplicated some custom command line generation code. Factor this out into a separate class cmCustomCommandGenerator shared by all generators. --- Source/CMakeLists.txt | 2 ++ Source/cmCustomCommandGenerator.cxx | 58 ++++++++++++++++++++++++++++++++ Source/cmCustomCommandGenerator.h | 37 ++++++++++++++++++++ Source/cmGlobalXCodeGenerator.cxx | 31 ++++------------- Source/cmLocalUnixMakefileGenerator3.cxx | 27 ++++----------- Source/cmLocalVisualStudioGenerator.cxx | 39 +++++---------------- bootstrap | 1 + 7 files changed, 119 insertions(+), 76 deletions(-) create mode 100644 Source/cmCustomCommandGenerator.cxx create mode 100644 Source/cmCustomCommandGenerator.h diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 718e52e..49412d8 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -131,6 +131,8 @@ SET(SRCS cmComputeTargetDepends.cxx cmCustomCommand.cxx cmCustomCommand.h + cmCustomCommandGenerator.cxx + cmCustomCommandGenerator.h cmDefinitions.cxx cmDefinitions.h cmDepends.cxx diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx new file mode 100644 index 0000000..890ac9c --- /dev/null +++ b/Source/cmCustomCommandGenerator.cxx @@ -0,0 +1,58 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2010 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. +============================================================================*/ +#include "cmCustomCommandGenerator.h" + +#include "cmMakefile.h" +#include "cmCustomCommand.h" +#include "cmLocalGenerator.h" + +//---------------------------------------------------------------------------- +cmCustomCommandGenerator::cmCustomCommandGenerator( + cmCustomCommand const& cc, const char* config, cmMakefile* mf): + CC(cc), Config(config), Makefile(mf), LG(mf->GetLocalGenerator()), + OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()) +{ +} + +//---------------------------------------------------------------------------- +unsigned int cmCustomCommandGenerator::GetNumberOfCommands() const +{ + return static_cast(this->CC.GetCommandLines().size()); +} + +//---------------------------------------------------------------------------- +std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const +{ + std::string const& argv0 = this->CC.GetCommandLines()[c][0]; + return this->LG->GetRealLocation(argv0.c_str(), this->Config); +} + +//---------------------------------------------------------------------------- +void +cmCustomCommandGenerator +::AppendArguments(unsigned int c, std::string& cmd) const +{ + cmCustomCommandLine const& commandLine = this->CC.GetCommandLines()[c]; + for(unsigned int j=1;j < commandLine.size(); ++j) + { + std::string const& arg = commandLine[j]; + cmd += " "; + if(this->OldStyle) + { + cmd += this->LG->EscapeForShellOldStyle(arg.c_str()); + } + else + { + cmd += this->LG->EscapeForShell(arg.c_str(), this->MakeVars); + } + } +} diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h new file mode 100644 index 0000000..5417ec5 --- /dev/null +++ b/Source/cmCustomCommandGenerator.h @@ -0,0 +1,37 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2010 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 cmCustomCommandGenerator_h +#define cmCustomCommandGenerator_h + +#include "cmStandardIncludes.h" + +class cmCustomCommand; +class cmMakefile; +class cmLocalGenerator; + +class cmCustomCommandGenerator +{ + cmCustomCommand const& CC; + const char* Config; + cmMakefile* Makefile; + cmLocalGenerator* LG; + bool OldStyle; + bool MakeVars; +public: + cmCustomCommandGenerator(cmCustomCommand const& cc, const char* config, + cmMakefile* mf); + unsigned int GetNumberOfCommands() const; + std::string GetCommand(unsigned int c) const; + void AppendArguments(unsigned int c, std::string& cmd) const; +}; + +#endif diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 29c2d06..e13acda 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -18,6 +18,7 @@ #include "cmGeneratedFileStream.h" #include "cmComputeLinkInformation.h" #include "cmSourceFile.h" +#include "cmCustomCommandGenerator.h" #include @@ -1314,8 +1315,7 @@ void cmGlobalXCodeGenerator cmCustomCommand const& cc = *i; if(!cc.GetCommandLines().empty()) { - bool escapeOldStyle = cc.GetEscapeOldStyle(); - bool escapeAllowMakeVars = cc.GetEscapeAllowMakeVars(); + cmCustomCommandGenerator ccg(cc, configName, this->CurrentMakefile); makefileStream << "\n"; const std::vector& outputs = cc.GetOutputs(); if(!outputs.empty()) @@ -1348,20 +1348,15 @@ void cmGlobalXCodeGenerator { std::string echo_cmd = "echo "; echo_cmd += (this->CurrentLocalGenerator-> - EscapeForShell(comment, escapeAllowMakeVars)); + EscapeForShell(comment, cc.GetEscapeAllowMakeVars())); makefileStream << "\t" << echo_cmd.c_str() << "\n"; } // Add each command line to the set of commands. - for(cmCustomCommandLines::const_iterator cl = - cc.GetCommandLines().begin(); - cl != cc.GetCommandLines().end(); ++cl) + for(unsigned int c = 0; c < ccg.GetNumberOfCommands(); ++c) { // Build the command line in a single string. - const cmCustomCommandLine& commandLine = *cl; - std::string cmd2 = this->CurrentLocalGenerator - ->GetRealLocation(commandLine[0].c_str(), configName); - + std::string cmd2 = ccg.GetCommand(c); cmSystemTools::ReplaceString(cmd2, "/./", "/"); cmd2 = this->ConvertToRelativeForMake(cmd2.c_str()); std::string cmd; @@ -1372,21 +1367,7 @@ void cmGlobalXCodeGenerator cmd += " && "; } cmd += cmd2; - for(unsigned int j=1; j < commandLine.size(); ++j) - { - cmd += " "; - if(escapeOldStyle) - { - cmd += (this->CurrentLocalGenerator - ->EscapeForShellOldStyle(commandLine[j].c_str())); - } - else - { - cmd += (this->CurrentLocalGenerator-> - EscapeForShell(commandLine[j].c_str(), - escapeAllowMakeVars)); - } - } + ccg.AppendArguments(c, cmd); makefileStream << "\t" << cmd.c_str() << "\n"; } } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 15ae139..ff48009 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -19,6 +19,7 @@ #include "cmake.h" #include "cmVersion.h" #include "cmFileTimeComparison.h" +#include "cmCustomCommandGenerator.h" // Include dependency scanners for supported languages. Only the // C/C++ scanner is needed for bootstrapping CMake. @@ -961,18 +962,15 @@ cmLocalUnixMakefileGenerator3 { *content << dir; } - bool escapeOldStyle = cc.GetEscapeOldStyle(); - bool escapeAllowMakeVars = cc.GetEscapeAllowMakeVars(); + cmCustomCommandGenerator ccg(cc, this->ConfigurationName.c_str(), + this->Makefile); // Add each command line to the set of commands. std::vector commands1; - for(cmCustomCommandLines::const_iterator cl = cc.GetCommandLines().begin(); - cl != cc.GetCommandLines().end(); ++cl) + for(unsigned int c = 0; c < ccg.GetNumberOfCommands(); ++c) { // Build the command line in a single string. - const cmCustomCommandLine& commandLine = *cl; - std::string cmd = GetRealLocation(commandLine[0].c_str(), - this->ConfigurationName.c_str()); + std::string cmd = ccg.GetCommand(c); if (cmd.size()) { // Use "call " before any invocations of .bat or .cmd files @@ -1025,19 +1023,8 @@ cmLocalUnixMakefileGenerator3 std::string launcher = this->MakeLauncher(cc, target, workingDir? NONE : START_OUTPUT); cmd = launcher + this->Convert(cmd.c_str(),NONE,SHELL); - for(unsigned int j=1; j < commandLine.size(); ++j) - { - cmd += " "; - if(escapeOldStyle) - { - cmd += this->EscapeForShellOldStyle(commandLine[j].c_str()); - } - else - { - cmd += this->EscapeForShell(commandLine[j].c_str(), - escapeAllowMakeVars); - } - } + + ccg.AppendArguments(c, cmd); if(content) { // Rule content does not include the launcher. diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 79dd1df..6d43dc4 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -14,6 +14,7 @@ #include "cmMakefile.h" #include "cmSourceFile.h" #include "cmSystemTools.h" +#include "cmCustomCommandGenerator.h" #include "windows.h" //---------------------------------------------------------------------------- @@ -157,8 +158,8 @@ cmLocalVisualStudioGenerator { const cmCustomCommandLines& commandLines = cc.GetCommandLines(); const char* workingDirectory = cc.GetWorkingDirectory(); - bool escapeOldStyle = cc.GetEscapeOldStyle(); - bool escapeAllowMakeVars = cc.GetEscapeAllowMakeVars(); + cmCustomCommandGenerator ccg(cc, configName, this->Makefile); + RelativeRoot relativeRoot = workingDirectory? NONE : START_OUTPUT; // Avoid leading or trailing newlines. const char* newline = ""; @@ -198,40 +199,16 @@ cmLocalVisualStudioGenerator } } // Write each command on a single line. - for(cmCustomCommandLines::const_iterator cl = commandLines.begin(); - cl != commandLines.end(); ++cl) + for(unsigned int c = 0; c < ccg.GetNumberOfCommands(); ++c) { // Start a new line. script += newline; newline = newline_text; - // Start with the command name. - const cmCustomCommandLine& commandLine = *cl; - std::string commandName = this->GetRealLocation(commandLine[0].c_str(), - configName); - if(!workingDirectory) - { - script += this->Convert(commandName.c_str(),START_OUTPUT,SHELL); - } - else - { - script += this->Convert(commandName.c_str(),NONE,SHELL); - } - - // Add the arguments. - for(unsigned int j=1;j < commandLine.size(); ++j) - { - script += " "; - if(escapeOldStyle) - { - script += this->EscapeForShellOldStyle(commandLine[j].c_str()); - } - else - { - script += this->EscapeForShell(commandLine[j].c_str(), - escapeAllowMakeVars); - } - } + // Add this command line. + std::string cmd = ccg.GetCommand(c); + script += this->Convert(cmd.c_str(), relativeRoot, SHELL); + ccg.AppendArguments(c, script); // After each custom command, check for an error result. // If there was an error, jump to the VCReportError label, diff --git a/bootstrap b/bootstrap index 0da868d..b4e19ef 100755 --- a/bootstrap +++ b/bootstrap @@ -215,6 +215,7 @@ CMAKE_CXX_SOURCES="\ cmTarget \ cmTest \ cmCustomCommand \ + cmCustomCommandGenerator \ cmDocumentVariables \ cmCacheManager \ cmListFileCache \ -- cgit v0.12 From 1a29ccaf9a2604ad405035a4a6f51413f74a1145 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 7 Dec 2010 16:28:56 -0500 Subject: Remove cmLocalGenerator::GetRealLocation The cmCustomCommandGenerator::GetCommand method completely replaces the purpose of this method. Re-implement GetRealLocation inline at the only remaining call site and remove it. --- Source/cmCustomCommandGenerator.cxx | 8 +++++++- Source/cmLocalGenerator.cxx | 18 ------------------ Source/cmLocalGenerator.h | 5 ----- 3 files changed, 7 insertions(+), 24 deletions(-) diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index 890ac9c..2a3b553 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -33,7 +33,13 @@ unsigned int cmCustomCommandGenerator::GetNumberOfCommands() const std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const { std::string const& argv0 = this->CC.GetCommandLines()[c][0]; - return this->LG->GetRealLocation(argv0.c_str(), this->Config); + cmTarget* target = this->Makefile->FindTargetToUse(argv0.c_str()); + if(target && target->GetType() == cmTarget::EXECUTABLE && + (target->IsImported() || !this->Makefile->IsOn("CMAKE_CROSSCOMPILING"))) + { + return target->GetLocation(this->Config); + } + return argv0; } //---------------------------------------------------------------------------- diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index b7d694c..d3cbc1f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1913,24 +1913,6 @@ bool cmLocalGenerator::GetRealDependency(const char* inName, } //---------------------------------------------------------------------------- -std::string cmLocalGenerator::GetRealLocation(const char* inName, - const char* config) -{ - std::string outName=inName; - // Look for a CMake target with the given name, which is an executable - // and which can be run - cmTarget* target = this->Makefile->FindTargetToUse(inName); - if ((target != 0) - && (target->GetType() == cmTarget::EXECUTABLE) - && ((this->Makefile->IsOn("CMAKE_CROSSCOMPILING") == false) - || (target->IsImported() == true))) - { - outName = target->GetLocation( config ); - } - return outName; -} - -//---------------------------------------------------------------------------- void cmLocalGenerator::AddSharedFlags(std::string& flags, const char* lang, bool shared) diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 870ce36..35aab99 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -168,11 +168,6 @@ public: bool GetRealDependency(const char* name, const char* config, std::string& dep); - /** Translate a command as given in CMake code to the location of the - executable if the command is the name of a CMake executable target. - If that's not the case, just return the original name. */ - std::string GetRealLocation(const char* inName, const char* config); - ///! for existing files convert to output path and short path if spaces std::string ConvertToOutputForExisting(const char* remote, RelativeRoot local = START_OUTPUT); -- cgit v0.12 From 937e3693d7cb71a83851ac7c74dd45028363aad0 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 8 Dec 2010 17:41:37 -0500 Subject: Use FPHSA in FindOpenGL This gets FindOpenGL to obey the QUIET and REQUIRED options correctly. --- Modules/FindOpenGL.cmake | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake index 21aafa9..3618963 100644 --- a/Modules/FindOpenGL.cmake +++ b/Modules/FindOpenGL.cmake @@ -123,7 +123,6 @@ ELSE (WIN32) ENDIF(APPLE) ENDIF (WIN32) -SET( OPENGL_FOUND "NO" ) IF(OPENGL_gl_LIBRARY) IF(OPENGL_xmesa_INCLUDE_DIR) @@ -140,10 +139,7 @@ IF(OPENGL_gl_LIBRARY) SET( OPENGL_GLU_FOUND "NO" ) ENDIF(OPENGL_glu_LIBRARY) - SET( OPENGL_FOUND "YES" ) - # This deprecated setting is for backward compatibility with CMake1.4 - SET (OPENGL_LIBRARY ${OPENGL_LIBRARIES}) ENDIF(OPENGL_gl_LIBRARY) @@ -151,6 +147,11 @@ ENDIF(OPENGL_gl_LIBRARY) # This deprecated setting is for backward compatibility with CMake1.4 SET(OPENGL_INCLUDE_PATH ${OPENGL_INCLUDE_DIR}) +# handle the QUIETLY and REQUIRED arguments and set OPENGL_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenGL DEFAULT_MSG OPENGL_gl_LIBRARY) + MARK_AS_ADVANCED( OPENGL_INCLUDE_DIR OPENGL_xmesa_INCLUDE_DIR -- cgit v0.12 From 88b7f4252c86f655c026d0906e7a8396cf75b70c Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Thu, 2 Dec 2010 22:56:26 +0100 Subject: CPack new tests for component install --- Tests/CMakeLists.txt | 27 +++++ Tests/CPackComponentsForAll/CMakeLists.txt | 120 +++++++++++++++++++++ .../MyLibCPackConfig.cmake.in | 7 ++ .../RunCPackVerifyResult.cmake | 46 ++++++++ Tests/CPackComponentsForAll/mylib.cpp | 7 ++ Tests/CPackComponentsForAll/mylib.h | 1 + Tests/CPackComponentsForAll/mylibapp.cpp | 6 ++ 7 files changed, 214 insertions(+) create mode 100644 Tests/CPackComponentsForAll/CMakeLists.txt create mode 100644 Tests/CPackComponentsForAll/MyLibCPackConfig.cmake.in create mode 100644 Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake create mode 100644 Tests/CPackComponentsForAll/mylib.cpp create mode 100644 Tests/CPackComponentsForAll/mylib.h create mode 100644 Tests/CPackComponentsForAll/mylibapp.cpp diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 04f0774..3538e44 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -486,6 +486,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ # set(CTEST_RUN_CPackComponents ${CTEST_TEST_CPACK}) set(CTEST_package_X11_TEST ${CTEST_TEST_CPACK}) + set(CTEST_RUN_CPackComponentsForAll ${CTEST_TEST_CPACK}) find_program(NSIS_MAKENSIS_EXECUTABLE NAMES makensis PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS] @@ -534,6 +535,32 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponents") ENDIF(CTEST_RUN_CPackComponents) + IF(CTEST_RUN_CPackComponentsForAll) + set(CPackComponentsForAll_EXTRA_OPTIONS) + + set(CPackRun_CPackGen "-DCPackGen=ZIP") + set(CPackRun_CPackCommand "-DCPackCommand=${CMAKE_CPACK_COMMAND}") + + ADD_TEST(CPackComponentsForAll-ZIP-NoComponent ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/CPackComponentsForAll" + "${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/buildZIP-NoComponent" + --build-generator ${CMAKE_TEST_GENERATOR} + --build-project CPackComponentsForAll + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --build-options + -DCPACK_BINARY_ZIP:BOOL=ON + ${CPackComponentsForAll_EXTRA_OPTIONS} + --graphviz=CPackComponentsForAll.dot + --test-command ${CMAKE_CMAKE_COMMAND} + "-DCPackComponentsForAll_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/buildZIP-NoComponent" + "${CPackRun_CPackCommand}" + "${CPackRun_CPackGen}" + -P "${CMake_SOURCE_DIR}/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake") + + LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponentsForAll") + ENDIF(CTEST_RUN_CPackComponentsForAll) + # By default, turn this test off (because it takes a long time...) # if(NOT DEFINED CTEST_RUN_CPackTestAllGenerators) diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt new file mode 100644 index 0000000..4153ac9 --- /dev/null +++ b/Tests/CPackComponentsForAll/CMakeLists.txt @@ -0,0 +1,120 @@ +# CPack Example: User-selectable Installation Components +# +# In this example, we have a simple library (mylib) with an example +# application (mylibapp). We create a binary installer (a CPack Generator) +# which supports CPack components. +# +# Depending on the CPack generator and on some CPACK_xxx var values +# the generator may produce a single (NSIS, PackageMaker) +# or several package files (Archive Generators, RPM, DEB) +cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR) +project(CPackComponentsForAll) + +# Create the mylib library +add_library(mylib mylib.cpp) + +# Create the mylibapp application +add_executable(mylibapp mylibapp.cpp) +target_link_libraries(mylibapp mylib) + +# Duplicate of mylibapp application +# which won't be put in any component (?mistake?) +add_executable(mylibapp2 mylibapp.cpp) +target_link_libraries(mylibapp2 mylib) + +# Create installation targets. Note that we put each kind of file +# into a different component via COMPONENT. These components will +# be used to create the installation components. +install(TARGETS mylib + ARCHIVE + DESTINATION lib + COMPONENT libraries) +install(TARGETS mylibapp + RUNTIME + DESTINATION bin + COMPONENT applications) + +# This application does not belong to any component +# thus (as of cmake 2.8.2) it will be left "uninstalled" +# by a component-aware installer unless a +# CPACK_MONOLITHIC_INSTALL=1 is set (at cmake time). +install(TARGETS mylibapp2 + RUNTIME + DESTINATION bin) + +install(FILES mylib.h + DESTINATION include + COMPONENT headers) + +# CPack boilerplate for this project +set(CPACK_PACKAGE_NAME "MyLib") +set(CPACK_PACKAGE_CONTACT "None") +set(CPACK_PACKAGE_VENDOR "CMake.org") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MyLib - CPack Component Installation Example") +set(CPACK_PACKAGE_VERSION "1.0.2") +set(CPACK_PACKAGE_VERSION_MAJOR "1") +set(CPACK_PACKAGE_VERSION_MINOR "0") +set(CPACK_PACKAGE_VERSION_PATCH "2") +set(CPACK_PACKAGE_INSTALL_DIRECTORY "CPack Component Example") + +# Tell CPack all of the components to install. The "ALL" +# refers to the fact that this is the set of components that +# will be included when CPack is instructed to put everything +# into the binary installer (the default behavior). +set(CPACK_COMPONENTS_ALL applications libraries headers Unspecified) + +# Set the displayed names for each of the components to install. +# These will be displayed in the list of components inside the installer. +set(CPACK_COMPONENT_APPLICATIONS_DISPLAY_NAME "MyLib Application") +set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries") +set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ Headers") + +# Provide descriptions for each of the components to install. +# When the user hovers the mouse over the name of a component, +# the description will be shown in the "Description" box in the +# installer. If no descriptions are provided, the "Description" +# box will be removed. +set(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION + "An extremely useful application that makes use of MyLib") +set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION + "Static libraries used to build programs with MyLib") +set(CPACK_COMPONENT_HEADERS_DESCRIPTION + "C/C++ header files for use with MyLib") + +# Put the components into two different groups: "Runtime" and "Development" +set(CPACK_COMPONENT_APPLICATIONS_GROUP "Runtime") +set(CPACK_COMPONENT_LIBRARIES_GROUP "Development") +set(CPACK_COMPONENT_HEADERS_GROUP "Development") + +# Expand the "Development" group by default, since we have so few components. +# Also, provide this group with a description. +set(CPACK_COMPONENT_GROUP_DEVELOPMENT_EXPANDED ON) +set(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION + "All of the tools you'll ever need to develop software") + +# It doesn't make sense to install the headers without the libraries +# (because you could never use the headers!), so make the headers component +# depend on the libraries component. +set(CPACK_COMPONENT_HEADERS_DEPENDS libraries) + +# Create two installation types with pre-selected components. +# The "Developer" installation has just the library and headers, +# while the "Full" installation has everything. +set(CPACK_ALL_INSTALL_TYPES Full Developer) +set(CPACK_INSTALL_TYPE_FULL_DISPLAY_NAME "Everything") +set(CPACK_COMPONENT_LIBRARIES_INSTALL_TYPES Developer Full) +set(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full) +set(CPACK_COMPONENT_APPLICATIONS_INSTALL_TYPES Full) + +# We may use the CPack specific config file in order +# to tailor CPack behavio on a CPack generator specific way +# (Behavior would be different for RPM or TGZ or DEB ...) +if (USE_CPACK_PROJECT_CONFIG) + # Setup project specific CPack-time CPack Config file. + configure_file(${MyLib_SOURCE_DIR}/MyLibCPackConfig.cmake.in + ${MyLib_BINARY_DIR}/MyLibCPackConfig.cmake + @ONLY) + set(CPACK_PROJECT_CONFIG_FILE ${MyLib_BINARY_DIR}/MyLibCPackConfig.cmake) +endif (USE_CPACK_PROJECT_CONFIG) +# Include CPack to introduce the appropriate targets +include(CPack) \ No newline at end of file diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig.cmake.in new file mode 100644 index 0000000..7ffafae --- /dev/null +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig.cmake.in @@ -0,0 +1,7 @@ +if(CPACK_GENERATOR MATCHES "ZIP") +# set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1) +endif(CPACK_GENERATOR MATCHES "ZIP") + +if(CPACK_GENERATOR MATCHES "TGZ") + set(CPACK_MONOLITHIC_INSTALL 1) +endif(CPACK_GENERATOR MATCHES "TGZ") diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake new file mode 100644 index 0000000..6b471ca --- /dev/null +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -0,0 +1,46 @@ +message(STATUS "=============================================================================") +message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") +message(STATUS "") + +if(NOT CPackComponentsForAll_BINARY_DIR) + message(FATAL_ERROR "CPackComponentsForAll_BINARY_DIR not set") +endif(NOT CPackComponentsForAll_BINARY_DIR) + +if(NOT CPackGen) + message(FATAL_ERROR "CPackGen not set") +endif(NOT CPackGen) + +if(NOT CPackCommand) + message(FATAL_ERROR "CPackCommand not set") +endif(NOT CPackCommand) +set(expected_file_mask "") + +execute_process(COMMAND ${CPackCommand} -G ${CPackGen} + RESULT_VARIABLE result + OUTPUT_VARIABLE stdout + ERROR_VARIABLE stderr + WORKING_DIRECTORY ${CPackComponentsForAll_BINARY_DIR}) + +if(CPackGen MATCHES "ZIP") + set(expected_file_mask "${CPackComponentsForAll_BINARY_DIR}/MyLib-*.zip") + set(expected_count 2) +endif(CPackGen MATCHES "ZIP") + + +if(expected_file_mask) + file(GLOB expected_file "${expected_file_mask}") + + message(STATUS "expected_count='${expected_count}'") + message(STATUS "expected_file='${expected_file}'") + message(STATUS "expected_file_mask='${expected_file_mask}'") + + if(NOT expected_file) + message(FATAL_ERROR "error: expected_file does not exist: CPackComponentsForAll test fails.") + endif(NOT expected_file) + + list(LENGTH expected_file actual_count) + message(STATUS "actual_count='${actual_count}'") + if(NOT actual_count EQUAL expected_count) + message(FATAL_ERROR "error: expected_count does not match actual_count: CPackComponents test fails.") + endif(NOT actual_count EQUAL expected_count) +endif(expected_file_mask) diff --git a/Tests/CPackComponentsForAll/mylib.cpp b/Tests/CPackComponentsForAll/mylib.cpp new file mode 100644 index 0000000..8ddac19 --- /dev/null +++ b/Tests/CPackComponentsForAll/mylib.cpp @@ -0,0 +1,7 @@ +#include "mylib.h" +#include "stdio.h" + +void mylib_function() +{ + printf("This is mylib"); +} diff --git a/Tests/CPackComponentsForAll/mylib.h b/Tests/CPackComponentsForAll/mylib.h new file mode 100644 index 0000000..5d0a822 --- /dev/null +++ b/Tests/CPackComponentsForAll/mylib.h @@ -0,0 +1 @@ +void mylib_function(); diff --git a/Tests/CPackComponentsForAll/mylibapp.cpp b/Tests/CPackComponentsForAll/mylibapp.cpp new file mode 100644 index 0000000..a438ac7 --- /dev/null +++ b/Tests/CPackComponentsForAll/mylibapp.cpp @@ -0,0 +1,6 @@ +#include "mylib.h" + +int main() +{ + mylib_function(); +} -- cgit v0.12 From dd2a5aa69fa1ba9fc73740355971fc28bfb504c0 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 11 Dec 2010 11:59:02 +0100 Subject: CPack Default component test for ZIP should be OK --- Tests/CMakeLists.txt | 4 +++- Tests/CPackComponentsForAll/CMakeLists.txt | 2 +- .../CPackComponentsForAll/RunCPackVerifyResult.cmake | 19 +++++++++++++++---- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 3538e44..2e88bcf 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -540,8 +540,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ set(CPackRun_CPackGen "-DCPackGen=ZIP") set(CPackRun_CPackCommand "-DCPackCommand=${CMAKE_CPACK_COMMAND}") + set(CPackRun_CPackComponentWay "-DCPackComponentWay=default") - ADD_TEST(CPackComponentsForAll-ZIP-NoComponent ${CMAKE_CTEST_COMMAND} + ADD_TEST(CPackComponentsForAll-ZIP-default ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/CPackComponentsForAll" "${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/buildZIP-NoComponent" @@ -556,6 +557,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "-DCPackComponentsForAll_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/buildZIP-NoComponent" "${CPackRun_CPackCommand}" "${CPackRun_CPackGen}" + "${CPackRun_CPackComponentWay}" -P "${CMake_SOURCE_DIR}/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake") LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponentsForAll") diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt index 4153ac9..971b2dc 100644 --- a/Tests/CPackComponentsForAll/CMakeLists.txt +++ b/Tests/CPackComponentsForAll/CMakeLists.txt @@ -7,7 +7,7 @@ # Depending on the CPack generator and on some CPACK_xxx var values # the generator may produce a single (NSIS, PackageMaker) # or several package files (Archive Generators, RPM, DEB) -cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR) +cmake_minimum_required(VERSION 2.8.3.20101130 FATAL_ERROR) project(CPackComponentsForAll) # Create the mylib library diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index 6b471ca..b24ae5a 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -13,7 +13,14 @@ endif(NOT CPackGen) if(NOT CPackCommand) message(FATAL_ERROR "CPackCommand not set") endif(NOT CPackCommand) + +if(NOT CPackComponentWay) + message(FATAL_ERROR "CPackComponentWay not set") +endif(NOT CPackComponentWay) + set(expected_file_mask "") +# The usual default behavior is to expect a single file +set(expected_count 1) execute_process(COMMAND ${CPackCommand} -G ${CPackGen} RESULT_VARIABLE result @@ -23,10 +30,14 @@ execute_process(COMMAND ${CPackCommand} -G ${CPackGen} if(CPackGen MATCHES "ZIP") set(expected_file_mask "${CPackComponentsForAll_BINARY_DIR}/MyLib-*.zip") - set(expected_count 2) + if (${CPackComponentWay} STREQUAL "default") + set(expected_count 1) + endif(${CPackComponentWay} STREQUAL "default") endif(CPackGen MATCHES "ZIP") - +# Now verify if the number of expected file is OK +# - using expected_file_mask and +# - expected_count if(expected_file_mask) file(GLOB expected_file "${expected_file_mask}") @@ -35,12 +46,12 @@ if(expected_file_mask) message(STATUS "expected_file_mask='${expected_file_mask}'") if(NOT expected_file) - message(FATAL_ERROR "error: expected_file does not exist: CPackComponentsForAll test fails.") + message(FATAL_ERROR "error: expected_file=${expected_file} does not exist: CPackComponentsForAll test fails.") endif(NOT expected_file) list(LENGTH expected_file actual_count) message(STATUS "actual_count='${actual_count}'") if(NOT actual_count EQUAL expected_count) - message(FATAL_ERROR "error: expected_count does not match actual_count: CPackComponents test fails.") + message(FATAL_ERROR "error: expected_count=${expected_count} does not match actual_count=${actual_count}: CPackComponents test fails.") endif(NOT actual_count EQUAL expected_count) endif(expected_file_mask) -- cgit v0.12 From 58bd4f21855f1ee4889ba7d933bd84fb24da672b Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sun, 12 Dec 2010 12:19:50 +0100 Subject: CPackTest spit out more output in case of failure --- .../CPackComponentsForAll/RunCPackVerifyResult.cmake | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index b24ae5a..e519893 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -20,14 +20,23 @@ endif(NOT CPackComponentWay) set(expected_file_mask "") # The usual default behavior is to expect a single file +# Then some specific generators (Archive, RPM, ...) +# May produce several numbers of files depending on +# CPACK_COMPONENT_xxx values set(expected_count 1) execute_process(COMMAND ${CPackCommand} -G ${CPackGen} - RESULT_VARIABLE result - OUTPUT_VARIABLE stdout - ERROR_VARIABLE stderr + RESULT_VARIABLE CPack_result + OUTPUT_VARIABLE CPack_output + ERROR_VARIABLE CPack_error WORKING_DIRECTORY ${CPackComponentsForAll_BINARY_DIR}) +if (CPack_result) + message(SEND_ERROR "CPack_output=${CPack_output}") + message(SEND_ERROR "CPack_error=${CPack_error}") + message(FATAL_ERROR "error: CPack execution went wrong!") +endif(CPack_result) + if(CPackGen MATCHES "ZIP") set(expected_file_mask "${CPackComponentsForAll_BINARY_DIR}/MyLib-*.zip") if (${CPackComponentWay} STREQUAL "default") @@ -46,12 +55,16 @@ if(expected_file_mask) message(STATUS "expected_file_mask='${expected_file_mask}'") if(NOT expected_file) + message(SEND_ERROR "CPack_output=${CPack_output}") + message(SEND_ERROR "CPack_error=${CPack_error}") message(FATAL_ERROR "error: expected_file=${expected_file} does not exist: CPackComponentsForAll test fails.") endif(NOT expected_file) list(LENGTH expected_file actual_count) message(STATUS "actual_count='${actual_count}'") if(NOT actual_count EQUAL expected_count) + message(SEND_ERROR "CPack_output=${CPack_output}") + message(SEND_ERROR "CPack_error=${CPack_error}") message(FATAL_ERROR "error: expected_count=${expected_count} does not match actual_count=${actual_count}: CPackComponents test fails.") endif(NOT actual_count EQUAL expected_count) endif(expected_file_mask) -- cgit v0.12 From 08f829b50971d7d848b8c4398f9c559fcf338d8e Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sun, 12 Dec 2010 22:35:18 +0100 Subject: Arrange output in a better way --- Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index e519893..ee6b227 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -32,9 +32,9 @@ execute_process(COMMAND ${CPackCommand} -G ${CPackGen} WORKING_DIRECTORY ${CPackComponentsForAll_BINARY_DIR}) if (CPack_result) - message(SEND_ERROR "CPack_output=${CPack_output}") - message(SEND_ERROR "CPack_error=${CPack_error}") - message(FATAL_ERROR "error: CPack execution went wrong!") + message(FATAL_ERROR "error: CPack execution went wrong!, CPack_output=${CPack_output}, CPack_error=${CPack_error}") +else (CPack_result) + message(STATUS "CPack_output=${CPack_output}") endif(CPack_result) if(CPackGen MATCHES "ZIP") @@ -55,16 +55,12 @@ if(expected_file_mask) message(STATUS "expected_file_mask='${expected_file_mask}'") if(NOT expected_file) - message(SEND_ERROR "CPack_output=${CPack_output}") - message(SEND_ERROR "CPack_error=${CPack_error}") - message(FATAL_ERROR "error: expected_file=${expected_file} does not exist: CPackComponentsForAll test fails.") + message(FATAL_ERROR "error: expected_file=${expected_file} does not exist: CPackComponentsForAll test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error}") endif(NOT expected_file) list(LENGTH expected_file actual_count) message(STATUS "actual_count='${actual_count}'") if(NOT actual_count EQUAL expected_count) - message(SEND_ERROR "CPack_output=${CPack_output}") - message(SEND_ERROR "CPack_error=${CPack_error}") - message(FATAL_ERROR "error: expected_count=${expected_count} does not match actual_count=${actual_count}: CPackComponents test fails.") + message(FATAL_ERROR "error: expected_count=${expected_count} does not match actual_count=${actual_count}: CPackComponents test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error})") endif(NOT actual_count EQUAL expected_count) endif(expected_file_mask) -- cgit v0.12 From cdf92c952a40650a5bc37e93489e4b3130841d82 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sun, 12 Dec 2010 22:45:48 +0100 Subject: Precise the project config type when invoking cpack --- Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index ee6b227..b0cacb8 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -25,7 +25,7 @@ set(expected_file_mask "") # CPACK_COMPONENT_xxx values set(expected_count 1) -execute_process(COMMAND ${CPackCommand} -G ${CPackGen} +execute_process(COMMAND ${CPackCommand} -G ${CPackGen} -C Release RESULT_VARIABLE CPack_result OUTPUT_VARIABLE CPack_output ERROR_VARIABLE CPack_error -- cgit v0.12 From 86979e49a16b0fc2976329480d236e62471f331a Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Tue, 14 Dec 2010 13:42:21 -0500 Subject: Change cpack run and verify script to work with multi-config generators. Use the location of the running cmake to find cpack, and use the CMAKE_CONFIG_TYPE environtment variable as a type for cpack. --- Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index b0cacb8..11f72ec 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -9,7 +9,9 @@ endif(NOT CPackComponentsForAll_BINARY_DIR) if(NOT CPackGen) message(FATAL_ERROR "CPackGen not set") endif(NOT CPackGen) - +get_filename_component(CPACK_LOCATION ${CMAKE_COMMAND} PATH) +set(CPackCommand "${CPACK_LOCATION}/cpack") +message("cpack = ${CPackCommand}") if(NOT CPackCommand) message(FATAL_ERROR "CPackCommand not set") endif(NOT CPackCommand) @@ -24,8 +26,13 @@ set(expected_file_mask "") # May produce several numbers of files depending on # CPACK_COMPONENT_xxx values set(expected_count 1) - -execute_process(COMMAND ${CPackCommand} -G ${CPackGen} -C Release +set(config_type $ENV{CMAKE_CONFIG_TYPE}) +set(config_args ) +if(config_type) + set(config_args -C ${config_type}) +endif() +message(" ${config_args}") +execute_process(COMMAND ${CPackCommand} -G ${CPackGen} ${config_args} RESULT_VARIABLE CPack_result OUTPUT_VARIABLE CPack_output ERROR_VARIABLE CPack_error -- cgit v0.12 From bfb7288f8103298bf4cabb60a13208f95595a7db Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 6 Dec 2010 14:33:59 -0500 Subject: Record backtrace in cmCustomCommand This will be used to report custom command errors to the user with a backtrace pointing at the add_custom_command or add_custom_target call. --- Source/cmCustomCommand.cxx | 27 ++++++++++++++++++++++++--- Source/cmCustomCommand.h | 11 ++++++++++- Source/cmGlobalGenerator.cxx | 2 +- Source/cmLocalVisualStudio6Generator.cxx | 2 +- Source/cmLocalVisualStudioGenerator.cxx | 2 +- Source/cmMakefile.cxx | 5 +++-- 6 files changed, 40 insertions(+), 9 deletions(-) diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx index 5db88fa..bd860ee 100644 --- a/Source/cmCustomCommand.cxx +++ b/Source/cmCustomCommand.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmCustomCommand.h" +#include "cmMakefile.h" + //---------------------------------------------------------------------------- cmCustomCommand::cmCustomCommand() { @@ -28,12 +30,14 @@ cmCustomCommand::cmCustomCommand(const cmCustomCommand& r): Comment(r.Comment), WorkingDirectory(r.WorkingDirectory), EscapeAllowMakeVars(r.EscapeAllowMakeVars), - EscapeOldStyle(r.EscapeOldStyle) + EscapeOldStyle(r.EscapeOldStyle), + Backtrace(new cmListFileBacktrace(*r.Backtrace)) { } //---------------------------------------------------------------------------- -cmCustomCommand::cmCustomCommand(const std::vector& outputs, +cmCustomCommand::cmCustomCommand(cmMakefile* mf, + const std::vector& outputs, const std::vector& depends, const cmCustomCommandLines& commandLines, const char* comment, @@ -45,10 +49,21 @@ cmCustomCommand::cmCustomCommand(const std::vector& outputs, Comment(comment?comment:""), WorkingDirectory(workingDirectory?workingDirectory:""), EscapeAllowMakeVars(false), - EscapeOldStyle(true) + EscapeOldStyle(true), + Backtrace(new cmListFileBacktrace) { this->EscapeOldStyle = true; this->EscapeAllowMakeVars = false; + if(mf) + { + mf->GetBacktrace(*this->Backtrace); + } +} + +//---------------------------------------------------------------------------- +cmCustomCommand::~cmCustomCommand() +{ + delete this->Backtrace; } //---------------------------------------------------------------------------- @@ -131,6 +146,12 @@ void cmCustomCommand::SetEscapeAllowMakeVars(bool b) } //---------------------------------------------------------------------------- +cmListFileBacktrace const& cmCustomCommand::GetBacktrace() const +{ + return *this->Backtrace; +} + +//---------------------------------------------------------------------------- cmCustomCommand::ImplicitDependsList const& cmCustomCommand::GetImplicitDepends() const { diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h index c9adddf..dd92e34 100644 --- a/Source/cmCustomCommand.h +++ b/Source/cmCustomCommand.h @@ -13,6 +13,8 @@ #define cmCustomCommand_h #include "cmStandardIncludes.h" +class cmMakefile; +class cmListFileBacktrace; /** \class cmCustomCommand * \brief A class to encapsulate a custom command @@ -27,12 +29,15 @@ public: cmCustomCommand(const cmCustomCommand& r); /** Main constructor specifies all information for the command. */ - cmCustomCommand(const std::vector& outputs, + cmCustomCommand(cmMakefile* mf, + const std::vector& outputs, const std::vector& depends, const cmCustomCommandLines& commandLines, const char* comment, const char* workingDirectory); + ~cmCustomCommand(); + /** Get the output file produced by the command. */ const std::vector& GetOutputs() const; @@ -63,6 +68,9 @@ public: bool GetEscapeAllowMakeVars() const; void SetEscapeAllowMakeVars(bool b); + /** Backtrace of the command that created this custom command. */ + cmListFileBacktrace const& GetBacktrace() const; + typedef std::pair ImplicitDependsPair; class ImplicitDependsList: public std::vector {}; void SetImplicitDepends(ImplicitDependsList const&); @@ -78,6 +86,7 @@ private: std::string WorkingDirectory; bool EscapeAllowMakeVars; bool EscapeOldStyle; + cmListFileBacktrace* Backtrace; ImplicitDependsList ImplicitDepends; }; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 15abd02..f558509 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1893,7 +1893,7 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget( std::vector no_outputs; std::vector no_depends; // Store the custom command in the target. - cmCustomCommand cc(no_outputs, no_depends, *commandLines, 0, + cmCustomCommand cc(0, no_outputs, no_depends, *commandLines, 0, workingDirectory); target.GetPostBuildCommands().push_back(cc); target.SetProperty("EchoString", message); diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 851c526..7aabf4d 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -838,7 +838,7 @@ cmLocalVisualStudio6Generator::MaybeCreateOutputDir(cmTarget& target, std::vector no_depends; cmCustomCommandLines commands; commands.push_back(command); - pcc.reset(new cmCustomCommand(no_output, no_depends, commands, 0, 0)); + pcc.reset(new cmCustomCommand(0, no_output, no_depends, commands, 0, 0)); pcc->SetEscapeOldStyle(false); pcc->SetEscapeAllowMakeVars(true); return pcc; diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 6d43dc4..a044363 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -53,7 +53,7 @@ cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmTarget& target, std::vector no_depends; cmCustomCommandLines commands; commands.push_back(command); - pcc.reset(new cmCustomCommand(no_output, no_depends, commands, 0, 0)); + pcc.reset(new cmCustomCommand(0, no_output, no_depends, commands, 0, 0)); pcc->SetEscapeOldStyle(false); pcc->SetEscapeAllowMakeVars(true); return pcc; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 56e0ed9..3bce01c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -827,7 +827,8 @@ cmMakefile::AddCustomCommandToTarget(const char* target, { // Add the command to the appropriate build step for the target. std::vector no_output; - cmCustomCommand cc(no_output, depends, commandLines, comment, workingDir); + cmCustomCommand cc(this, no_output, depends, + commandLines, comment, workingDir); cc.SetEscapeOldStyle(escapeOldStyle); cc.SetEscapeAllowMakeVars(true); switch(type) @@ -947,7 +948,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector& outputs, if(file) { cmCustomCommand* cc = - new cmCustomCommand(outputs, depends2, commandLines, + new cmCustomCommand(this, outputs, depends2, commandLines, comment, workingDir); cc->SetEscapeOldStyle(escapeOldStyle); cc->SetEscapeAllowMakeVars(true); -- cgit v0.12 From 4091bca4ecf4a7f9c2099a7d34e125494de60e1c Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 6 Dec 2010 17:11:36 -0500 Subject: Factor generator expression docs out of add_test This documentation may be reused wherever generator expressions are supported. --- Source/CMakeLists.txt | 1 + Source/cmAddTestCommand.h | 15 ++------------- Source/cmDocumentGeneratorExpressions.h | 30 ++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 13 deletions(-) create mode 100644 Source/cmDocumentGeneratorExpressions.h diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 49412d8..f183eb4 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -158,6 +158,7 @@ SET(SRCS cmDocumentationFormatterText.cxx cmDocumentationFormatterUsage.cxx cmDocumentationSection.cxx + cmDocumentGeneratorExpressions.h cmDocumentVariables.cxx cmDynamicLoader.cxx cmDynamicLoader.h diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h index 79fb481..1cc86c4 100644 --- a/Source/cmAddTestCommand.h +++ b/Source/cmAddTestCommand.h @@ -13,6 +13,7 @@ #define cmAddTestCommand_h #include "cmCommand.h" +#include "cmDocumentGeneratorExpressions.h" /** \class cmAddTestCommand * \brief Add a test to the lists of tests to run. @@ -77,19 +78,7 @@ public: "\n" "Arguments after COMMAND may use \"generator expressions\" with the " "syntax \"$<...>\". " - "These expressions are evaluted during build system generation and " - "produce information specific to each generated build configuration. " - "Valid expressions are:\n" - " $ = configuration name\n" - " $ = main file (.exe, .so.1.2, .a)\n" - " $ = file used to link (.a, .lib, .so)\n" - " $ = file with soname (.so.3)\n" - "where \"tgt\" is the name of a target. " - "Target file expressions produce a full path, but _DIR and _NAME " - "versions can produce the directory and file name components:\n" - " $/$\n" - " $/$\n" - " $/$\n" + CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS "Example usage:\n" " add_test(NAME mytest\n" " COMMAND testDriver --config $\n" diff --git a/Source/cmDocumentGeneratorExpressions.h b/Source/cmDocumentGeneratorExpressions.h new file mode 100644 index 0000000..5359013 --- /dev/null +++ b/Source/cmDocumentGeneratorExpressions.h @@ -0,0 +1,30 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2010 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 cmDocumentGeneratorExpressions_h +#define cmDocumentGeneratorExpressions_h + +#define CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS \ + "Generator expressions are evaluted during build system generation " \ + "to produce information specific to each build configuration. " \ + "Valid expressions are:\n" \ + " $ = configuration name\n" \ + " $ = main file (.exe, .so.1.2, .a)\n" \ + " $ = file used to link (.a, .lib, .so)\n" \ + " $ = file with soname (.so.3)\n" \ + "where \"tgt\" is the name of a target. " \ + "Target file expressions produce a full path, but _DIR and _NAME " \ + "versions can produce the directory and file name components:\n" \ + " $/$\n" \ + " $/$\n" \ + " $/$\n" + +#endif -- cgit v0.12 From 45e1953c4037d4492668651ae3bbfd6a4a875bc1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 7 Dec 2010 17:36:24 -0500 Subject: Factor per-config sample targets out of 'Testing' test Put the source files, build rules, and test scripts for these targets under Tests/PerConfig and refer to it from Tests/Testing as a subdirectory. The targets and scripts will be useful in other tests. --- Tests/PerConfig/CMakeLists.txt | 33 +++++++++++++++++++++++++++++++++ Tests/PerConfig/pcShared.c | 5 +++++ Tests/PerConfig/pcShared.h | 16 ++++++++++++++++ Tests/PerConfig/pcStatic.c | 4 ++++ Tests/PerConfig/perconfig.c | 8 ++++++++ Tests/PerConfig/perconfig.cmake | 40 ++++++++++++++++++++++++++++++++++++++++ Tests/Testing/CMakeLists.txt | 34 +++------------------------------- Tests/Testing/driver.cmake | 40 ---------------------------------------- Tests/Testing/pcShared.c | 5 ----- Tests/Testing/pcShared.h | 16 ---------------- Tests/Testing/pcStatic.c | 4 ---- Tests/Testing/perconfig.c | 8 -------- 12 files changed, 109 insertions(+), 104 deletions(-) create mode 100644 Tests/PerConfig/CMakeLists.txt create mode 100644 Tests/PerConfig/pcShared.c create mode 100644 Tests/PerConfig/pcShared.h create mode 100644 Tests/PerConfig/pcStatic.c create mode 100644 Tests/PerConfig/perconfig.c create mode 100644 Tests/PerConfig/perconfig.cmake delete mode 100644 Tests/Testing/driver.cmake delete mode 100644 Tests/Testing/pcShared.c delete mode 100644 Tests/Testing/pcShared.h delete mode 100644 Tests/Testing/pcStatic.c delete mode 100644 Tests/Testing/perconfig.c diff --git a/Tests/PerConfig/CMakeLists.txt b/Tests/PerConfig/CMakeLists.txt new file mode 100644 index 0000000..a45abc8 --- /dev/null +++ b/Tests/PerConfig/CMakeLists.txt @@ -0,0 +1,33 @@ +project(PerConfig C) + +# Targets with per-configuration names. +ADD_LIBRARY(pcStatic STATIC pcStatic.c) +SET_PROPERTY(TARGET pcStatic PROPERTY RELEASE_POSTFIX -opt) +SET_PROPERTY(TARGET pcStatic PROPERTY DEBUG_POSTFIX -dbg) +ADD_LIBRARY(pcShared SHARED pcShared.c) +SET_PROPERTY(TARGET pcShared PROPERTY RELEASE_POSTFIX -opt) +SET_PROPERTY(TARGET pcShared PROPERTY DEBUG_POSTFIX -dbg) +SET_PROPERTY(TARGET pcShared PROPERTY VERSION 1.2) +SET_PROPERTY(TARGET pcShared PROPERTY SOVERSION 3) +IF(NOT WIN32) + SET(soname_file -DpcShared_soname_file=$) +ENDIF() +ADD_EXECUTABLE(perconfig perconfig.c) +TARGET_LINK_LIBRARIES(perconfig pcStatic pcShared) +SET_PROPERTY(TARGET perconfig PROPERTY RELEASE_POSTFIX -opt) +SET_PROPERTY(TARGET perconfig PROPERTY DEBUG_POSTFIX -dbg) + +SET(PerConfig_COMMAND + ${CMAKE_COMMAND} + -Dconfiguration=$ + -Dperconfig_file_dir=$ + -Dperconfig_file_name=$ + -Dperconfig_file=$ + -DpcStatic_file=$ + -DpcStatic_linker_file=$ + -DpcShared_file=$ + -DpcShared_linker_file=$ + ${soname_file} + -P ${PerConfig_SOURCE_DIR}/perconfig.cmake + ) +SET(PerConfig_COMMAND "${PerConfig_COMMAND}" PARENT_SCOPE) diff --git a/Tests/PerConfig/pcShared.c b/Tests/PerConfig/pcShared.c new file mode 100644 index 0000000..b08fadc --- /dev/null +++ b/Tests/PerConfig/pcShared.c @@ -0,0 +1,5 @@ +#include "pcShared.h" +const char* pcShared(void) +{ + return "INFO:symbol[pcShared]"; +} diff --git a/Tests/PerConfig/pcShared.h b/Tests/PerConfig/pcShared.h new file mode 100644 index 0000000..59a6ef4 --- /dev/null +++ b/Tests/PerConfig/pcShared.h @@ -0,0 +1,16 @@ +#ifndef pcShared_h +#define pcShared_h + +#ifdef _WIN32 +# ifdef pcShared_EXPORTS +# define PC_EXPORT __declspec(dllexport) +# else +# define PC_EXPORT __declspec(dllimport) +# endif +#else +# define PC_EXPORT +#endif + +PC_EXPORT const char* pcShared(void); + +#endif diff --git a/Tests/PerConfig/pcStatic.c b/Tests/PerConfig/pcStatic.c new file mode 100644 index 0000000..7e1bf51 --- /dev/null +++ b/Tests/PerConfig/pcStatic.c @@ -0,0 +1,4 @@ +const char* pcStatic(void) +{ + return "INFO:symbol[pcStatic]"; +} diff --git a/Tests/PerConfig/perconfig.c b/Tests/PerConfig/perconfig.c new file mode 100644 index 0000000..d942d45 --- /dev/null +++ b/Tests/PerConfig/perconfig.c @@ -0,0 +1,8 @@ +#include "pcShared.h" +extern const char* pcStatic(void); +int main() +{ + pcStatic(); + pcShared(); + return 0; +} diff --git a/Tests/PerConfig/perconfig.cmake b/Tests/PerConfig/perconfig.cmake new file mode 100644 index 0000000..4a93acc --- /dev/null +++ b/Tests/PerConfig/perconfig.cmake @@ -0,0 +1,40 @@ +# Print values for human reference. +foreach(v + configuration + perconfig_file_dir + perconfig_file_name + perconfig_file + pcStatic_file + pcStatic_linker_file + pcShared_file + pcShared_linker_file + pcShared_soname_file + ) + message("${v}=${${v}}") +endforeach() + +# Verify that file names match as expected. +set(pc_file_components ${perconfig_file_dir}/${perconfig_file_name}) +if(NOT "${pc_file_components}" STREQUAL "${perconfig_file}") + message(SEND_ERROR + "File components ${pc_file_components} do not match ${perconfig_file}") +endif() +if(NOT "${pcStatic_file}" STREQUAL "${pcStatic_linker_file}") + message(SEND_ERROR + "pcStatic_file does not match pcStatic_linker_file:\n" + " ${pcStatic_file}\n" + " ${pcStatic_linker_file}\n" + ) +endif() + +# Verify that the implementation files are named correctly. +foreach(lib pcStatic pcShared) + file(STRINGS "${${lib}_file}" info LIMIT_COUNT 1 REGEX "INFO:[^[]*\\[") + if(NOT "${info}" MATCHES ".*INFO:symbol\\[${lib}\\].*") + message(SEND_ERROR "No INFO:symbol[${lib}] found in:\n ${${lib}_file}") + endif() +endforeach() +execute_process(COMMAND ${perconfig_file} RESULT_VARIABLE result) +if(result) + message(SEND_ERROR "Error running:\n ${perconfig_file}\n(${result})") +endif() diff --git a/Tests/Testing/CMakeLists.txt b/Tests/Testing/CMakeLists.txt index f857407..815b52b 100644 --- a/Tests/Testing/CMakeLists.txt +++ b/Tests/Testing/CMakeLists.txt @@ -53,35 +53,7 @@ ADD_TEST(testing.1 ${Testing_BINARY_DIR}/bin/testing) # ADD_SUBDIRECTORY(Sub/Sub2) -# Per-config target name test. -ADD_LIBRARY(pcStatic STATIC pcStatic.c) -SET_PROPERTY(TARGET pcStatic PROPERTY RELEASE_POSTFIX -opt) -SET_PROPERTY(TARGET pcStatic PROPERTY DEBUG_POSTFIX -dbg) -ADD_LIBRARY(pcShared SHARED pcShared.c) -SET_PROPERTY(TARGET pcShared PROPERTY RELEASE_POSTFIX -opt) -SET_PROPERTY(TARGET pcShared PROPERTY DEBUG_POSTFIX -dbg) -SET_PROPERTY(TARGET pcShared PROPERTY VERSION 1.2) -SET_PROPERTY(TARGET pcShared PROPERTY SOVERSION 3) -IF(NOT WIN32) - SET(soname_file -DpcShared_soname_file=$) -ENDIF() -ADD_EXECUTABLE(perconfig perconfig.c) -TARGET_LINK_LIBRARIES(perconfig pcStatic pcShared) -SET_PROPERTY(TARGET perconfig PROPERTY RELEASE_POSTFIX -opt) -SET_PROPERTY(TARGET perconfig PROPERTY DEBUG_POSTFIX -dbg) +# Per-config target name and generator expressions. +ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../PerConfig PerConfig) ADD_TEST(NAME testing.perconfig COMMAND perconfig) - -# Test using a driver script with generator expressions. -ADD_TEST(NAME testing.driver - COMMAND ${CMAKE_COMMAND} - -Dconfiguration=$ - -Dperconfig_file_dir=$ - -Dperconfig_file_name=$ - -Dperconfig_file=$ - -DpcStatic_file=$ - -DpcStatic_linker_file=$ - -DpcShared_file=$ - -DpcShared_linker_file=$ - ${soname_file} - -P ${Testing_SOURCE_DIR}/driver.cmake - ) +ADD_TEST(NAME testing.driver COMMAND ${PerConfig_COMMAND}) diff --git a/Tests/Testing/driver.cmake b/Tests/Testing/driver.cmake deleted file mode 100644 index 4a93acc..0000000 --- a/Tests/Testing/driver.cmake +++ /dev/null @@ -1,40 +0,0 @@ -# Print values for human reference. -foreach(v - configuration - perconfig_file_dir - perconfig_file_name - perconfig_file - pcStatic_file - pcStatic_linker_file - pcShared_file - pcShared_linker_file - pcShared_soname_file - ) - message("${v}=${${v}}") -endforeach() - -# Verify that file names match as expected. -set(pc_file_components ${perconfig_file_dir}/${perconfig_file_name}) -if(NOT "${pc_file_components}" STREQUAL "${perconfig_file}") - message(SEND_ERROR - "File components ${pc_file_components} do not match ${perconfig_file}") -endif() -if(NOT "${pcStatic_file}" STREQUAL "${pcStatic_linker_file}") - message(SEND_ERROR - "pcStatic_file does not match pcStatic_linker_file:\n" - " ${pcStatic_file}\n" - " ${pcStatic_linker_file}\n" - ) -endif() - -# Verify that the implementation files are named correctly. -foreach(lib pcStatic pcShared) - file(STRINGS "${${lib}_file}" info LIMIT_COUNT 1 REGEX "INFO:[^[]*\\[") - if(NOT "${info}" MATCHES ".*INFO:symbol\\[${lib}\\].*") - message(SEND_ERROR "No INFO:symbol[${lib}] found in:\n ${${lib}_file}") - endif() -endforeach() -execute_process(COMMAND ${perconfig_file} RESULT_VARIABLE result) -if(result) - message(SEND_ERROR "Error running:\n ${perconfig_file}\n(${result})") -endif() diff --git a/Tests/Testing/pcShared.c b/Tests/Testing/pcShared.c deleted file mode 100644 index b08fadc..0000000 --- a/Tests/Testing/pcShared.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "pcShared.h" -const char* pcShared(void) -{ - return "INFO:symbol[pcShared]"; -} diff --git a/Tests/Testing/pcShared.h b/Tests/Testing/pcShared.h deleted file mode 100644 index 59a6ef4..0000000 --- a/Tests/Testing/pcShared.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef pcShared_h -#define pcShared_h - -#ifdef _WIN32 -# ifdef pcShared_EXPORTS -# define PC_EXPORT __declspec(dllexport) -# else -# define PC_EXPORT __declspec(dllimport) -# endif -#else -# define PC_EXPORT -#endif - -PC_EXPORT const char* pcShared(void); - -#endif diff --git a/Tests/Testing/pcStatic.c b/Tests/Testing/pcStatic.c deleted file mode 100644 index 7e1bf51..0000000 --- a/Tests/Testing/pcStatic.c +++ /dev/null @@ -1,4 +0,0 @@ -const char* pcStatic(void) -{ - return "INFO:symbol[pcStatic]"; -} diff --git a/Tests/Testing/perconfig.c b/Tests/Testing/perconfig.c deleted file mode 100644 index d942d45..0000000 --- a/Tests/Testing/perconfig.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "pcShared.h" -extern const char* pcStatic(void); -int main() -{ - pcStatic(); - pcShared(); - return 0; -} -- cgit v0.12 From ef9e9de0b80a08bb9290fce3816ff621d2ff3419 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 8 Dec 2010 13:32:09 -0500 Subject: Optionally suppress errors in cmGeneratorExpression --- Source/cmGeneratorExpression.cxx | 7 ++++--- Source/cmGeneratorExpression.h | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index a61880f..971cad2 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -17,8 +17,8 @@ //---------------------------------------------------------------------------- cmGeneratorExpression::cmGeneratorExpression( cmMakefile* mf, const char* config, - cmListFileBacktrace const& backtrace): - Makefile(mf), Config(config), Backtrace(backtrace) + cmListFileBacktrace const& backtrace, bool quiet): + Makefile(mf), Config(config), Backtrace(backtrace), Quiet(quiet) { this->TargetInfo.compile("^\\$Data.insert(this->Data.end(), result.begin(), result.end()); return true; } - else + else if(!this->Quiet) { // Failure. Report the error message. cmOStringStream e; @@ -99,6 +99,7 @@ bool cmGeneratorExpression::Evaluate() this->Backtrace); return false; } + return true; } //---------------------------------------------------------------------------- diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index aa36055..9bed780 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -32,7 +32,8 @@ class cmGeneratorExpression public: /** Construct with an evaluation context and configuration. */ cmGeneratorExpression(cmMakefile* mf, const char* config, - cmListFileBacktrace const& backtrace); + cmListFileBacktrace const& backtrace, + bool quiet = false); /** Evaluate generator expressions in a string. */ const char* Process(std::string const& input); @@ -41,6 +42,7 @@ private: cmMakefile* Makefile; const char* Config; cmListFileBacktrace const& Backtrace; + bool Quiet; std::vector Data; std::stack Barriers; cmsys::RegularExpression TargetInfo; -- cgit v0.12 From 4749e4cb76cc1e23cb23f37ceec2e856a18218ce Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 8 Dec 2010 13:34:05 -0500 Subject: Record set of targets used in cmGeneratorExpression --- Source/cmGeneratorExpression.cxx | 1 + Source/cmGeneratorExpression.h | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 971cad2..8710dfc 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -141,6 +141,7 @@ bool cmGeneratorExpression::EvaluateTargetInfo(std::string& result) result = "Target \"" + name + "\" is not an executable or library."; return false; } + this->Targets.insert(target); // Lookup the target file with the given purpose. std::string purpose = this->TargetInfo.match(1); diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 9bed780..1a9d4c6 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -15,6 +15,7 @@ #include +class cmTarget; class cmMakefile; class cmListFileBacktrace; @@ -38,6 +39,10 @@ public: /** Evaluate generator expressions in a string. */ const char* Process(std::string const& input); const char* Process(const char* input); + + /** Get set of targets found during evaluations. */ + std::set const& GetTargets() const + { return this->Targets; } private: cmMakefile* Makefile; const char* Config; @@ -46,6 +51,7 @@ private: std::vector Data; std::stack Barriers; cmsys::RegularExpression TargetInfo; + std::set Targets; bool Evaluate(); bool Evaluate(const char* expr, std::string& result); bool EvaluateTargetInfo(std::string& result); -- cgit v0.12 From f0cdb6001b3e915fc0d9c1120165d49725440bbd Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 8 Dec 2010 16:13:07 -0500 Subject: Introduce "generator expression" syntax to custom commands (#11209) Evaluate in the COMMAND arguments of custom commands the generator expression syntax introduced in commit d2e1f2b4 (Introduce "generator expressions" to add_test, 2009-08-11). These expressions have a syntax like $ and are evaluated during build system generation. This syntax allows per-configuration target output files to be referenced in custom command lines. --- Source/cmAddCustomCommandCommand.h | 12 ++++++++++-- Source/cmCustomCommandGenerator.cxx | 14 +++++++++++--- Source/cmCustomCommandGenerator.h | 3 +++ Source/cmTarget.cxx | 17 +++++++++++++++++ Tests/CustomCommand/CMakeLists.txt | 12 ++++++++++++ Tests/PerConfig/CMakeLists.txt | 1 + Tests/PerConfig/perconfig.cmake | 2 +- 7 files changed, 55 insertions(+), 6 deletions(-) diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h index 6c5e1af..490e043 100644 --- a/Source/cmAddCustomCommandCommand.h +++ b/Source/cmAddCustomCommandCommand.h @@ -13,6 +13,7 @@ #define cmAddCustomCommandCommand_h #include "cmCommand.h" +#include "cmDocumentGeneratorExpressions.h" /** \class cmAddCustomCommandCommand * \brief @@ -146,8 +147,15 @@ public: "target-level dependency will be added so that the executable target " "will be built before any target using this custom command. However " "this does NOT add a file-level dependency that would cause the " - "custom command to re-run whenever the executable is recompiled.\n" - + "custom command to re-run whenever the executable is recompiled." + "\n" + "Arguments to COMMAND may use \"generator expressions\" with the " + "syntax \"$<...>\". " + CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS + "References to target names in generator expressions imply " + "target-level dependencies, but NOT file-level dependencies. " + "List target names with the DEPENDS option to add file dependencies." + "\n" "The DEPENDS option specifies files on which the command depends. " "If any dependency is an OUTPUT of another custom command in the " "same directory (CMakeLists.txt file) CMake automatically brings the " diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index 2a3b553..a650129 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -14,16 +14,24 @@ #include "cmMakefile.h" #include "cmCustomCommand.h" #include "cmLocalGenerator.h" +#include "cmGeneratorExpression.h" //---------------------------------------------------------------------------- cmCustomCommandGenerator::cmCustomCommandGenerator( cmCustomCommand const& cc, const char* config, cmMakefile* mf): CC(cc), Config(config), Makefile(mf), LG(mf->GetLocalGenerator()), - OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()) + OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()), + GE(new cmGeneratorExpression(mf, config, cc.GetBacktrace())) { } //---------------------------------------------------------------------------- +cmCustomCommandGenerator::~cmCustomCommandGenerator() +{ + delete this->GE; +} + +//---------------------------------------------------------------------------- unsigned int cmCustomCommandGenerator::GetNumberOfCommands() const { return static_cast(this->CC.GetCommandLines().size()); @@ -39,7 +47,7 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const { return target->GetLocation(this->Config); } - return argv0; + return this->GE->Process(argv0); } //---------------------------------------------------------------------------- @@ -50,7 +58,7 @@ cmCustomCommandGenerator cmCustomCommandLine const& commandLine = this->CC.GetCommandLines()[c]; for(unsigned int j=1;j < commandLine.size(); ++j) { - std::string const& arg = commandLine[j]; + std::string arg = this->GE->Process(commandLine[j]); cmd += " "; if(this->OldStyle) { diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h index 5417ec5..4e89f27 100644 --- a/Source/cmCustomCommandGenerator.h +++ b/Source/cmCustomCommandGenerator.h @@ -17,6 +17,7 @@ class cmCustomCommand; class cmMakefile; class cmLocalGenerator; +class cmGeneratorExpression; class cmCustomCommandGenerator { @@ -26,9 +27,11 @@ class cmCustomCommandGenerator cmLocalGenerator* LG; bool OldStyle; bool MakeVars; + cmGeneratorExpression* GE; public: cmCustomCommandGenerator(cmCustomCommand const& cc, const char* config, cmMakefile* mf); + ~cmCustomCommandGenerator(); unsigned int GetNumberOfCommands() const; std::string GetCommand(unsigned int c) const; void AppendArguments(unsigned int c, std::string& cmd) const; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index c82c11e..40f68e4 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -17,6 +17,7 @@ #include "cmGlobalGenerator.h" #include "cmComputeLinkInformation.h" #include "cmListFileCache.h" +#include "cmGeneratorExpression.h" #include #include #include @@ -1402,6 +1403,7 @@ cmTargetTraceDependencies { // Transform command names that reference targets built in this // project to corresponding target-level dependencies. + cmGeneratorExpression ge(this->Makefile, 0, cc.GetBacktrace(), true); for(cmCustomCommandLines::const_iterator cit = cc.GetCommandLines().begin(); cit != cc.GetCommandLines().end(); ++cit) { @@ -1418,6 +1420,21 @@ cmTargetTraceDependencies this->Target->AddUtility(command.c_str()); } } + + // Check for target references in generator expressions. + for(cmCustomCommandLine::const_iterator cli = cit->begin(); + cli != cit->end(); ++cli) + { + ge.Process(*cli); + } + } + + // Add target-level dependencies referenced by generator expressions. + std::set targets = ge.GetTargets(); + for(std::set::iterator ti = targets.begin(); + ti != targets.end(); ++ti) + { + this->Target->AddUtility((*ti)->GetName()); } // Queue the custom command dependencies. diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index 746c9a7..450323e 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -423,3 +423,15 @@ ADD_CUSTOM_TARGET(DifferentName ALL ) # # + +# Per-config target name and generator expressions. +ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../PerConfig PerConfig) +ADD_CUSTOM_COMMAND( + OUTPUT perconfig.out + COMMAND ${PerConfig_COMMAND} + DEPENDS ${PerConfig_DEPENDS} + VERBATIM + ) +ADD_CUSTOM_TARGET(perconfig_target ALL + COMMAND ${CMAKE_COMMAND} -E echo "perconfig=$" "config=$" + DEPENDS perconfig.out) diff --git a/Tests/PerConfig/CMakeLists.txt b/Tests/PerConfig/CMakeLists.txt index a45abc8..7b7bf2e 100644 --- a/Tests/PerConfig/CMakeLists.txt +++ b/Tests/PerConfig/CMakeLists.txt @@ -31,3 +31,4 @@ SET(PerConfig_COMMAND -P ${PerConfig_SOURCE_DIR}/perconfig.cmake ) SET(PerConfig_COMMAND "${PerConfig_COMMAND}" PARENT_SCOPE) +SET(PerConfig_DEPENDS ${PerConfig_SOURCE_DIR}/perconfig.cmake perconfig pcStatic pcShared) diff --git a/Tests/PerConfig/perconfig.cmake b/Tests/PerConfig/perconfig.cmake index 4a93acc..6a710ca 100644 --- a/Tests/PerConfig/perconfig.cmake +++ b/Tests/PerConfig/perconfig.cmake @@ -10,7 +10,7 @@ foreach(v pcShared_linker_file pcShared_soname_file ) - message("${v}=${${v}}") + message(STATUS "${v}=${${v}}") endforeach() # Verify that file names match as expected. -- cgit v0.12 From f48d3bc5ba69906ee3c61ddb103a91bf6467c86d Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 15 Dec 2010 16:49:34 -0500 Subject: CTest: Fix test DEPEND cycle detection A cycle exists when the DFS returns to the root node, not just when multiple paths lead to the same node. Inspired-By: Alexander Esilevich --- Source/CTest/cmCTestMultiProcessHandler.cxx | 37 ++++++++++++++++------------- Tests/CMakeLists.txt | 1 + Tests/Testing/Sub/Sub2/CMakeLists.txt | 12 ++++++++++ 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 93c2963..ca26c98 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -653,32 +653,37 @@ bool cmCTestMultiProcessHandler::CheckCycles() it != this->Tests.end(); ++it) { //DFS from each element to itself + int root = it->first; + std::set visited; std::stack s; - std::vector visited; - - s.push(it->first); - + s.push(root); while(!s.empty()) { int test = s.top(); s.pop(); - - for(TestSet::iterator d = this->Tests[test].begin(); - d != this->Tests[test].end(); ++d) + if(visited.insert(test).second) { - if(std::find(visited.begin(), visited.end(), *d) != visited.end()) + for(TestSet::iterator d = this->Tests[test].begin(); + d != this->Tests[test].end(); ++d) { - //cycle exists - cmCTestLog(this->CTest, ERROR_MESSAGE, "Error: a cycle exists in " - "the test dependency graph for the test \"" - << this->Properties[it->first]->Name << "\"." << std::endl - << "Please fix the cycle and run ctest again." << std::endl); - return false; + if(*d == root) + { + //cycle exists + cmCTestLog(this->CTest, ERROR_MESSAGE, "Error: a cycle exists in " + "the test dependency graph for the test \"" + << this->Properties[root]->Name << "\"." << std::endl + << "Please fix the cycle and run ctest again." << std::endl); + return false; + } + else + { + s.push(*d); + } } - s.push(*d); } - visited.push_back(test); } } + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Checking test dependency graph end" << std::endl); return true; } diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 04f0774..e43fc75 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -779,6 +779,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} ) + SET_TESTS_PROPERTIES(testing PROPERTIES PASS_REGULAR_EXPRESSION "Passed") LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Testing") ADD_TEST(wrapping ${CMAKE_CTEST_COMMAND} diff --git a/Tests/Testing/Sub/Sub2/CMakeLists.txt b/Tests/Testing/Sub/Sub2/CMakeLists.txt index 3a7295d..fb9e861 100644 --- a/Tests/Testing/Sub/Sub2/CMakeLists.txt +++ b/Tests/Testing/Sub/Sub2/CMakeLists.txt @@ -3,3 +3,15 @@ # ADD_EXECUTABLE(testing2 testing2.cxx) ADD_TEST(testing.2 ${Testing_BINARY_DIR}/bin/testing2) + +add_test(NotCycle.a ${CMAKE_COMMAND} -E echo a) +add_test(NotCycle.test1 ${CMAKE_COMMAND} -E echo test1) +set_property(TEST NotCycle.test1 PROPERTY DEPENDS NotCycle.a) + +add_test(NotCycle.b ${CMAKE_COMMAND} -E echo b) +add_test(NotCycle.test2 ${CMAKE_COMMAND} -E echo test2) +set_property(TEST NotCycle.test2 PROPERTY DEPENDS NotCycle.b NotCycle.test1) + +add_test(NotCycle.c ${CMAKE_COMMAND} -E echo c) +add_test(NotCycle.test3 ${CMAKE_COMMAND} -E echo test3) +set_property(TEST NotCycle.test3 PROPERTY DEPENDS NotCycle.c NotCycle.test1 NotCycle.test2) -- cgit v0.12 From 3fb088e521584dfed27513faf556b8b0d6cc73d3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 15 Dec 2010 17:56:24 -0500 Subject: Make Intel defines consistent with MSVC on Windows (#9904) Add /DWIN32 and /D_WINDOWS to default config-independent flags. Add /D[_N]DEBUG to default flags for each configuration. --- Modules/Platform/Windows-icl.cmake | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Modules/Platform/Windows-icl.cmake b/Modules/Platform/Windows-icl.cmake index 9088cc7..278a757 100644 --- a/Modules/Platform/Windows-icl.cmake +++ b/Modules/Platform/Windows-icl.cmake @@ -58,16 +58,16 @@ SET(CMAKE_CREATE_CONSOLE_EXE /subsystem:console) # default to Debug builds #SET(CMAKE_BUILD_TYPE_INIT Debug) SET(CMAKE_BUILD_TYPE_INIT Release) -SET (CMAKE_CXX_FLAGS_INIT "/W3 /Zm1000 /GX /GR") -SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/MDd /Zi /Od /GZ") -SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1") -SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2") -SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2") -SET (CMAKE_C_FLAGS_INIT "/W3 /Zm1000") -SET (CMAKE_C_FLAGS_DEBUG_INIT "/MDd /Zi /Od /GZ") -SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1") -SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2") -SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2") +SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR") +SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Od /GZ") +SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/DNDEBUG /MD /O1") +SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/DNDEBUG /MD /O2") +SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/DNDEBUG /MD /Zi /O2") +SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") +SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Od /GZ") +SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/DNDEBUG /MD /O1") +SET (CMAKE_C_FLAGS_RELEASE_INIT "/DNDEBUG /MD /O2") +SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/DNDEBUG /MD /Zi /O2") SET(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib") -- cgit v0.12 From 4f007638141bafc8747e809916e10df9f2ee651b Mon Sep 17 00:00:00 2001 From: Alexey Ozeritsky Date: Thu, 16 Dec 2010 13:34:13 +0300 Subject: FindBLAS works in C/C++ projects without Fortran --- Modules/FindBLAS.cmake | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 94bbed5..17b070b 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -40,16 +40,7 @@ # License text for the above reference.) get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES) -if(NOT _LANGUAGES_ MATCHES Fortran) - if(BLAS_FIND_REQUIRED) - message(FATAL_ERROR "FindBLAS is Fortran-only so Fortran must be enabled.") - else(BLAS_FIND_REQUIRED) - message(STATUS "Looking for BLAS... - NOT found (Fortran not enabled)") # - return() - endif(BLAS_FIND_REQUIRED) -endif(NOT _LANGUAGES_ MATCHES Fortran) - -include(CheckFortranFunctionExists) +include(CheckFunctionExists) macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _threads) # This macro checks for the existence of the combination of fortran libraries @@ -107,7 +98,7 @@ if(_libraries_work) # Test this combination of libraries. set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_threads}) # message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") - check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS) + check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) set(CMAKE_REQUIRED_LIBRARIES) mark_as_advanced(${_prefix}${_combined_name}_WORKS) set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) @@ -300,6 +291,9 @@ endif (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") #BLAS in intel mkl 10 library? (em64t 64bit) 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(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) find_package(Threads) @@ -340,7 +334,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") sgemm "" "mkl_blas95;mkl_intel;mkl_intel_thread;mkl_core;guide" - "${CMAKE_THREAD_LIBS_INIT}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT BLAS95_LIBRARIES) else(BLA_F95) @@ -352,6 +346,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") "" "mkl_intel;mkl_intel_thread;mkl_core;guide" "${CMAKE_THREAD_LIBS_INIT}" + "${LM}" ) endif(NOT BLAS_LIBRARIES) endif(BLA_F95) @@ -365,7 +360,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") sgemm "" "mkl_blas95;mkl_intel_lp64;mkl_intel_thread;mkl_core;guide" - "${CMAKE_THREAD_LIBS_INIT}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT BLAS95_LIBRARIES) else(BLA_F95) @@ -376,7 +371,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") sgemm "" "mkl_intel_lp64;mkl_intel_thread;mkl_core;guide" - "${CMAKE_THREAD_LIBS_INIT}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT BLAS_LIBRARIES) endif(BLA_F95) @@ -391,7 +386,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") sgemm "" "mkl;guide" - "${CMAKE_THREAD_LIBS_INIT}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT BLAS_LIBRARIES) #BLAS in intel mkl library? (static, 32bit) @@ -402,7 +397,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") sgemm "" "mkl_ia32;guide" - "${CMAKE_THREAD_LIBS_INIT}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT BLAS_LIBRARIES) #BLAS in intel mkl library? (static, em64t 64bit) @@ -413,7 +408,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") sgemm "" "mkl_em64t;guide" - "${CMAKE_THREAD_LIBS_INIT}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT BLAS_LIBRARIES) endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) -- cgit v0.12 From cabafa37fbd4a8b02e90667476d7568caddff178 Mon Sep 17 00:00:00 2001 From: Alexey Ozeritsky Date: Thu, 16 Dec 2010 14:40:58 +0300 Subject: ACML find fixes (issue 0011219) --- Modules/FindBLAS.cmake | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 17b070b..b605164 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -237,13 +237,24 @@ endif (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All") #BLAS in acml library? if (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "All") + # Either acml or acml_mp should be in LD_LIBRARY_PATH but not both if(NOT BLAS_LIBRARIES) check_fortran_libraries( BLAS_LIBRARIES BLAS sgemm "" - "acml" + "acml;acml_mv" + "" + ) + endif(NOT BLAS_LIBRARIES) + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "acml_mp;acml_mv" "" ) endif(NOT BLAS_LIBRARIES) -- cgit v0.12 From 1f7133cd61c88bbb60e5695312c91c7a3238a707 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 16 Dec 2010 08:07:43 -0500 Subject: CTest: Fix line-too-long style in DEPEND cycle error --- Source/CTest/cmCTestMultiProcessHandler.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index ca26c98..94614cf 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -669,10 +669,10 @@ bool cmCTestMultiProcessHandler::CheckCycles() if(*d == root) { //cycle exists - cmCTestLog(this->CTest, ERROR_MESSAGE, "Error: a cycle exists in " - "the test dependency graph for the test \"" - << this->Properties[root]->Name << "\"." << std::endl - << "Please fix the cycle and run ctest again." << std::endl); + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Error: a cycle exists in the test dependency graph " + "for the test \"" << this->Properties[root]->Name << + "\".\nPlease fix the cycle and run ctest again.\n"); return false; } else -- cgit v0.12 From 58c73c43f62d581f62d694f5d144a021b9832284 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 16 Dec 2010 09:33:06 -0500 Subject: Detect Fortran target architecture on Windows Commit 4430bccc (Change the way 32/64 bit compiles are detected with MSVC and intel, 2009-11-19) added detection of the target processor to C and CXX language builds with MS and Intel tools. Do the same for Intel Fortran for Windows (ifort). Use /machine: to link executables. --- Modules/CMakeDetermineFortranCompiler.cmake | 4 ++++ Modules/CMakeFortranCompiler.cmake.in | 1 + Modules/CMakeFortranCompilerId.F.in | 9 +++++++++ Modules/Platform/Windows-ifort.cmake | 5 ++++- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 03ddd78..ebab8bc 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -215,6 +215,10 @@ ENDIF(NOT CMAKE_Fortran_COMPILER_ID_RUN) INCLUDE(CMakeFindBinUtils) +IF(MSVC_Fortran_ARCHITECTURE_ID) + SET(SET_MSVC_Fortran_ARCHITECTURE_ID + "SET(MSVC_Fortran_ARCHITECTURE_ID ${MSVC_Fortran_ARCHITECTURE_ID})") +ENDIF() # configure variables set in this file for fast reload later on CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeFortranCompiler.cmake.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeFortranCompiler.cmake diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index 5558651..146a6f2 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -2,6 +2,7 @@ SET(CMAKE_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@") SET(CMAKE_Fortran_COMPILER_ARG1 "@CMAKE_Fortran_COMPILER_ARG1@") SET(CMAKE_Fortran_COMPILER_ID "@CMAKE_Fortran_COMPILER_ID@") SET(CMAKE_Fortran_PLATFORM_ID "@CMAKE_Fortran_PLATFORM_ID@") +@SET_MSVC_Fortran_ARCHITECTURE_ID@ SET(CMAKE_AR "@CMAKE_AR@") SET(CMAKE_RANLIB "@CMAKE_RANLIB@") SET(CMAKE_COMPILER_IS_GNUG77 @CMAKE_COMPILER_IS_GNUG77@) diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 4080cc1..8584731 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -109,4 +109,13 @@ # endif PRINT *, 'INFO:platform[]' #endif +#if defined(_WIN32) && (defined(__INTEL_COMPILER) || defined(__ICC)) +# if defined(_M_IA64) + PRINT *, 'INFO:arch[IA64]' +# elif defined(_M_X64) || defined(_M_AMD64) + PRINT *, 'INFO:arch[x64]' +# elif defined(_M_IX86) + PRINT *, 'INFO:arch[X86]' +# endif +#endif END diff --git a/Modules/Platform/Windows-ifort.cmake b/Modules/Platform/Windows-ifort.cmake index 6cffed9..1fd734e 100644 --- a/Modules/Platform/Windows-ifort.cmake +++ b/Modules/Platform/Windows-ifort.cmake @@ -63,7 +63,10 @@ SET (CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib") # executable linker flags SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") -SET (CMAKE_EXE_LINKER_FLAGS_INIT " /INCREMENTAL:YES") +IF(NOT _MACHINE_ARCH_FLAG) + SET(_MACHINE_ARCH_FLAG ${MSVC_Fortran_ARCHITECTURE_ID}) +ENDIF(NOT _MACHINE_ARCH_FLAG) +SET (CMAKE_EXE_LINKER_FLAGS_INIT " /INCREMENTAL:YES /machine:${_MACHINE_ARCH_FLAG}") IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept") SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept") -- cgit v0.12 From cd43636c95320ce39480c7c4c6cf909b86f2fc54 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 16 Dec 2010 09:50:05 -0500 Subject: Modernize Intel compiler info on Windows This moves Intel compiler info on Windows into new-style modules Platform/Windows-Intel-.cmake using language-independent helper module Platform/Windows-Intel.cmake to define macros consolidating the information. --- Modules/Platform/Windows-Intel-C.cmake | 2 + Modules/Platform/Windows-Intel-CXX.cmake | 4 + Modules/Platform/Windows-Intel-Fortran.cmake | 11 +++ Modules/Platform/Windows-Intel.cmake | 87 +++++++++++++++++++++ Modules/Platform/Windows-icl.cmake | 109 --------------------------- Modules/Platform/Windows-ifort.cmake | 83 -------------------- 6 files changed, 104 insertions(+), 192 deletions(-) create mode 100644 Modules/Platform/Windows-Intel-C.cmake create mode 100644 Modules/Platform/Windows-Intel-CXX.cmake create mode 100644 Modules/Platform/Windows-Intel-Fortran.cmake delete mode 100644 Modules/Platform/Windows-icl.cmake delete mode 100644 Modules/Platform/Windows-ifort.cmake diff --git a/Modules/Platform/Windows-Intel-C.cmake b/Modules/Platform/Windows-Intel-C.cmake new file mode 100644 index 0000000..767fec5 --- /dev/null +++ b/Modules/Platform/Windows-Intel-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-Intel) +__windows_compiler_intel(C) diff --git a/Modules/Platform/Windows-Intel-CXX.cmake b/Modules/Platform/Windows-Intel-CXX.cmake new file mode 100644 index 0000000..2845b0f --- /dev/null +++ b/Modules/Platform/Windows-Intel-CXX.cmake @@ -0,0 +1,4 @@ +include(Platform/Windows-Intel) +set(_COMPILE_CXX " /TP") +set(_FLAGS_CXX " /GX /GR") +__windows_compiler_intel(CXX) diff --git a/Modules/Platform/Windows-Intel-Fortran.cmake b/Modules/Platform/Windows-Intel-Fortran.cmake new file mode 100644 index 0000000..c959287 --- /dev/null +++ b/Modules/Platform/Windows-Intel-Fortran.cmake @@ -0,0 +1,11 @@ +include(Platform/Windows-Intel) +set(CMAKE_BUILD_TYPE_INIT Debug) +set(_COMPILE_Fortran " /fpp") +set(CMAKE_Fortran_MODDIR_FLAG "-module:") +set(CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib") +__windows_compiler_intel(Fortran) +SET (CMAKE_Fortran_FLAGS_INIT "/W1 /nologo /fpp /libs:dll /threads") +SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full /dbglibs") +SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/O2 /D NDEBUG") +SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "/O1 /D NDEBUG") +SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/O1 /debug:full /D NDEBUG") diff --git a/Modules/Platform/Windows-Intel.cmake b/Modules/Platform/Windows-Intel.cmake index e893925..444a60e 100644 --- a/Modules/Platform/Windows-Intel.cmake +++ b/Modules/Platform/Windows-Intel.cmake @@ -1,3 +1,62 @@ + +#============================================================================= +# Copyright 2002-2010 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.) + +# This module is shared by multiple languages; use include blocker. +if(__WINDOWS_INTEL) + return() +endif() +set(__WINDOWS_INTEL 1) + +SET(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") +SET(CMAKE_LINK_LIBRARY_FLAG "") +SET(WIN32 1) +IF(CMAKE_VERBOSE_MAKEFILE) + SET(CMAKE_CL_NOLOGO) +ELSE(CMAKE_VERBOSE_MAKEFILE) + SET(CMAKE_CL_NOLOGO "/nologo") +ENDIF(CMAKE_VERBOSE_MAKEFILE) +SET(CMAKE_COMPILE_RESOURCE "rc /fo ") +SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows) +SET(CMAKE_CREATE_CONSOLE_EXE /subsystem:console) + +# default to Debug builds +#SET(CMAKE_BUILD_TYPE_INIT Debug) +SET(CMAKE_BUILD_TYPE_INIT Release) + +SET(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib") +SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") + +# executable linker flags +SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") +IF(MSVC_C_ARCHITECTURE_ID) + SET(_MACHINE_ARCH_FLAG "/machine:${MSVC_C_ARCHITECTURE_ID}") +ELSEIF(MSVC_CXX_ARCHITECTURE_ID) + SET(_MACHINE_ARCH_FLAG "/machine:${MSVC_CXX_ARCHITECTURE_ID}") +ELSEIF(MSVC_Fortran_ARCHITECTURE_ID) + SET(_MACHINE_ARCH_FLAG "/machine:${MSVC_Fortran_ARCHITECTURE_ID}") +ENDIF() +SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /INCREMENTAL:YES ${_MACHINE_ARCH_FLAG}") +SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug") +SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug") + +SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) + INCLUDE("${CMAKE_PLATFORM_ROOT_BIN}/CMakeIntelInformation.cmake" OPTIONAL) IF(NOT _INTEL_XILINK_TEST_RUN) @@ -15,3 +74,31 @@ SET(_INTEL_COMPILER_SUPPORTS_MANIFEST ${_INTEL_COMPILER_SUPPORTS_MANIFEST}) ") ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeIntelInformation.cmake") ENDIF(NOT _INTEL_XILINK_TEST_RUN) + +macro(__windows_compiler_intel lang) + set(CMAKE_${lang}_COMPILE_OBJECT + " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /Fo -c ${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE + " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} -E ${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1) + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "lib ${CMAKE_CL_NOLOGO} /out: ") + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY + "xilink ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /implib: /pdb: /dll ${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_CREATE_SHARED_MODULE "${CMAKE_${lang}_CREATE_SHARED_LIBRARY}") + set(CMAKE_${lang}_LINK_EXECUTABLE + " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe -link /implib: ${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000${_FLAGS_${lang}}") + set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Od /GZ") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/DNDEBUG /MD /O1") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/DNDEBUG /MD /O2") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/DNDEBUG /MD /Zi /O2") + + if(_INTEL_COMPILER_SUPPORTS_MANIFEST) + SET(CMAKE_${lang}_LINK_EXECUTABLE + " -E vs_link_exe ${CMAKE_${lang}_LINK_EXECUTABLE}") + SET(CMAKE_${lang}_CREATE_SHARED_LIBRARY + " -E vs_link_dll ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}") + SET(CMAKE_${lang}_CREATE_SHARED_MODULE + " -E vs_link_dll ${CMAKE_${lang}_CREATE_SHARED_MODULE}") + endif() +endmacro() diff --git a/Modules/Platform/Windows-icl.cmake b/Modules/Platform/Windows-icl.cmake deleted file mode 100644 index 278a757..0000000 --- a/Modules/Platform/Windows-icl.cmake +++ /dev/null @@ -1,109 +0,0 @@ -SET(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") -SET(CMAKE_LINK_LIBRARY_FLAG "") -SET(WIN32 1) -IF(CMAKE_VERBOSE_MAKEFILE) - SET(CMAKE_CL_NOLOGO) -ELSE(CMAKE_VERBOSE_MAKEFILE) - SET(CMAKE_CL_NOLOGO "/nologo") -ENDIF(CMAKE_VERBOSE_MAKEFILE) - -SET(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1) -SET(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1) - -# create a shared C++ library -SET(CMAKE_CXX_CREATE_SHARED_LIBRARY - "xilink ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /implib: /pdb: /dll ${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) - -# create a C shared library -SET(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) - -# create a C shared module just copy the shared library rule -SET(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_C_CREATE_SHARED_LIBRARY}) - - -# create a C++ static library -SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "lib ${CMAKE_CL_NOLOGO} /out: ") - -# create a C static library -SET(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY}) - -# compile a C++ file into an object file -SET(CMAKE_CXX_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /TP -DWIN32 /Fo -c ${CMAKE_END_TEMP_FILE}") - -# compile a C file into an object file -SET(CMAKE_C_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} -DWIN32 /Fo -c ${CMAKE_END_TEMP_FILE}") - - -SET(CMAKE_C_LINK_EXECUTABLE - " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe -link /implib: ${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_C_CREATE_PREPROCESSED_SOURCE - " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} -E ${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE - " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /TP -E ${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_COMPILE_RESOURCE "rc /fo ") - -SET(CMAKE_CXX_LINK_EXECUTABLE - " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe -link /implib: ${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows) -SET(CMAKE_CREATE_CONSOLE_EXE /subsystem:console) - -# default to Debug builds -#SET(CMAKE_BUILD_TYPE_INIT Debug) -SET(CMAKE_BUILD_TYPE_INIT Release) -SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR") -SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Od /GZ") -SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/DNDEBUG /MD /O1") -SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/DNDEBUG /MD /O2") -SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/DNDEBUG /MD /Zi /O2") -SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") -SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Od /GZ") -SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/DNDEBUG /MD /O1") -SET (CMAKE_C_FLAGS_RELEASE_INIT "/DNDEBUG /MD /O2") -SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/DNDEBUG /MD /Zi /O2") - - -SET(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib") -SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") - -# executable linker flags -SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") -SET(_MACHINE_ARCH_FLAG ${MSVC_C_ARCHITECTURE_ID}) -IF(NOT _MACHINE_ARCH_FLAG) - SET(_MACHINE_ARCH_FLAG ${MSVC_CXX_ARCHITECTURE_ID}) -ENDIF(NOT _MACHINE_ARCH_FLAG) -SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /INCREMENTAL:YES /machine:${_MACHINE_ARCH_FLAG}") -SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug") -SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug") - -SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) - - -INCLUDE(Platform/Windows-Intel) - -IF(_INTEL_COMPILER_SUPPORTS_MANIFEST) - SET(CMAKE_C_LINK_EXECUTABLE - " -E vs_link_exe ${CMAKE_C_LINK_EXECUTABLE}") - SET(CMAKE_C_CREATE_SHARED_LIBRARY - " -E vs_link_dll ${CMAKE_C_CREATE_SHARED_LIBRARY}") - SET(CMAKE_C_CREATE_SHARED_MODULE - " -E vs_link_dll ${CMAKE_C_CREATE_SHARED_MODULE}") - SET(CMAKE_CXX_LINK_EXECUTABLE - " -E vs_link_exe ${CMAKE_CXX_LINK_EXECUTABLE}") - SET(CMAKE_CXX_CREATE_SHARED_LIBRARY - " -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_LIBRARY}") - SET(CMAKE_CXX_CREATE_SHARED_MODULE - " -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_MODULE}") -ENDIF(_INTEL_COMPILER_SUPPORTS_MANIFEST) diff --git a/Modules/Platform/Windows-ifort.cmake b/Modules/Platform/Windows-ifort.cmake deleted file mode 100644 index 1fd734e..0000000 --- a/Modules/Platform/Windows-ifort.cmake +++ /dev/null @@ -1,83 +0,0 @@ -SET(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") -SET(CMAKE_LINK_LIBRARY_FLAG "") -SET(WIN32 1) -IF(CMAKE_VERBOSE_MAKEFILE) - SET(CMAKE_CL_NOLOGO) -ELSE(CMAKE_VERBOSE_MAKEFILE) - SET(CMAKE_CL_NOLOGO "/nologo") -ENDIF(CMAKE_VERBOSE_MAKEFILE) - -SET(CMAKE_Fortran_MODDIR_FLAG "-module:") - -SET(CMAKE_Fortran_USE_RESPONSE_FILE_FOR_OBJECTS 1) - -SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY - "link ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /implib: /dll ${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_Fortran_CREATE_SHARED_MODULE ${CMAKE_Fortran_CREATE_SHARED_LIBRARY}) - -# create a C++ static library -SET(CMAKE_Fortran_CREATE_STATIC_LIBRARY "lib ${CMAKE_CL_NOLOGO} /out: ") - -# compile a C++ file into an object file -SET(CMAKE_Fortran_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /fpp /Fo -c ${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_COMPILE_RESOURCE "rc /fo ") - -SET(CMAKE_Fortran_LINK_EXECUTABLE - " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe -link /implib: ${CMAKE_END_TEMP_FILE}") - -INCLUDE(Platform/Windows-Intel) - -IF(_INTEL_COMPILER_SUPPORTS_MANIFEST) - SET(CMAKE_Fortran_LINK_EXECUTABLE - " -E vs_link_exe ${CMAKE_Fortran_LINK_EXECUTABLE}") - SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY - " -E vs_link_dll ${CMAKE_Fortran_CREATE_SHARED_LIBRARY}") - SET(CMAKE_Fortran_CREATE_SHARED_MODULE - " -E vs_link_dll ${CMAKE_Fortran_CREATE_SHARED_MODULE}") -ENDIF(_INTEL_COMPILER_SUPPORTS_MANIFEST) - -SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows) -SET(CMAKE_CREATE_CONSOLE_EXE /subsystem:console) - -IF(CMAKE_GENERATOR MATCHES "Visual Studio 6") - SET (CMAKE_NO_BUILD_TYPE 1) -ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6") -IF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visual Studio 8") - SET (CMAKE_NO_BUILD_TYPE 1) - SET (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING - "Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.") -ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visual Studio 8") -# does the compiler support pdbtype and is it the newer compiler - -SET(CMAKE_BUILD_TYPE_INIT Debug) -SET (CMAKE_Fortran_FLAGS_INIT "/W1 /nologo /fpp /libs:dll /threads") -SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full /dbglibs") -SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/O2 /D NDEBUG") -SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "/O1 /D NDEBUG") -SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/O1 /debug:full /D NDEBUG") - -SET (CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib") - -# executable linker flags -SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") -IF(NOT _MACHINE_ARCH_FLAG) - SET(_MACHINE_ARCH_FLAG ${MSVC_Fortran_ARCHITECTURE_ID}) -ENDIF(NOT _MACHINE_ARCH_FLAG) -SET (CMAKE_EXE_LINKER_FLAGS_INIT " /INCREMENTAL:YES /machine:${_MACHINE_ARCH_FLAG}") -IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) - SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept") - SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept") -ELSE (CMAKE_COMPILER_SUPPORTS_PDBTYPE) - SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug") - SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug") -ENDIF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) - -SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) -- cgit v0.12 From e8d380f90d3e93a18b04c184ad2fa81d2d24b350 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 16 Dec 2010 09:50:59 -0500 Subject: Remove unused old-style g++ info file Since commit aff31479 (Modernize GNU compiler info on Windows, 2009-12-02) the file Modules/Platform/Windows-g++.cmake has been unused. It just includes the non-existent Modules/Platform/Windows-gcc.cmake so remove it outright. --- Modules/Platform/Windows-g++.cmake | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Modules/Platform/Windows-g++.cmake diff --git a/Modules/Platform/Windows-g++.cmake b/Modules/Platform/Windows-g++.cmake deleted file mode 100644 index 3aa393c..0000000 --- a/Modules/Platform/Windows-g++.cmake +++ /dev/null @@ -1 +0,0 @@ -INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-gcc.cmake) -- cgit v0.12 From b3efdb58d5436276b65f1dad396265a6cc742910 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 16 Dec 2010 13:34:54 -0500 Subject: CheckCCompilerFlag: Strict signature of 'main' (#11615) Use "int main(void)" instead of just "int main()" so that compiling with "gcc -Werror=strict-prototypes" works. Test this check using the flags "-Werror -Wstrict-prototypes" to work with old GCC versions. --- Modules/CheckCCompilerFlag.cmake | 2 +- Tests/TryCompile/CMakeLists.txt | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake index cf519b1..a03b64d 100644 --- a/Modules/CheckCCompilerFlag.cmake +++ b/Modules/CheckCCompilerFlag.cmake @@ -25,7 +25,7 @@ INCLUDE(CheckCSourceCompiles) MACRO (CHECK_C_COMPILER_FLAG _FLAG _RESULT) SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") - CHECK_C_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT} + CHECK_C_SOURCE_COMPILES("int main(void) { return 0; }" ${_RESULT} # Some compilers do not fail with a bad flag FAIL_REGEX "unrecognized .*option" # GNU FAIL_REGEX "ignoring unknown option" # MSVC diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt index a57498f..90c2cfc 100644 --- a/Tests/TryCompile/CMakeLists.txt +++ b/Tests/TryCompile/CMakeLists.txt @@ -226,3 +226,9 @@ UNSET(CXX_BOGUS_FLAG CACHE) INCLUDE(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG(${CXX_DD}-_this_is_not_a_flag_ CXX_BOGUS_FLAG) TEST_FAIL(CXX_BOGUS_FLAG "CHECK_CXX_COMPILER_FLAG() succeeded, but should have failed") + +IF("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") + UNSET(C_STRICT_PROTOTYPES CACHE) + CHECK_C_COMPILER_FLAG("-Werror;-Wstrict-prototypes" C_STRICT_PROTOTYPES) + TEST_ASSERT(C_STRICT_PROTOTYPES "CHECK_C_COMPILER_FLAG failed -Werror -Wstrict-prototypes") +ENDIF() -- cgit v0.12 From c5cbb318c5bc9c5bf0d5decb7c05b44853180cc0 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 16 Dec 2010 14:58:05 -0500 Subject: Ignore strerror_r since CMake isn't threaded --- Utilities/cmcurl/CMakeLists.txt | 43 ----------------------------------------- 1 file changed, 43 deletions(-) diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index 0f98e5a..454d2d1 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -521,42 +521,6 @@ MACRO(CURL_INTERNAL_TEST CURL_TEST) ENDIF("${CURL_TEST}" MATCHES "^${CURL_TEST}$") ENDMACRO(CURL_INTERNAL_TEST) -MACRO(CURL_INTERNAL_TEST_RUN CURL_TEST) - IF("${CURL_TEST}_COMPILE" MATCHES "^${CURL_TEST}_COMPILE$") - SET(MACRO_CHECK_FUNCTION_DEFINITIONS - "-D${CURL_TEST} ${CMAKE_REQUIRED_FLAGS}") - IF(CMAKE_REQUIRED_LIBRARIES) - SET(CURL_TEST_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - ENDIF(CMAKE_REQUIRED_LIBRARIES) - - MESSAGE(STATUS "Performing Curl Test ${CURL_TEST}") - TRY_RUN(${CURL_TEST} ${CURL_TEST}_COMPILE - ${CMAKE_BINARY_DIR} - ${LIBCURL_SOURCE_DIR}/CMake/CurlTests.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} - "${CURL_TEST_ADD_LIBRARIES}" - OUTPUT_VARIABLE OUTPUT) - IF(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST}) - SET(${CURL_TEST} 1 CACHE INTERNAL "Curl test ${FUNCTION}") - MESSAGE(STATUS "Performing Curl Test ${CURL_TEST} - Success") - ELSE(${CURL_TEST}_COMPILE AND NOT ${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" - "Performing Curl Test ${CURL_TEST} failed with the following output:\n" - "${OUTPUT}") - IF(${CURL_TEST}_COMPILE) - FILE(APPEND - "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" - "There was a running problem of this test\n") - ENDIF(${CURL_TEST}_COMPILE) - FILE(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" - "\n\n") - ENDIF(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST}) - ENDIF("${CURL_TEST}_COMPILE" MATCHES "^${CURL_TEST}_COMPILE$") -ENDMACRO(CURL_INTERNAL_TEST_RUN) - # Do curl specific tests #OPTION(CURL_HAVE_DISABLED_NONBLOCKING "Disable non-blocking socket detection" OFF) SET(CURL_NONBLOCKING_TESTS) @@ -599,13 +563,6 @@ IF(HAVE_FILE_OFFSET_BITS) SET(_FILE_OFFSET_BITS 64) ENDIF(HAVE_FILE_OFFSET_BITS) -FOREACH(CURL_TEST - HAVE_GLIBC_STRERROR_R - HAVE_POSIX_STRERROR_R - ) - CURL_INTERNAL_TEST_RUN(${CURL_TEST}) -ENDFOREACH(CURL_TEST) - # Check for reentrant FOREACH(CURL_TEST HAVE_GETHOSTBYADDR_R_5 -- cgit v0.12 From 8d3689072394e6410c766eac9a8b0cae598f6500 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 16 Dec 2010 14:59:05 -0500 Subject: Use _POLL_EMUL_H_ instead of HAVE_POLL_FINE Headers define _POLL_EMUL_H_ if they are not in the kernel, so a try_run check for them is not necessary. --- Utilities/cmcurl/CMake/OtherTests.cmake | 8 -------- Utilities/cmcurl/config.h.in | 3 --- Utilities/cmcurl/select.c | 6 +++--- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/Utilities/cmcurl/CMake/OtherTests.cmake b/Utilities/cmcurl/CMake/OtherTests.cmake index ea1613d..7d2c66f 100644 --- a/Utilities/cmcurl/CMake/OtherTests.cmake +++ b/Utilities/cmcurl/CMake/OtherTests.cmake @@ -193,14 +193,6 @@ SET(EXTRA_DEFINES "${EXTRA_DEFINES}\n${headers_hack}\n#define __unused5") CURL_CHECK_C_SOURCE_COMPILES("struct timeval ts;\nts.tv_sec = 0;\nts.tv_usec = 0" HAVE_STRUCT_TIMEVAL) -INCLUDE(CurlCheckCSourceRuns) -SET(EXTRA_DEFINES) -SET(HEADER_INCLUDES) -IF(HAVE_SYS_POLL_H) - SET(HEADER_INCLUDES "sys/poll.h") -ENDIF(HAVE_SYS_POLL_H) -CURL_CHECK_C_SOURCE_RUNS("return poll((void *)0, 0, 10 /*ms*/)" HAVE_POLL_FINE) - SET(HAVE_SIG_ATOMIC_T 1) SET(EXTRA_DEFINES) SET(HEADER_INCLUDES) diff --git a/Utilities/cmcurl/config.h.in b/Utilities/cmcurl/config.h.in index e3efdc1..72a1cd4 100644 --- a/Utilities/cmcurl/config.h.in +++ b/Utilities/cmcurl/config.h.in @@ -348,9 +348,6 @@ /* Define to 1 if you have the `poll' function. */ #cmakedefine HAVE_POLL ${HAVE_POLL} -/* If you have a fine poll */ -#cmakedefine HAVE_POLL_FINE ${HAVE_POLL_FINE} - /* we have a POSIX-style strerror_r() */ #cmakedefine HAVE_POSIX_STRERROR_R ${HAVE_POSIX_STRERROR_R} diff --git a/Utilities/cmcurl/select.c b/Utilities/cmcurl/select.c index d3967ed..3656edd 100644 --- a/Utilities/cmcurl/select.c +++ b/Utilities/cmcurl/select.c @@ -78,7 +78,7 @@ */ int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms) { -#if defined(HAVE_POLL_FINE) || defined(CURL_HAVE_WSAPOLL) +#if !defined(_POLL_EMUL_H_) || defined(CURL_HAVE_WSAPOLL) struct pollfd pfd[2]; int num; int r; @@ -96,7 +96,7 @@ int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms) num++; } -#ifdef HAVE_POLL_FINE +#ifndef _POLL_EMUL_H_ do { r = poll(pfd, num, timeout_ms); } while((r == -1) && (errno == EINTR)); @@ -220,7 +220,7 @@ int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms) int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms) { int r; -#ifdef HAVE_POLL_FINE +#ifndef _POLL_EMUL_H_ do { r = poll(ufds, nfds, timeout_ms); } while((r == -1) && (errno == EINTR)); -- cgit v0.12 From 26cc29a8e284cbfc04bc30942edeb10ecbf7a158 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 16 Dec 2010 15:49:32 -0500 Subject: Warn in find(GLOB) docs about bad use case (#11617) The first instinct of a lot of users is to use file(GLOB) to assemble lists of sources. Add a warning to the help text stating that it should not be used for this purpose and briefly explain why. Suggested-By: Ryan Pavlik --- Source/cmFileCommand.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index e771092..b11dcde 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -116,7 +116,12 @@ public: "expressions and store it into the variable. Globbing expressions " "are similar to regular expressions, but much simpler. If RELATIVE " "flag is specified for an expression, the results will be returned " - "as a relative path to the given path.\n" + "as a relative path to the given path. " + "(We do not recommend using GLOB to collect a list of source files " + "from your source tree. If no CMakeLists.txt file changes when a " + "source is added or removed then the generated build system cannot " + "know when to ask CMake to regenerate.)" + "\n" "Examples of globbing expressions include:\n" " *.cxx - match all files with extension cxx\n" " *.vt? - match all files with extension vta,...,vtz\n" -- cgit v0.12 From d95f817f77378021a067f9f2b4f286a12acb6cd8 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Tue, 26 Oct 2010 12:06:15 +0200 Subject: Add the WORKING_DIRECTORY property to tests --- Source/CTest/cmCTestTestHandler.cxx | 5 +++- Source/cmTest.cxx | 6 ++++ Tests/CMakeLists.txt | 13 ++++++++ Tests/WorkingDirectory/CMakeLists.txt | 29 ++++++++++++++++++ Tests/WorkingDirectory/main.cxx | 56 +++++++++++++++++++++++++++++++++++ 5 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 Tests/WorkingDirectory/CMakeLists.txt create mode 100644 Tests/WorkingDirectory/main.cxx diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 6dd348d..b8e38fb 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -2190,7 +2190,6 @@ bool cmCTestTestHandler::SetTestsProperties( { rtit->Labels.push_back(*crit); } - } if ( key == "MEASUREMENT" ) { @@ -2219,6 +2218,10 @@ bool cmCTestTestHandler::SetTestsProperties( std::string(crit->c_str()))); } } + if ( key == "WORKING_DIRECTORY" ) + { + rtit->Directory = val; + } } } } diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx index 4e9b973..c25a8b6 100644 --- a/Source/cmTest.cxx +++ b/Source/cmTest.cxx @@ -196,4 +196,10 @@ void cmTest::DefineProperties(cmake *cm) "If set to true, this will invert the pass/fail flag of the test.", "This property can be used for tests that are expected to fail and " "return a non zero return code."); + + cm->DefineProperty + ("WORKING_DIRECTORY", cmProperty::TEST, + "The directory from which the test executable will be called.", + "If this is not set it is called from the directory the test executable " + "is located in."); } diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 04f0774..8c89be5 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1084,6 +1084,19 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleGeneratorTest") ENDIF(APPLE AND CTEST_TEST_CPACK) + ADD_TEST(WorkingDirectory ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/WorkingDirectory" + "${CMake_BINARY_DIR}/Tests/WorkingDirectory" + --build-generator ${CMAKE_TEST_GENERATOR} + --build-project WorkingDirectoryProj + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --build-exe-dir "${CMake_BINARY_DIR}/Tests/WorkingDirectory" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) + LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WorkingDirectory") + # Make sure CTest can handle a test with no newline in output. ADD_TEST(CTest.NoNewline ${CMAKE_CMAKE_COMMAND} -E echo_append "This line has no newline!") diff --git a/Tests/WorkingDirectory/CMakeLists.txt b/Tests/WorkingDirectory/CMakeLists.txt new file mode 100644 index 0000000..5fbcd2a --- /dev/null +++ b/Tests/WorkingDirectory/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 2.6) +project(WorkingDirectoryProj) + +add_executable(WorkingDirectory main.cxx) + +enable_testing() + +add_test(NAME WorkingDirectory1 COMMAND WorkingDirectory) +add_test(NAME WorkingDirectory2 COMMAND WorkingDirectory) +add_test(WorkingDirectory3 WorkingDirectory) + +set_tests_properties(WorkingDirectory1 PROPERTIES + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + PASS_REGULAR_EXPRESSION "Working directory: ${CMAKE_BINARY_DIR}" +) + +string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_BINARY_DIR}") + +set_tests_properties(WorkingDirectory2 PROPERTIES + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/.." + PASS_REGULAR_EXPRESSION "Working directory: ${_parent_dir}" +) + +string(REGEX REPLACE "/[^/]*$" "" _wd_exe "${CMAKE_BINARY_DIR}") +get_filename_component(_default_cwd "${_wd_exe}" ABSOLUTE) + +set_tests_properties(WorkingDirectory3 PROPERTIES + PASS_REGULAR_EXPRESSION "Working directory: ${_default_cwd}" +) diff --git a/Tests/WorkingDirectory/main.cxx b/Tests/WorkingDirectory/main.cxx new file mode 100644 index 0000000..6636da0 --- /dev/null +++ b/Tests/WorkingDirectory/main.cxx @@ -0,0 +1,56 @@ +#include +#include + +#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__)) + +#include +#include + +#if defined(__WATCOMC__) +#include +#define _getcwd getcwd +#endif + +inline const char* Getcwd(char* buf, unsigned int len) +{ + const char* ret = _getcwd(buf, len); + if(!ret) + { + fprintf(stderr, "No current working directory.\n"); + abort(); + } + // make sure the drive letter is capital + if(strlen(buf) > 1 && buf[1] == ':') + { + buf[0] = toupper(buf[0]); + } + return ret; +} + +#else +#include +#include +#include + +inline const char* Getcwd(char* buf, unsigned int len) +{ + const char* ret = getcwd(buf, len); + if(!ret) + { + fprintf(stderr, "No current working directory\n"); + abort(); + } + return ret; +} + +#endif + +int main(int argc, char *argv[]) +{ + char buf[2048]; + const char *cwd = Getcwd(buf, sizeof(buf)); + + fprintf(stdout, "Working directory: %s\n", cwd); + + return 0; +} -- cgit v0.12 From 7679f9fab099e729b61320927a9e0b8d03546f7f Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 16 Dec 2010 16:50:16 -0500 Subject: Rename WorkingDirectory test --- Tests/CMakeLists.txt | 12 +++---- Tests/TestsWorkingDirectory/CMakeLists.txt | 29 ++++++++++++++++ Tests/TestsWorkingDirectory/main.cxx | 56 ++++++++++++++++++++++++++++++ Tests/WorkingDirectory/CMakeLists.txt | 29 ---------------- Tests/WorkingDirectory/main.cxx | 56 ------------------------------ 5 files changed, 91 insertions(+), 91 deletions(-) create mode 100644 Tests/TestsWorkingDirectory/CMakeLists.txt create mode 100644 Tests/TestsWorkingDirectory/main.cxx delete mode 100644 Tests/WorkingDirectory/CMakeLists.txt delete mode 100644 Tests/WorkingDirectory/main.cxx diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 8c89be5..0e1edfc 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1084,18 +1084,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleGeneratorTest") ENDIF(APPLE AND CTEST_TEST_CPACK) - ADD_TEST(WorkingDirectory ${CMAKE_CTEST_COMMAND} + ADD_TEST(TestsWorkingDirectory ${CMAKE_CTEST_COMMAND} --build-and-test - "${CMake_SOURCE_DIR}/Tests/WorkingDirectory" - "${CMake_BINARY_DIR}/Tests/WorkingDirectory" + "${CMake_SOURCE_DIR}/Tests/TestsWorkingDirectory" + "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory" --build-generator ${CMAKE_TEST_GENERATOR} - --build-project WorkingDirectoryProj + --build-project TestsWorkingDirectoryProj --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} - --build-exe-dir "${CMake_BINARY_DIR}/Tests/WorkingDirectory" + --build-exe-dir "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory" --force-new-ctest-process --test-command ${CMAKE_CTEST_COMMAND} -V ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WorkingDirectory") + LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory") # Make sure CTest can handle a test with no newline in output. ADD_TEST(CTest.NoNewline diff --git a/Tests/TestsWorkingDirectory/CMakeLists.txt b/Tests/TestsWorkingDirectory/CMakeLists.txt new file mode 100644 index 0000000..5fbcd2a --- /dev/null +++ b/Tests/TestsWorkingDirectory/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 2.6) +project(WorkingDirectoryProj) + +add_executable(WorkingDirectory main.cxx) + +enable_testing() + +add_test(NAME WorkingDirectory1 COMMAND WorkingDirectory) +add_test(NAME WorkingDirectory2 COMMAND WorkingDirectory) +add_test(WorkingDirectory3 WorkingDirectory) + +set_tests_properties(WorkingDirectory1 PROPERTIES + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + PASS_REGULAR_EXPRESSION "Working directory: ${CMAKE_BINARY_DIR}" +) + +string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_BINARY_DIR}") + +set_tests_properties(WorkingDirectory2 PROPERTIES + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/.." + PASS_REGULAR_EXPRESSION "Working directory: ${_parent_dir}" +) + +string(REGEX REPLACE "/[^/]*$" "" _wd_exe "${CMAKE_BINARY_DIR}") +get_filename_component(_default_cwd "${_wd_exe}" ABSOLUTE) + +set_tests_properties(WorkingDirectory3 PROPERTIES + PASS_REGULAR_EXPRESSION "Working directory: ${_default_cwd}" +) diff --git a/Tests/TestsWorkingDirectory/main.cxx b/Tests/TestsWorkingDirectory/main.cxx new file mode 100644 index 0000000..6636da0 --- /dev/null +++ b/Tests/TestsWorkingDirectory/main.cxx @@ -0,0 +1,56 @@ +#include +#include + +#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__)) + +#include +#include + +#if defined(__WATCOMC__) +#include +#define _getcwd getcwd +#endif + +inline const char* Getcwd(char* buf, unsigned int len) +{ + const char* ret = _getcwd(buf, len); + if(!ret) + { + fprintf(stderr, "No current working directory.\n"); + abort(); + } + // make sure the drive letter is capital + if(strlen(buf) > 1 && buf[1] == ':') + { + buf[0] = toupper(buf[0]); + } + return ret; +} + +#else +#include +#include +#include + +inline const char* Getcwd(char* buf, unsigned int len) +{ + const char* ret = getcwd(buf, len); + if(!ret) + { + fprintf(stderr, "No current working directory\n"); + abort(); + } + return ret; +} + +#endif + +int main(int argc, char *argv[]) +{ + char buf[2048]; + const char *cwd = Getcwd(buf, sizeof(buf)); + + fprintf(stdout, "Working directory: %s\n", cwd); + + return 0; +} diff --git a/Tests/WorkingDirectory/CMakeLists.txt b/Tests/WorkingDirectory/CMakeLists.txt deleted file mode 100644 index 5fbcd2a..0000000 --- a/Tests/WorkingDirectory/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -cmake_minimum_required(VERSION 2.6) -project(WorkingDirectoryProj) - -add_executable(WorkingDirectory main.cxx) - -enable_testing() - -add_test(NAME WorkingDirectory1 COMMAND WorkingDirectory) -add_test(NAME WorkingDirectory2 COMMAND WorkingDirectory) -add_test(WorkingDirectory3 WorkingDirectory) - -set_tests_properties(WorkingDirectory1 PROPERTIES - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" - PASS_REGULAR_EXPRESSION "Working directory: ${CMAKE_BINARY_DIR}" -) - -string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_BINARY_DIR}") - -set_tests_properties(WorkingDirectory2 PROPERTIES - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/.." - PASS_REGULAR_EXPRESSION "Working directory: ${_parent_dir}" -) - -string(REGEX REPLACE "/[^/]*$" "" _wd_exe "${CMAKE_BINARY_DIR}") -get_filename_component(_default_cwd "${_wd_exe}" ABSOLUTE) - -set_tests_properties(WorkingDirectory3 PROPERTIES - PASS_REGULAR_EXPRESSION "Working directory: ${_default_cwd}" -) diff --git a/Tests/WorkingDirectory/main.cxx b/Tests/WorkingDirectory/main.cxx deleted file mode 100644 index 6636da0..0000000 --- a/Tests/WorkingDirectory/main.cxx +++ /dev/null @@ -1,56 +0,0 @@ -#include -#include - -#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__)) - -#include -#include - -#if defined(__WATCOMC__) -#include -#define _getcwd getcwd -#endif - -inline const char* Getcwd(char* buf, unsigned int len) -{ - const char* ret = _getcwd(buf, len); - if(!ret) - { - fprintf(stderr, "No current working directory.\n"); - abort(); - } - // make sure the drive letter is capital - if(strlen(buf) > 1 && buf[1] == ':') - { - buf[0] = toupper(buf[0]); - } - return ret; -} - -#else -#include -#include -#include - -inline const char* Getcwd(char* buf, unsigned int len) -{ - const char* ret = getcwd(buf, len); - if(!ret) - { - fprintf(stderr, "No current working directory\n"); - abort(); - } - return ret; -} - -#endif - -int main(int argc, char *argv[]) -{ - char buf[2048]; - const char *cwd = Getcwd(buf, sizeof(buf)); - - fprintf(stdout, "Working directory: %s\n", cwd); - - return 0; -} -- cgit v0.12 From 42de5d02dddec69ee045b423fbd58751f210839d Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 16 Dec 2010 16:48:27 -0500 Subject: Add WORKING_DIRECTORY argument to add_test --- Source/cmAddTestCommand.cxx | 17 +++++++++++++++++ Source/cmAddTestCommand.h | 3 +++ 2 files changed, 20 insertions(+) diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx index 923206d..11ca9e7 100644 --- a/Source/cmAddTestCommand.cxx +++ b/Source/cmAddTestCommand.cxx @@ -74,6 +74,7 @@ bool cmAddTestCommand::HandleNameMode(std::vector const& args) { std::string name; std::vector configurations; + std::string working_directory; std::vector command; // Read the arguments. @@ -81,6 +82,7 @@ bool cmAddTestCommand::HandleNameMode(std::vector const& args) DoingName, DoingCommand, DoingConfigs, + DoingWorkingDirectory, DoingNone }; Doing doing = DoingName; @@ -104,6 +106,15 @@ bool cmAddTestCommand::HandleNameMode(std::vector const& args) } doing = DoingConfigs; } + else if(args[i] == "WORKING_DIRECTORY") + { + if(!working_directory.empty()) + { + this->SetError(" may be given at most one WORKING_DIRECTORY."); + return false; + } + doing = DoingWorkingDirectory; + } else if(doing == DoingName) { name = args[i]; @@ -117,6 +128,11 @@ bool cmAddTestCommand::HandleNameMode(std::vector const& args) { configurations.push_back(args[i]); } + else if(doing == DoingWorkingDirectory) + { + working_directory = args[i]; + doing = DoingNone; + } else { cmOStringStream e; @@ -154,6 +170,7 @@ bool cmAddTestCommand::HandleNameMode(std::vector const& args) cmTest* test = this->Makefile->CreateTest(name.c_str()); test->SetOldStyle(false); test->SetCommand(command); + test->SetProperty("WORKING_DIRECTORY", working_directory.c_str()); this->Makefile->AddTestGenerator(new cmTestGenerator(test, configurations)); return true; diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h index 79fb481..9eb4e9f 100644 --- a/Source/cmAddTestCommand.h +++ b/Source/cmAddTestCommand.h @@ -68,12 +68,15 @@ public: "in the binary tree.\n" "\n" " add_test(NAME [CONFIGURATIONS [Debug|Release|...]]\n" + " [WORKING_DIRECTORY dir]\n" " COMMAND [arg1 [arg2 ...]])\n" "If COMMAND specifies an executable target (created by " "add_executable) it will automatically be replaced by the location " "of the executable created at build time. " "If a CONFIGURATIONS option is given then the test will be executed " "only when testing under one of the named configurations." + "If a WORKING_DIRECTORY option is given then the test will be executed " + "in the given directory." "\n" "Arguments after COMMAND may use \"generator expressions\" with the " "syntax \"$<...>\". " -- cgit v0.12 From 9bf4165437ed3ba4480b39cc9000f08f86fbe186 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 16 Dec 2010 16:50:34 -0500 Subject: Add tests for WORKING_DIRECTORY arg to add_test --- Tests/TestsWorkingDirectory/CMakeLists.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Tests/TestsWorkingDirectory/CMakeLists.txt b/Tests/TestsWorkingDirectory/CMakeLists.txt index 5fbcd2a..d5c786b 100644 --- a/Tests/TestsWorkingDirectory/CMakeLists.txt +++ b/Tests/TestsWorkingDirectory/CMakeLists.txt @@ -27,3 +27,24 @@ get_filename_component(_default_cwd "${_wd_exe}" ABSOLUTE) set_tests_properties(WorkingDirectory3 PROPERTIES PASS_REGULAR_EXPRESSION "Working directory: ${_default_cwd}" ) + +add_test(NAME WorkingDirectory4 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMAND WorkingDirectory) +add_test(NAME WorkingDirectory5 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/.. COMMAND WorkingDirectory) +add_test(WorkingDirectory6 WorkingDirectory WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/..) + +set_tests_properties(WorkingDirectory4 PROPERTIES + PASS_REGULAR_EXPRESSION "Working directory: ${CMAKE_BINARY_DIR}" +) + +string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_BINARY_DIR}") + +set_tests_properties(WorkingDirectory5 PROPERTIES + PASS_REGULAR_EXPRESSION "Working directory: ${_parent_dir}" +) + +string(REGEX REPLACE "/[^/]*$" "" _wd_exe "${CMAKE_BINARY_DIR}") +get_filename_component(_default_cwd "${_wd_exe}" ABSOLUTE) + +set_tests_properties(WorkingDirectory6 PROPERTIES + PASS_REGULAR_EXPRESSION "Working directory: ${_default_cwd}" +) -- cgit v0.12 From 5597aa24f1e4c00aab39d1dd3a8d3d9ff0a8f582 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 16 Dec 2010 17:29:19 -0500 Subject: Rename the project to match the test --- Tests/TestsWorkingDirectory/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/TestsWorkingDirectory/CMakeLists.txt b/Tests/TestsWorkingDirectory/CMakeLists.txt index d5c786b..73b8997 100644 --- a/Tests/TestsWorkingDirectory/CMakeLists.txt +++ b/Tests/TestsWorkingDirectory/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 2.6) -project(WorkingDirectoryProj) +project(TestsWorkingDirectoryProj) add_executable(WorkingDirectory main.cxx) -- cgit v0.12 From b97760fa5212d34f6bd371bc8841f2bfb5e8b124 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 16 Dec 2010 17:41:27 -0500 Subject: Remove call to SystemTools::GetMaximumFilePathLength The KWSys SystemTools::GetMaximumFilePathLength method is poorly conceived and should not be used. The cmDepends code honors its own MaxPath buffer size. Just hard-code it. --- Source/cmDepends.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 69ff858..19558fa 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -25,7 +25,7 @@ cmDepends::cmDepends(cmLocalGenerator* lg, const char* targetDir): Verbose(false), FileComparison(0), TargetDirectory(targetDir), - MaxPath(cmSystemTools::GetMaximumFilePathLength()), + MaxPath(16384), Dependee(new char[MaxPath]), Depender(new char[MaxPath]) { -- cgit v0.12 From f7d525e3a679d6fef40e3b5f9345201a85362f44 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 17 Dec 2010 08:41:32 -0500 Subject: Xcode: Generate native 3.2 projects Set objectVersion = 46; compatibilityVersion = "Xcode 3.2" when Xcode 3.2 is detected. --- Source/cmGlobalXCodeGenerator.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 29c2d06..cc6c686 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2636,7 +2636,10 @@ void cmGlobalXCodeGenerator group->AddAttribute("BuildIndependentTargetsInParallel", this->CreateString("YES")); this->RootObject->AddAttribute("attributes", group); - if (this->XcodeVersion >= 31) + if (this->XcodeVersion >= 32) + this->RootObject->AddAttribute("compatibilityVersion", + this->CreateString("Xcode 3.2")); + else if (this->XcodeVersion >= 31) this->RootObject->AddAttribute("compatibilityVersion", this->CreateString("Xcode 3.1")); else @@ -3042,7 +3045,9 @@ cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout, cmXCodeObject::Indent(1, fout); if(this->XcodeVersion >= 21) { - if (this->XcodeVersion >= 31) + if (this->XcodeVersion >= 32) + fout << "objectVersion = 46;\n"; + else if (this->XcodeVersion >= 31) fout << "objectVersion = 45;\n"; else if (this->XcodeVersion >= 30) fout << "objectVersion = 44;\n"; -- cgit v0.12 From af12f83d80412141117a0e84614a06af9bae68ae Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 17 Dec 2010 09:14:25 -0500 Subject: Fix header includes for C++ and Visual Studio --- Tests/TestsWorkingDirectory/main.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Tests/TestsWorkingDirectory/main.cxx b/Tests/TestsWorkingDirectory/main.cxx index 6636da0..eacd7ee 100644 --- a/Tests/TestsWorkingDirectory/main.cxx +++ b/Tests/TestsWorkingDirectory/main.cxx @@ -1,5 +1,6 @@ -#include -#include +#include +#include +#include #if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__)) -- cgit v0.12 From 0a014dab5c9566b63783986d98f398efb2fadcb8 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 17 Dec 2010 09:23:59 -0500 Subject: Add ctype.h include for toupper() --- Tests/TestsWorkingDirectory/main.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/Tests/TestsWorkingDirectory/main.cxx b/Tests/TestsWorkingDirectory/main.cxx index eacd7ee..6c4802d 100644 --- a/Tests/TestsWorkingDirectory/main.cxx +++ b/Tests/TestsWorkingDirectory/main.cxx @@ -1,6 +1,7 @@ #include #include #include +#include #if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__)) -- cgit v0.12 From a6cb1d46535b083a74be6c6517acf343294105a7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 17 Dec 2010 09:39:30 -0500 Subject: Declare min CMake version in --system-information project The --system-information flag's project triggered a CMP0000 warning because the CMakeLists.txt it generates needs cmake_minimum_required. --- Modules/SystemInformation.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modules/SystemInformation.cmake b/Modules/SystemInformation.cmake index d973e90f..d4f2233 100644 --- a/Modules/SystemInformation.cmake +++ b/Modules/SystemInformation.cmake @@ -1,6 +1,6 @@ #============================================================================= -# Copyright 2007-2009 Kitware, Inc. +# Copyright 2007-2010 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -12,6 +12,7 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +CMAKE_MINIMUM_REQUIRED(VERSION ${CMAKE_VERSION}) PROJECT(DumpInformation) # first get the standard information for th platform -- cgit v0.12 From 5249551f9fd11016fffae0cb44581ae3daa2169c Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 17 Dec 2010 09:45:39 -0500 Subject: Flip slashes around on Windows --- Tests/TestsWorkingDirectory/main.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Tests/TestsWorkingDirectory/main.cxx b/Tests/TestsWorkingDirectory/main.cxx index 6c4802d..e1c24ba 100644 --- a/Tests/TestsWorkingDirectory/main.cxx +++ b/Tests/TestsWorkingDirectory/main.cxx @@ -26,6 +26,13 @@ inline const char* Getcwd(char* buf, unsigned int len) { buf[0] = toupper(buf[0]); } + for(char* p = buf; *p; ++p) + { + if(*p == '\\') + { + *p = '/'; + } + } return ret; } -- cgit v0.12 From d89e238e6c4b22fe3fde0f8e1e7987fb05f13aeb Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 17 Dec 2010 09:46:24 -0500 Subject: Cygwin: Fix tests to check CYGWIN instead of WIN32 Use "UNIX AND NOT CYGWIN" to detect a "soname" platform. Use "WIN32 OR CYGWIN" to detect a "DLL" platform. --- Tests/Jump/Library/Shared/CMakeLists.txt | 4 ++-- Tests/Testing/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/Jump/Library/Shared/CMakeLists.txt b/Tests/Jump/Library/Shared/CMakeLists.txt index 46d4d36..4440577 100644 --- a/Tests/Jump/Library/Shared/CMakeLists.txt +++ b/Tests/Jump/Library/Shared/CMakeLists.txt @@ -1,8 +1,8 @@ ADD_LIBRARY(jumpShared SHARED jumpShared.cxx) -IF(WIN32) +IF(WIN32 OR CYGWIN) SET(SHARED_MUST_BE_IN_EXE_DIR 1) -ENDIF(WIN32) +ENDIF() IF(APPLE) SET(SHARED_MUST_BE_IN_EXE_DIR 1) diff --git a/Tests/Testing/CMakeLists.txt b/Tests/Testing/CMakeLists.txt index f857407..9e7a637 100644 --- a/Tests/Testing/CMakeLists.txt +++ b/Tests/Testing/CMakeLists.txt @@ -62,7 +62,7 @@ SET_PROPERTY(TARGET pcShared PROPERTY RELEASE_POSTFIX -opt) SET_PROPERTY(TARGET pcShared PROPERTY DEBUG_POSTFIX -dbg) SET_PROPERTY(TARGET pcShared PROPERTY VERSION 1.2) SET_PROPERTY(TARGET pcShared PROPERTY SOVERSION 3) -IF(NOT WIN32) +IF(UNIX AND NOT CYGWIN) SET(soname_file -DpcShared_soname_file=$) ENDIF() ADD_EXECUTABLE(perconfig perconfig.c) -- cgit v0.12 From 992c74f3e0747e806c3fc7708fea68cb2c376247 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 17 Dec 2010 10:23:24 -0500 Subject: Use --><-- markers to denote the path --- Tests/TestsWorkingDirectory/CMakeLists.txt | 12 ++++++------ Tests/TestsWorkingDirectory/main.cxx | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Tests/TestsWorkingDirectory/CMakeLists.txt b/Tests/TestsWorkingDirectory/CMakeLists.txt index 73b8997..c0e780c 100644 --- a/Tests/TestsWorkingDirectory/CMakeLists.txt +++ b/Tests/TestsWorkingDirectory/CMakeLists.txt @@ -11,21 +11,21 @@ add_test(WorkingDirectory3 WorkingDirectory) set_tests_properties(WorkingDirectory1 PROPERTIES WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" - PASS_REGULAR_EXPRESSION "Working directory: ${CMAKE_BINARY_DIR}" + PASS_REGULAR_EXPRESSION "Working directory: -->${CMAKE_BINARY_DIR}<--" ) string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_BINARY_DIR}") set_tests_properties(WorkingDirectory2 PROPERTIES WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/.." - PASS_REGULAR_EXPRESSION "Working directory: ${_parent_dir}" + PASS_REGULAR_EXPRESSION "Working directory: -->${_parent_dir}<--" ) string(REGEX REPLACE "/[^/]*$" "" _wd_exe "${CMAKE_BINARY_DIR}") get_filename_component(_default_cwd "${_wd_exe}" ABSOLUTE) set_tests_properties(WorkingDirectory3 PROPERTIES - PASS_REGULAR_EXPRESSION "Working directory: ${_default_cwd}" + PASS_REGULAR_EXPRESSION "Working directory: -->${_default_cwd}<--" ) add_test(NAME WorkingDirectory4 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMAND WorkingDirectory) @@ -33,18 +33,18 @@ add_test(NAME WorkingDirectory5 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/.. COMMAND add_test(WorkingDirectory6 WorkingDirectory WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/..) set_tests_properties(WorkingDirectory4 PROPERTIES - PASS_REGULAR_EXPRESSION "Working directory: ${CMAKE_BINARY_DIR}" + PASS_REGULAR_EXPRESSION "Working directory: -->${CMAKE_BINARY_DIR}<--" ) string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_BINARY_DIR}") set_tests_properties(WorkingDirectory5 PROPERTIES - PASS_REGULAR_EXPRESSION "Working directory: ${_parent_dir}" + PASS_REGULAR_EXPRESSION "Working directory: -->${_parent_dir}<--" ) string(REGEX REPLACE "/[^/]*$" "" _wd_exe "${CMAKE_BINARY_DIR}") get_filename_component(_default_cwd "${_wd_exe}" ABSOLUTE) set_tests_properties(WorkingDirectory6 PROPERTIES - PASS_REGULAR_EXPRESSION "Working directory: ${_default_cwd}" + PASS_REGULAR_EXPRESSION "Working directory: -->${_default_cwd}<--" ) diff --git a/Tests/TestsWorkingDirectory/main.cxx b/Tests/TestsWorkingDirectory/main.cxx index e1c24ba..6a3a6be 100644 --- a/Tests/TestsWorkingDirectory/main.cxx +++ b/Tests/TestsWorkingDirectory/main.cxx @@ -59,7 +59,7 @@ int main(int argc, char *argv[]) char buf[2048]; const char *cwd = Getcwd(buf, sizeof(buf)); - fprintf(stdout, "Working directory: %s\n", cwd); + fprintf(stdout, "Working directory: -->%s<--", cwd); return 0; } -- cgit v0.12 From d87bae7f742e5ea4d99dfd3691b6de335c6c0758 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 17 Dec 2010 10:23:54 -0500 Subject: Simplify the _default_cwd derivation --- Tests/TestsWorkingDirectory/CMakeLists.txt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Tests/TestsWorkingDirectory/CMakeLists.txt b/Tests/TestsWorkingDirectory/CMakeLists.txt index c0e780c..d1c40d6 100644 --- a/Tests/TestsWorkingDirectory/CMakeLists.txt +++ b/Tests/TestsWorkingDirectory/CMakeLists.txt @@ -5,6 +5,8 @@ add_executable(WorkingDirectory main.cxx) enable_testing() +set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin") + add_test(NAME WorkingDirectory1 COMMAND WorkingDirectory) add_test(NAME WorkingDirectory2 COMMAND WorkingDirectory) add_test(WorkingDirectory3 WorkingDirectory) @@ -21,8 +23,7 @@ set_tests_properties(WorkingDirectory2 PROPERTIES PASS_REGULAR_EXPRESSION "Working directory: -->${_parent_dir}<--" ) -string(REGEX REPLACE "/[^/]*$" "" _wd_exe "${CMAKE_BINARY_DIR}") -get_filename_component(_default_cwd "${_wd_exe}" ABSOLUTE) +get_filename_component(_default_cwd "${EXECUTABLE_OUTPUT_PATH}" PATH) set_tests_properties(WorkingDirectory3 PROPERTIES PASS_REGULAR_EXPRESSION "Working directory: -->${_default_cwd}<--" @@ -42,9 +43,6 @@ set_tests_properties(WorkingDirectory5 PROPERTIES PASS_REGULAR_EXPRESSION "Working directory: -->${_parent_dir}<--" ) -string(REGEX REPLACE "/[^/]*$" "" _wd_exe "${CMAKE_BINARY_DIR}") -get_filename_component(_default_cwd "${_wd_exe}" ABSOLUTE) - set_tests_properties(WorkingDirectory6 PROPERTIES PASS_REGULAR_EXPRESSION "Working directory: -->${_default_cwd}<--" ) -- cgit v0.12 From 561cc3359cca42749f797dd5ea908531740a873d Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 17 Dec 2010 10:24:14 -0500 Subject: Only test the default cwd with Makefiles XCode and Visual Studio generators can run from ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE} and determining this at testing time is not feasible without adding in more PASS_REGULAR_EXPRESSION's which may create false positives. Since the parsing code is in cross-platform, generator-agnostic code, if it passes with Makefiles, it should work with other generators on other platforms. --- Tests/TestsWorkingDirectory/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Tests/TestsWorkingDirectory/CMakeLists.txt b/Tests/TestsWorkingDirectory/CMakeLists.txt index d1c40d6..bd52cd6 100644 --- a/Tests/TestsWorkingDirectory/CMakeLists.txt +++ b/Tests/TestsWorkingDirectory/CMakeLists.txt @@ -25,9 +25,12 @@ set_tests_properties(WorkingDirectory2 PROPERTIES get_filename_component(_default_cwd "${EXECUTABLE_OUTPUT_PATH}" PATH) +# FIXME: How to deal with /debug, /release, etc. with VS or XCode? +if(${CMAKE_GENERATOR} MATCHES "Makefiles") set_tests_properties(WorkingDirectory3 PROPERTIES PASS_REGULAR_EXPRESSION "Working directory: -->${_default_cwd}<--" ) +endif() add_test(NAME WorkingDirectory4 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMAND WorkingDirectory) add_test(NAME WorkingDirectory5 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/.. COMMAND WorkingDirectory) @@ -43,6 +46,9 @@ set_tests_properties(WorkingDirectory5 PROPERTIES PASS_REGULAR_EXPRESSION "Working directory: -->${_parent_dir}<--" ) +# FIXME: How to deal with /debug, /release, etc. with VS or XCode? +if(${CMAKE_GENERATOR} MATCHES "Makefiles") set_tests_properties(WorkingDirectory6 PROPERTIES PASS_REGULAR_EXPRESSION "Working directory: -->${_default_cwd}<--" ) +endif() -- cgit v0.12 From 017d4e9d2ce1544aab44f87204b5195e0c062812 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 17 Dec 2010 11:06:59 -0500 Subject: Group adding tests with its properties --- Tests/TestsWorkingDirectory/CMakeLists.txt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Tests/TestsWorkingDirectory/CMakeLists.txt b/Tests/TestsWorkingDirectory/CMakeLists.txt index bd52cd6..1bc0705 100644 --- a/Tests/TestsWorkingDirectory/CMakeLists.txt +++ b/Tests/TestsWorkingDirectory/CMakeLists.txt @@ -8,9 +8,6 @@ enable_testing() set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin") add_test(NAME WorkingDirectory1 COMMAND WorkingDirectory) -add_test(NAME WorkingDirectory2 COMMAND WorkingDirectory) -add_test(WorkingDirectory3 WorkingDirectory) - set_tests_properties(WorkingDirectory1 PROPERTIES WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" PASS_REGULAR_EXPRESSION "Working directory: -->${CMAKE_BINARY_DIR}<--" @@ -18,6 +15,7 @@ set_tests_properties(WorkingDirectory1 PROPERTIES string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_BINARY_DIR}") +add_test(NAME WorkingDirectory2 COMMAND WorkingDirectory) set_tests_properties(WorkingDirectory2 PROPERTIES WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/.." PASS_REGULAR_EXPRESSION "Working directory: -->${_parent_dir}<--" @@ -27,27 +25,27 @@ get_filename_component(_default_cwd "${EXECUTABLE_OUTPUT_PATH}" PATH) # FIXME: How to deal with /debug, /release, etc. with VS or XCode? if(${CMAKE_GENERATOR} MATCHES "Makefiles") +add_test(WorkingDirectory3 WorkingDirectory) set_tests_properties(WorkingDirectory3 PROPERTIES PASS_REGULAR_EXPRESSION "Working directory: -->${_default_cwd}<--" ) endif() add_test(NAME WorkingDirectory4 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMAND WorkingDirectory) -add_test(NAME WorkingDirectory5 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/.. COMMAND WorkingDirectory) -add_test(WorkingDirectory6 WorkingDirectory WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/..) - set_tests_properties(WorkingDirectory4 PROPERTIES PASS_REGULAR_EXPRESSION "Working directory: -->${CMAKE_BINARY_DIR}<--" ) string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_BINARY_DIR}") +add_test(NAME WorkingDirectory5 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/.. COMMAND WorkingDirectory) set_tests_properties(WorkingDirectory5 PROPERTIES PASS_REGULAR_EXPRESSION "Working directory: -->${_parent_dir}<--" ) # FIXME: How to deal with /debug, /release, etc. with VS or XCode? if(${CMAKE_GENERATOR} MATCHES "Makefiles") +add_test(WorkingDirectory6 WorkingDirectory WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/..) set_tests_properties(WorkingDirectory6 PROPERTIES PASS_REGULAR_EXPRESSION "Working directory: -->${_default_cwd}<--" ) -- cgit v0.12 From cfe53cddbde124864ffb0500475bc1c1cbd3ddbc Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 17 Dec 2010 11:07:19 -0500 Subject: Fully specify the path to old-signature add_test --- Tests/TestsWorkingDirectory/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/TestsWorkingDirectory/CMakeLists.txt b/Tests/TestsWorkingDirectory/CMakeLists.txt index 1bc0705..24dc5e6 100644 --- a/Tests/TestsWorkingDirectory/CMakeLists.txt +++ b/Tests/TestsWorkingDirectory/CMakeLists.txt @@ -25,7 +25,7 @@ get_filename_component(_default_cwd "${EXECUTABLE_OUTPUT_PATH}" PATH) # FIXME: How to deal with /debug, /release, etc. with VS or XCode? if(${CMAKE_GENERATOR} MATCHES "Makefiles") -add_test(WorkingDirectory3 WorkingDirectory) +add_test(WorkingDirectory3 ${EXECUTABLE_OUTPUT_PATH}/WorkingDirectory) set_tests_properties(WorkingDirectory3 PROPERTIES PASS_REGULAR_EXPRESSION "Working directory: -->${_default_cwd}<--" ) @@ -45,7 +45,7 @@ set_tests_properties(WorkingDirectory5 PROPERTIES # FIXME: How to deal with /debug, /release, etc. with VS or XCode? if(${CMAKE_GENERATOR} MATCHES "Makefiles") -add_test(WorkingDirectory6 WorkingDirectory WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/..) +add_test(WorkingDirectory6 ${EXECUTABLE_OUTPUT_PATH}/WorkingDirectory WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/..) set_tests_properties(WorkingDirectory6 PROPERTIES PASS_REGULAR_EXPRESSION "Working directory: -->${_default_cwd}<--" ) -- cgit v0.12 From a4a5e375685adcfe765c45be086706720a96dbea Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 17 Dec 2010 11:07:40 -0500 Subject: Use iostream to make Borland happy It seems as though cstdio doesn't bring in stdio.h with the Borland compilers. --- Tests/TestsWorkingDirectory/main.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Tests/TestsWorkingDirectory/main.cxx b/Tests/TestsWorkingDirectory/main.cxx index 6a3a6be..42c3d34 100644 --- a/Tests/TestsWorkingDirectory/main.cxx +++ b/Tests/TestsWorkingDirectory/main.cxx @@ -1,8 +1,9 @@ -#include #include #include #include +#include + #if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__)) #include @@ -18,7 +19,7 @@ inline const char* Getcwd(char* buf, unsigned int len) const char* ret = _getcwd(buf, len); if(!ret) { - fprintf(stderr, "No current working directory.\n"); + std::cerr << "No current working directory." << std::endl; abort(); } // make sure the drive letter is capital @@ -46,7 +47,7 @@ inline const char* Getcwd(char* buf, unsigned int len) const char* ret = getcwd(buf, len); if(!ret) { - fprintf(stderr, "No current working directory\n"); + std::cerr << "No current working directory" << std::endl; abort(); } return ret; @@ -59,7 +60,7 @@ int main(int argc, char *argv[]) char buf[2048]; const char *cwd = Getcwd(buf, sizeof(buf)); - fprintf(stdout, "Working directory: -->%s<--", cwd); + std::cout << "Working directory: -->" << cwd << "<--"; return 0; } -- cgit v0.12 From 66e79175327249aa2f0c80f5bd4a360b5b628bff Mon Sep 17 00:00:00 2001 From: David Cole Date: Fri, 17 Dec 2010 11:11:55 -0500 Subject: VS10: stop build on custom command error (#11533) In VS9 and previous versions, :VCReportError is the goto label to jump to after a failed custom command. It stops the build before it tries to go any further. In VS10, :VCEnd is the correct label to use. Create a method in the VS generators to provide the correct line of script to use for each version of Visual Studio. For more internal details, search for VCEnd in the C:\Program Files\MSBuild directory. --- Source/cmLocalVisualStudio10Generator.cxx | 6 ++++++ Source/cmLocalVisualStudio10Generator.h | 4 ++++ Source/cmLocalVisualStudioGenerator.cxx | 14 +++++++++++++- Source/cmLocalVisualStudioGenerator.h | 7 +++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index 57d8653..de2a837 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -117,3 +117,9 @@ void cmLocalVisualStudio10Generator "Stored GUID", cmCacheManager::INTERNAL); } + +//---------------------------------------------------------------------------- +std::string cmLocalVisualStudio10Generator::CheckForErrorLine() +{ + return "if errorlevel 1 goto :VCEnd"; +} diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h index 5694220..06b8b09 100644 --- a/Source/cmLocalVisualStudio10Generator.h +++ b/Source/cmLocalVisualStudio10Generator.h @@ -36,6 +36,10 @@ public: virtual void Generate(); virtual void ReadAndStoreExternalGUID(const char* name, const char* path); + +protected: + virtual std::string CheckForErrorLine(); + private: }; #endif diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index ed0b07f..8eddc43 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -149,6 +149,18 @@ void cmLocalVisualStudioGenerator::ComputeObjectNameRequirements } //---------------------------------------------------------------------------- +std::string cmLocalVisualStudioGenerator::CheckForErrorLine() +{ + return "if errorlevel 1 goto :VCReportError"; +} + +//---------------------------------------------------------------------------- +std::string cmLocalVisualStudioGenerator::GetCheckForErrorLine() +{ + return this->CheckForErrorLine(); +} + +//---------------------------------------------------------------------------- std::string cmLocalVisualStudioGenerator ::ConstructScript(const cmCustomCommandLines& commandLines, @@ -237,7 +249,7 @@ cmLocalVisualStudioGenerator // sequence. // script += newline_text; - script += "if errorlevel 1 goto VCReportError"; + script += this->GetCheckForErrorLine(); } return script; diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index 6034b22..0019bfb 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -30,6 +30,7 @@ class cmLocalVisualStudioGenerator : public cmLocalGenerator public: cmLocalVisualStudioGenerator(); virtual ~cmLocalVisualStudioGenerator(); + /** Construct a script from the given list of command lines. */ std::string ConstructScript(const cmCustomCommandLines& commandLines, const char* workingDirectory, @@ -38,7 +39,13 @@ public: bool escapeAllowMakeVars, const char* newline = "\n"); + /** Line of batch file text that skips to the end after + * a failed step in a sequence of custom commands. + */ + std::string GetCheckForErrorLine(); + protected: + virtual std::string CheckForErrorLine(); /** Construct a custom command to make exe import lib dir. */ cmsys::auto_ptr -- cgit v0.12 From 44fca8b51af2e198d2d2cc6a2ad5f18838f9d235 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 17 Dec 2010 11:18:04 -0500 Subject: Check for poll when looking for _POLL_EMUL_H_ --- Utilities/cmcurl/select.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Utilities/cmcurl/select.c b/Utilities/cmcurl/select.c index 3656edd..2bec8cb 100644 --- a/Utilities/cmcurl/select.c +++ b/Utilities/cmcurl/select.c @@ -78,7 +78,7 @@ */ int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms) { -#if !defined(_POLL_EMUL_H_) || defined(CURL_HAVE_WSAPOLL) +#if (defined(HAVE_POLL) && !defined(_POLL_EMUL_H_)) || defined(CURL_HAVE_WSAPOLL) struct pollfd pfd[2]; int num; int r; @@ -96,7 +96,7 @@ int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms) num++; } -#ifndef _POLL_EMUL_H_ +#if defined(HAVE_POLL) && !defined(_POLL_EMUL_H_) do { r = poll(pfd, num, timeout_ms); } while((r == -1) && (errno == EINTR)); -- cgit v0.12 From 8a61950e4223c551a291cb0cc25a7a0232b2690a Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 17 Dec 2010 11:31:15 -0500 Subject: Toss out strerror_r macros --- Utilities/cmcurl/config.h.in | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Utilities/cmcurl/config.h.in b/Utilities/cmcurl/config.h.in index 72a1cd4..6e74935 100644 --- a/Utilities/cmcurl/config.h.in +++ b/Utilities/cmcurl/config.h.in @@ -171,9 +171,6 @@ /* Define to 1 if you have the `gettimeofday' function. */ #cmakedefine HAVE_GETTIMEOFDAY ${HAVE_GETTIMEOFDAY} -/* we have a glibc-style strerror_r() */ -#cmakedefine HAVE_GLIBC_STRERROR_R ${HAVE_GLIBC_STRERROR_R} - /* Define to 1 if you have the `gmtime_r' function. */ #cmakedefine HAVE_GMTIME_R ${HAVE_GMTIME_R} @@ -348,9 +345,6 @@ /* Define to 1 if you have the `poll' function. */ #cmakedefine HAVE_POLL ${HAVE_POLL} -/* we have a POSIX-style strerror_r() */ -#cmakedefine HAVE_POSIX_STRERROR_R ${HAVE_POSIX_STRERROR_R} - /* Define to 1 if you have the header file. */ #cmakedefine HAVE_PROCESS_H ${HAVE_PROCESS_H} @@ -441,9 +435,6 @@ /* Define to 1 if you have the `strdup' function. */ #cmakedefine HAVE_STRDUP ${HAVE_STRDUP} -/* Define to 1 if you have the `strerror_r' function. */ -#cmakedefine HAVE_STRERROR_R ${HAVE_STRERROR_R} - /* Define to 1 if you have the `stricmp' function. */ #cmakedefine HAVE_STRICMP ${HAVE_STRICMP} -- cgit v0.12 From 7e0b0014664d7db64ab13a31d0624e5d61b4227c Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 17 Dec 2010 11:41:30 -0500 Subject: Fix missed _POLL_EMUL_H_ and HAVE_POLL combo --- Utilities/cmcurl/select.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/cmcurl/select.c b/Utilities/cmcurl/select.c index 2bec8cb..51adbcf 100644 --- a/Utilities/cmcurl/select.c +++ b/Utilities/cmcurl/select.c @@ -220,7 +220,7 @@ int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms) int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms) { int r; -#ifndef _POLL_EMUL_H_ +#if defined(HAVE_POLL) && !defined(_POLL_EMUL_H_) do { r = poll(ufds, nfds, timeout_ms); } while((r == -1) && (errno == EINTR)); -- cgit v0.12 From 96309fc6e2439ede2604fc18ad04e82ffc54b606 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 17 Dec 2010 12:28:33 -0500 Subject: Make TestsWorkingDirectory test a C file --- Tests/TestsWorkingDirectory/CMakeLists.txt | 2 +- Tests/TestsWorkingDirectory/main.c | 66 ++++++++++++++++++++++++++++++ Tests/TestsWorkingDirectory/main.cxx | 66 ------------------------------ 3 files changed, 67 insertions(+), 67 deletions(-) create mode 100644 Tests/TestsWorkingDirectory/main.c delete mode 100644 Tests/TestsWorkingDirectory/main.cxx diff --git a/Tests/TestsWorkingDirectory/CMakeLists.txt b/Tests/TestsWorkingDirectory/CMakeLists.txt index 24dc5e6..01e6650 100644 --- a/Tests/TestsWorkingDirectory/CMakeLists.txt +++ b/Tests/TestsWorkingDirectory/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 2.6) project(TestsWorkingDirectoryProj) -add_executable(WorkingDirectory main.cxx) +add_executable(WorkingDirectory main.c) enable_testing() diff --git a/Tests/TestsWorkingDirectory/main.c b/Tests/TestsWorkingDirectory/main.c new file mode 100644 index 0000000..ad5eb30 --- /dev/null +++ b/Tests/TestsWorkingDirectory/main.c @@ -0,0 +1,66 @@ +#include +#include +#include +#include + +#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__)) + +#include +#include + +#if defined(__WATCOMC__) +#include +#define _getcwd getcwd +#endif + +static const char* Getcwd(char* buf, unsigned int len) +{ + const char* ret = _getcwd(buf, len); + char* p = NULL; + if(!ret) + { + fprintf(stderr, "No current working directory.\n"); + abort(); + } + // make sure the drive letter is capital + if(strlen(buf) > 1 && buf[1] == ':') + { + buf[0] = toupper(buf[0]); + } + for(p = buf; *p; ++p) + { + if(*p == '\\') + { + *p = '/'; + } + } + return ret; +} + +#else +#include +#include +#include + +static const char* Getcwd(char* buf, unsigned int len) +{ + const char* ret = getcwd(buf, len); + if(!ret) + { + fprintf(stderr, "No current working directory\n"); + abort(); + } + return ret; +} + +#endif + +int main(int argc, char *argv[]) +{ + char buf[2048]; + const char *cwd = Getcwd(buf, sizeof(buf)); + + fprintf(stdout, "Working directory: -->%s<--", cwd); + + return 0; +} diff --git a/Tests/TestsWorkingDirectory/main.cxx b/Tests/TestsWorkingDirectory/main.cxx deleted file mode 100644 index 42c3d34..0000000 --- a/Tests/TestsWorkingDirectory/main.cxx +++ /dev/null @@ -1,66 +0,0 @@ -#include -#include -#include - -#include - -#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__)) - -#include -#include - -#if defined(__WATCOMC__) -#include -#define _getcwd getcwd -#endif - -inline const char* Getcwd(char* buf, unsigned int len) -{ - const char* ret = _getcwd(buf, len); - if(!ret) - { - std::cerr << "No current working directory." << std::endl; - abort(); - } - // make sure the drive letter is capital - if(strlen(buf) > 1 && buf[1] == ':') - { - buf[0] = toupper(buf[0]); - } - for(char* p = buf; *p; ++p) - { - if(*p == '\\') - { - *p = '/'; - } - } - return ret; -} - -#else -#include -#include -#include - -inline const char* Getcwd(char* buf, unsigned int len) -{ - const char* ret = getcwd(buf, len); - if(!ret) - { - std::cerr << "No current working directory" << std::endl; - abort(); - } - return ret; -} - -#endif - -int main(int argc, char *argv[]) -{ - char buf[2048]; - const char *cwd = Getcwd(buf, sizeof(buf)); - - std::cout << "Working directory: -->" << cwd << "<--"; - - return 0; -} -- cgit v0.12 From cd9aa73f3a40b20ea6414779e4057ac236314d86 Mon Sep 17 00:00:00 2001 From: David Cole Date: Fri, 17 Dec 2010 13:29:10 -0500 Subject: CPack: look for makensis in the PATH (#8210) Previously, we would search in the Windows registry for the path to makensis, and fail immediately if we could not read the registry value, assuming that it was simply not installed. This change looks for makensis in the PATH even if the registry value is not there, enabling the scenario where makensis is installed without admin privileges and never even touches HKEY_LOCAL_MACHINE during the non-admin install. --- Source/CPack/cmCPackNSISGenerator.cxx | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index d0eda81..f25866c 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -337,6 +337,7 @@ int cmCPackNSISGenerator::InitializeInternal() << std::endl); std::vector path; std::string nsisPath; + bool gotRegValue = true; #ifdef _WIN32 if ( !cmsys::SystemTools::ReadRegistryValue( @@ -346,24 +347,37 @@ int cmCPackNSISGenerator::InitializeInternal() if ( !cmsys::SystemTools::ReadRegistryValue( "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath) ) { - cmCPackLogger - (cmCPackLog::LOG_ERROR, - "Cannot find NSIS registry value. This is usually caused by NSIS " - "not being installed. Please install NSIS from " - "http://nsis.sourceforge.net" - << std::endl); - return 0; + gotRegValue = false; } } - path.push_back(nsisPath); + + if (gotRegValue) + { + path.push_back(nsisPath); + } #endif + nsisPath = cmSystemTools::FindProgram("makensis", path, false); + if ( nsisPath.empty() ) { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find NSIS compiler" + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Cannot find NSIS compiler makensis: likely it is not installed, " + "or not in your PATH" << std::endl); + + if (!gotRegValue) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Could not read NSIS registry value. This is usually caused by " + "NSIS not being installed. Please install NSIS from " + "http://nsis.sourceforge.net" + << std::endl); + } + return 0; } + std::string nsisCmd = "\"" + nsisPath + "\" " NSIS_OPT "VERSION"; cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Test NSIS version: " << nsisCmd.c_str() << std::endl); -- cgit v0.12 From 85c0a69a92e78275ea0b180482bafcdb877b0dc3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 17 Dec 2010 14:19:58 -0500 Subject: Cygwin: Do not define 'WIN32' (#10122) One of Cygwin's goals is to build projects using the POSIX API with no Windows awareness. Many CMake-built projects have been written to test for UNIX and WIN32 but not CYGWIN. The preferred behavior under Cygwin in such projects is to take the UNIX path but not the WIN32 path. Unfortunately this change is BACKWARDS INCOMPATIBLE for Cygwin-aware CMake projects! Some projects that previously built under Cygwin and are Cygwin-aware when they test for WIN32 may now behave differently. Eventually these projects will need to be updated, but to help users build them in the meantime we print a warning about the change in behavior. Furthermore, one may set CMAKE_LEGACY_CYGWIN_WIN32 to request old behavior during the transition. Normally we avoid backwards incompatible changes, but we make an exception in this case for a few reasons: (1) This behavior is preferred by Cygwin's design goals. (2) A warning provides a clear path forward for everyone who may see incompatible behavior, and CMAKE_LEGACY_CYGWIN_WIN32 provides a compatibility option. The warning and compatibility option both disappear when the minimum required version of CMake in a project is sufficiently new, so this issue will simply go away over time as projects are updated to account for the change. (3) The fixes required to update projects are fairly insignificant. Furthermore, the Cygwin distribution has no releases itself so project versions that predate said fixes tend to be difficult to build anyway. (4) This change enables many CMake-built projects that did not previously build under Cygwin to work out-of-the-box. From bug #10122: "I have built over 120 different source packages with (my patched) CMake, including most of KDE4, and have found that NOT defining WIN32 on Cygwin is much more accurate." -- Yaakov Selkowitz A fully compatible change would require patches on top of these project releases for Cygwin even though they otherwise need not be aware of it. (5) Yaakov has been maintaining a fork of CMake with this change for the Cygwin Ports distribution. It works well in practice. By accepting the change in upstream CMake we avoid confusion between the versions. CMake itself builds without WIN32 defined on Cygwin. Simply disable CMAKE_LEGACY_CYGWIN_WIN32 explicitly in our own CMakeLists.txt file. --- CMakeLists.txt | 1 + Modules/Platform/CYGWIN.cmake | 46 ++++++++++++++++++++++++++++++++++++++++++- Source/cmMakefile.cxx | 10 ++++++---- 3 files changed, 52 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 98bde02..4508e33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ # See the License for more information. #============================================================================= CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5 FATAL_ERROR) +SET(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required PROJECT(CMake) IF(COMMAND CMAKE_POLICY) CMAKE_POLICY(SET CMP0003 NEW) diff --git a/Modules/Platform/CYGWIN.cmake b/Modules/Platform/CYGWIN.cmake index 1576982..b7ad2ce 100644 --- a/Modules/Platform/CYGWIN.cmake +++ b/Modules/Platform/CYGWIN.cmake @@ -1,4 +1,48 @@ -SET(WIN32 1) +if("${CMAKE_MINIMUM_REQUIRED_VERSION}" VERSION_LESS "2.8.3.20101214") + set(__USE_CMAKE_LEGACY_CYGWIN_WIN32 1) +endif() +if(NOT DEFINED WIN32) + set(WIN32 0) + if(DEFINED __USE_CMAKE_LEGACY_CYGWIN_WIN32) + if(NOT DEFINED CMAKE_LEGACY_CYGWIN_WIN32 + AND DEFINED ENV{CMAKE_LEGACY_CYGWIN_WIN32}) + set(CMAKE_LEGACY_CYGWIN_WIN32 $ENV{CMAKE_LEGACY_CYGWIN_WIN32}) + endif() + if(CMAKE_LEGACY_CYGWIN_WIN32) + message(STATUS "Defining WIN32 under Cygwin due to CMAKE_LEGACY_CYGWIN_WIN32") + set(WIN32 1) + elseif("x${CMAKE_LEGACY_CYGWIN_WIN32}" STREQUAL "x") + message(WARNING "CMake no longer defines WIN32 on Cygwin!" + "\n" + "(1) If you are just trying to build this project, ignore this warning " + "or quiet it by setting CMAKE_LEGACY_CYGWIN_WIN32=0 in your environment or " + "in the CMake cache. " + "If later configuration or build errors occur then this project may " + "have been written under the assumption that Cygwin is WIN32. " + "In that case, set CMAKE_LEGACY_CYGWIN_WIN32=1 instead." + "\n" + "(2) If you are developing this project, add the line\n" + " set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required\n" + "at the top of your top-level CMakeLists.txt file or set the minimum " + "required version of CMake to 2.8.4 or higher. " + "Then teach your project to build on Cygwin without WIN32.") + endif() + elseif(DEFINED CMAKE_LEGACY_CYGWIN_WIN32) + message(AUTHOR_WARNING "CMAKE_LEGACY_CYGWIN_WIN32 ignored because\n" + " cmake_minimum_required(VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION})\n" + "is at least 2.8.4.") + endif() +endif() +if(DEFINED __USE_CMAKE_LEGACY_CYGWIN_WIN32) + # Pass WIN32 legacy setting to scripts. + if(WIN32) + set(ENV{CMAKE_LEGACY_CYGWIN_WIN32} 1) + else() + set(ENV{CMAKE_LEGACY_CYGWIN_WIN32} 0) + endif() + unset(__USE_CMAKE_LEGACY_CYGWIN_WIN32) +endif() + SET(CYGWIN 1) SET(CMAKE_SHARED_LIBRARY_PREFIX "cyg") diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 56e0ed9..813258d 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2340,17 +2340,19 @@ void cmMakefile::AddDefaultDefinitions() working, these variables are still also set here in this place, but they will be reset in CMakeSystemSpecificInformation.cmake before the platform files are executed. */ -#if defined(_WIN32) || defined(__CYGWIN__) +#if defined(_WIN32) this->AddDefinition("WIN32", "1"); this->AddDefinition("CMAKE_HOST_WIN32", "1"); #else this->AddDefinition("UNIX", "1"); this->AddDefinition("CMAKE_HOST_UNIX", "1"); #endif - // Cygwin is more like unix so enable the unix commands #if defined(__CYGWIN__) - this->AddDefinition("UNIX", "1"); - this->AddDefinition("CMAKE_HOST_UNIX", "1"); + if(cmSystemTools::IsOn(cmSystemTools::GetEnv("CMAKE_LEGACY_CYGWIN_WIN32"))) + { + this->AddDefinition("WIN32", "1"); + this->AddDefinition("CMAKE_HOST_WIN32", "1"); + } #endif #if defined(__APPLE__) this->AddDefinition("APPLE", "1"); -- cgit v0.12 From 984acc884ba4c21192712c20b7820d94ad855605 Mon Sep 17 00:00:00 2001 From: David Cole Date: Fri, 17 Dec 2010 15:43:16 -0500 Subject: VS10: avoid warning, no nologo when verbose (#10587) For prior versions of Visual Studio we would intentionally pass "/nologo-" for "verbose makefiles" (CMAKE_VERBOSE_MAKEFILE ON) when the caller did not already explicitly specify either /nologo or /nologo-. And we still do. For the prior versions. This had the side effect of always passing /nologo- for try_compile operations because try_compile generates projects that have verbose makefiles on. However, starting with Visual Studio 10, the compiler emits "cl ... warning D9035: option 'nologo-' has been deprecated" when passed "/nologo-". Therefore, this commit removes setting "/nologo-" for verbose makefiles in the Visual Studio 10 case to avoid emitting a warning for every single invocation of the compiler in a given build. With Visual Studio 10, we do not set this flag either way and therefore, the generated project has no value for this setting and gets Visual Studio's default value, which is of course "/nologo", which does not produce a warning. With Visual Studio 10, a caller can still force "/nologo-" if desired by adding it explicitly to CMAKE_C_FLAGS or CMAKE_CXX_FLAGS. --- Source/cmVisualStudioGeneratorOptions.cxx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index f1bad9c..9acae0d 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -85,17 +85,15 @@ void cmVisualStudioGeneratorOptions::SetVerboseMakefile(bool verbose) // was not given explicitly in the flags we want to add an attribute // to the generated project to disable logo suppression. Otherwise // the GUI default is to enable suppression. + // + // Avoid this on Visual Studio 10 (and later!) because it results in: + // "cl ... warning D9035: option 'nologo-' has been deprecated" + // if(verbose && + this->Version != 10 && this->FlagMap.find("SuppressStartupBanner") == this->FlagMap.end()) { - if(this->Version == 10) - { - this->FlagMap["SuppressStartupBanner"] = "false"; - } - else - { - this->FlagMap["SuppressStartupBanner"] = "FALSE"; - } + this->FlagMap["SuppressStartupBanner"] = "FALSE"; } } -- cgit v0.12 From 744366fc0b63ff8e9f6e57a0648508e3dfe52709 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Fri, 17 Dec 2010 17:18:20 -0500 Subject: CTest: multiple ctest_test calls w/LABEL regexs (#11487) The Initialize method was not re-initializing everything that it should have been. This commit fixes that. --- Source/CTest/cmCTestTestHandler.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 6dd348d..6eec3c8 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -438,6 +438,8 @@ void cmCTestTestHandler::Initialize() this->TestsToRun.clear(); + this->UseIncludeLabelRegExpFlag = false; + this->UseExcludeLabelRegExpFlag = false; this->UseIncludeRegExpFlag = false; this->UseExcludeRegExpFlag = false; this->UseExcludeRegExpFirst = false; -- cgit v0.12 From 3f158c6dfab7420696498ed4386761d847b6e943 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Fri, 17 Dec 2010 19:04:57 -0700 Subject: cmake-gui: always enable generate button. --- Source/QtDialog/CMakeSetupDialog.cxx | 153 +++++++++++++++++++++++++---------- Source/QtDialog/CMakeSetupDialog.h | 12 ++- Source/QtDialog/QCMakeCacheView.cxx | 28 +++++-- Source/QtDialog/QCMakeCacheView.h | 4 + 4 files changed, 146 insertions(+), 51 deletions(-) diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 29fcfc0..408dbac 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -55,7 +55,7 @@ void QCMakeThread::run() } CMakeSetupDialog::CMakeSetupDialog() - : ExitAfterGenerate(true), CacheModified(false), CurrentState(Interrupting) + : ExitAfterGenerate(true), CacheModified(false), ConfigureNeeded(true), CurrentState(Interrupting) { QString title = QString(tr("CMake %1")); title = title.arg(cmVersion::GetCMakeVersion()); @@ -167,6 +167,9 @@ CMakeSetupDialog::CMakeSetupDialog() this->CMakeThread->start(); this->enterState(ReadyConfigure); + + ProgressOffset = 0.0; + ProgressFactor = 1.0; } void CMakeSetupDialog::initialize() @@ -179,12 +182,11 @@ void CMakeSetupDialog::initialize() QObject::connect(this->ConfigureButton, SIGNAL(clicked(bool)), this, SLOT(doConfigure())); - QObject::connect(this->CMakeThread->cmakeInstance(), - SIGNAL(configureDone(int)), - this, SLOT(finishConfigure(int))); - QObject::connect(this->CMakeThread->cmakeInstance(), - SIGNAL(generateDone(int)), - this, SLOT(finishGenerate(int))); + + QObject::connect(this->CMakeThread->cmakeInstance(), SIGNAL(configureDone(int)), + this, SLOT(exitLoop(int))); + QObject::connect(this->CMakeThread->cmakeInstance(), SIGNAL(generateDone(int)), + this, SLOT(exitLoop(int))); QObject::connect(this->GenerateButton, SIGNAL(clicked(bool)), this, SLOT(doGenerate())); @@ -270,15 +272,8 @@ CMakeSetupDialog::~CMakeSetupDialog() this->CMakeThread->wait(2000); } -void CMakeSetupDialog::doConfigure() +bool CMakeSetupDialog::prepareConfigure() { - if(this->CurrentState == Configuring) - { - // stop configure - doInterrupt(); - return; - } - // make sure build directory exists QString bindir = this->CMakeThread->cmakeInstance()->binaryDirectory(); QDir dir(bindir); @@ -295,7 +290,7 @@ void CMakeSetupDialog::doConfigure() QMessageBox::Yes | QMessageBox::No); if(btn == QMessageBox::No) { - return; + return false; } if(!dir.mkpath(".")) { @@ -303,7 +298,7 @@ void CMakeSetupDialog::doConfigure() QString(tr("Failed to create directory %1")).arg(dir.path()), QMessageBox::Ok); - return; + return false; } } @@ -312,27 +307,45 @@ void CMakeSetupDialog::doConfigure() { if(!this->setupFirstConfigure()) { - return; + return false; } } // remember path this->addBinaryPath(dir.absolutePath()); - this->enterState(Configuring); + return true; +} - this->CacheValues->selectionModel()->clear(); - QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), - "setProperties", Qt::QueuedConnection, - Q_ARG(QCMakePropertyList, - this->CacheValues->cacheModel()->properties())); - QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), - "configure", Qt::QueuedConnection); +void CMakeSetupDialog::exitLoop(int err) +{ + this->LocalLoop.exit(err); } -void CMakeSetupDialog::finishConfigure(int err) +void CMakeSetupDialog::doConfigure() { - if(0 == err && !this->CacheValues->cacheModel()->newPropertyCount()) + if(this->CurrentState == Configuring) + { + // stop configure + doInterrupt(); + return; + } + + if(!prepareConfigure()) + { + return; + } + + this->enterState(Configuring); + + bool ret = doConfigureInternal(); + + if(ret) + { + this->ConfigureNeeded = false; + } + + if(ret && !this->CacheValues->cacheModel()->newPropertyCount()) { this->enterState(ReadyGenerate); } @@ -341,6 +354,22 @@ void CMakeSetupDialog::finishConfigure(int err) this->enterState(ReadyConfigure); this->CacheValues->scrollToTop(); } + this->ProgressBar->reset(); +} + +bool CMakeSetupDialog::doConfigureInternal() +{ + this->Output->clear(); + this->CacheValues->selectionModel()->clear(); + + QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), + "setProperties", Qt::QueuedConnection, + Q_ARG(QCMakePropertyList, + this->CacheValues->cacheModel()->properties())); + QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), + "configure", Qt::QueuedConnection); + + int err = this->LocalLoop.exec(); if(err != 0) { @@ -348,23 +377,31 @@ void CMakeSetupDialog::finishConfigure(int err) tr("Error in configuration process, project files may be invalid"), QMessageBox::Ok); } + + return 0 == err; } -void CMakeSetupDialog::finishGenerate(int err) +void CMakeSetupDialog::doInstallForCommandLine() { - this->enterState(ReadyConfigure); + QMacInstallDialog setupdialog(0); + setupdialog.exec(); +} + +bool CMakeSetupDialog::doGenerateInternal() +{ + QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), + "generate", Qt::QueuedConnection); + + int err = this->LocalLoop.exec(); + if(err != 0) { QMessageBox::critical(this, tr("Error"), tr("Error in generation process, project files may be invalid"), QMessageBox::Ok); } -} -void CMakeSetupDialog::doInstallForCommandLine() -{ - QMacInstallDialog setupdialog(0); - setupdialog.exec(); + return 0 == err; } void CMakeSetupDialog::doGenerate() @@ -375,9 +412,43 @@ void CMakeSetupDialog::doGenerate() doInterrupt(); return; } + + // see if we need to configure + // we'll need to configure if: + // the configure step hasn't been done yet + // generate was the last step done + if(this->ConfigureNeeded) + { + if(!prepareConfigure()) + { + return; + } + } + this->enterState(Generating); - QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), - "generate", Qt::QueuedConnection); + + bool config_passed = true; + if(this->ConfigureNeeded) + { + this->CacheValues->cacheModel()->setShowNewProperties(false); + this->ProgressFactor = 0.5; + config_passed = doConfigureInternal(); + this->ProgressOffset = 0.5; + } + + if(config_passed) + { + doGenerateInternal(); + } + + this->ProgressOffset = 0.0; + this->ProgressFactor = 1.0; + this->CacheValues->cacheModel()->setShowNewProperties(true); + + this->enterState(ReadyConfigure); + this->ProgressBar->reset(); + + this->ConfigureNeeded = true; } void CMakeSetupDialog::closeEvent(QCloseEvent* e) @@ -542,6 +613,7 @@ void CMakeSetupDialog::setSourceDirectory(const QString& dir) void CMakeSetupDialog::showProgress(const QString& /*msg*/, float percent) { + percent = (percent * ProgressFactor) + ProgressOffset; this->ProgressBar->setValue(qRound(percent * 100)); } @@ -883,7 +955,6 @@ void CMakeSetupDialog::enterState(CMakeSetupDialog::State s) } else if(s == Configuring) { - this->Output->clear(); this->setEnabledState(false); this->GenerateButton->setEnabled(false); this->GenerateAction->setEnabled(false); @@ -899,17 +970,15 @@ void CMakeSetupDialog::enterState(CMakeSetupDialog::State s) } else if(s == ReadyConfigure) { - this->ProgressBar->reset(); this->setEnabledState(true); - this->GenerateButton->setEnabled(false); - this->GenerateAction->setEnabled(false); + this->GenerateButton->setEnabled(true); + this->GenerateAction->setEnabled(true); this->ConfigureButton->setEnabled(true); this->ConfigureButton->setText(tr("&Configure")); this->GenerateButton->setText(tr("&Generate")); } else if(s == ReadyGenerate) { - this->ProgressBar->reset(); this->setEnabledState(true); this->GenerateButton->setEnabled(true); this->GenerateAction->setEnabled(true); diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h index 0e3caec..1934795 100644 --- a/Source/QtDialog/CMakeSetupDialog.h +++ b/Source/QtDialog/CMakeSetupDialog.h @@ -16,6 +16,7 @@ #include "QCMake.h" #include #include +#include #include "ui_CMakeSetupDialog.h" class QCMakeThread; @@ -43,8 +44,6 @@ protected slots: void doHelp(); void doAbout(); void doInterrupt(); - void finishConfigure(int error); - void finishGenerate(int error); void error(const QString& message); void message(const QString& message); @@ -74,6 +73,10 @@ protected slots: void setGroupedView(bool); void showUserChanges(); void setSearchFilter(const QString& str); + bool prepareConfigure(); + bool doConfigureInternal(); + bool doGenerateInternal(); + void exitLoop(int); protected: @@ -87,6 +90,7 @@ protected: QCMakeThread* CMakeThread; bool ExitAfterGenerate; bool CacheModified; + bool ConfigureNeeded; QAction* ReloadCacheAction; QAction* DeleteCacheAction; QAction* ExitAction; @@ -99,6 +103,10 @@ protected: QTextCharFormat ErrorFormat; QTextCharFormat MessageFormat; + QEventLoop LocalLoop; + + float ProgressOffset; + float ProgressFactor; }; // QCMake instance on a thread diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index d90307a..562396d 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -200,6 +200,7 @@ QCMakeCacheModel::QCMakeCacheModel(QObject* p) NewPropertyCount(0), View(FlatView) { + this->ShowNewProperties = true; QStringList labels; labels << tr("Name") << tr("Value"); this->setHorizontalHeaderLabels(labels); @@ -214,6 +215,11 @@ static uint qHash(const QCMakeProperty& p) return qHash(p.Key); } +void QCMakeCacheModel::setShowNewProperties(bool f) +{ + this->ShowNewProperties = f; +} + void QCMakeCacheModel::clear() { this->QStandardItemModel::clear(); @@ -226,13 +232,21 @@ void QCMakeCacheModel::clear() void QCMakeCacheModel::setProperties(const QCMakePropertyList& props) { - QSet newProps = props.toSet(); - QSet newProps2 = newProps; - QSet oldProps = this->properties().toSet(); - - oldProps.intersect(newProps); - newProps.subtract(oldProps); - newProps2.subtract(newProps); + QSet newProps, newProps2; + + if(this->ShowNewProperties) + { + newProps = props.toSet(); + newProps2 = newProps; + QSet oldProps = this->properties().toSet(); + oldProps.intersect(newProps); + newProps.subtract(oldProps); + newProps2.subtract(newProps); + } + else + { + newProps2 = props.toSet(); + } bool b = this->blockSignals(true); diff --git a/Source/QtDialog/QCMakeCacheView.h b/Source/QtDialog/QCMakeCacheView.h index 401e07e..58bbd2d 100644 --- a/Source/QtDialog/QCMakeCacheView.h +++ b/Source/QtDialog/QCMakeCacheView.h @@ -78,6 +78,9 @@ public slots: // become new properties and be marked red. void setProperties(const QCMakePropertyList& props); + // set whether to show new properties in red + void setShowNewProperties(bool); + // clear everything from the model void clear(); @@ -115,6 +118,7 @@ public: protected: bool EditEnabled; int NewPropertyCount; + bool ShowNewProperties; ViewType View; // set the data in the model for this property -- cgit v0.12 From 2c2eee61c1fb5bbe7e323699a40463087e808114 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 20 Dec 2010 11:15:55 -0500 Subject: Revert "Remove unused parameter "root" in some VS generator methods" This reverts commit 10f01ae962feb68177f7bd698b01bbc18668920c. --- Source/cmGlobalVisualStudio71Generator.cxx | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 3 ++- Source/cmGlobalVisualStudio7Generator.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 2874952..ba18687 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -110,7 +110,7 @@ void cmGlobalVisualStudio71Generator this->GetTargetSets(projectTargets, originalTargets, root, generators); OrderedTargetDependSet orderedProjectTargets(projectTargets); - this->WriteTargetsToSolution(fout, orderedProjectTargets); + this->WriteTargetsToSolution(fout, root, orderedProjectTargets); bool useFolderProperty = this->UseFolderProperty(); if (useFolderProperty) diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index eb84a2c..6858674 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -270,6 +270,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations( void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( std::ostream& fout, + cmLocalGenerator* root, OrderedTargetDependSet const& projectTargets) { for(OrderedTargetDependSet::const_iterator tt = @@ -385,7 +386,7 @@ void cmGlobalVisualStudio7Generator this->GetTargetSets(projectTargets, originalTargets, root, generators); OrderedTargetDependSet orderedProjectTargets(projectTargets); - this->WriteTargetsToSolution(fout, orderedProjectTargets); + this->WriteTargetsToSolution(fout, root, orderedProjectTargets); bool useFolderProperty = this->UseFolderProperty(); if (useFolderProperty) diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 57c079d..b6c84e8 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -118,6 +118,7 @@ protected: virtual void WriteTargetsToSolution( std::ostream& fout, + cmLocalGenerator* root, OrderedTargetDependSet const& projectTargets); virtual void WriteTargetDepends( std::ostream& fout, -- cgit v0.12 From 42a2e9d91ac3f82562ffe934273dbf0877cdcf26 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 20 Dec 2010 11:27:24 -0500 Subject: Revert "Avoid msbuild idiosyncrasy that builds multiple configs" (#11633) This reverts commit 57e71533f45601275afd7787d763664f9e6b9536. While "msbuild" can handle full paths to project files in solutions, the old "vcbuild" used for VS < 10 cannot. We will need another way to fix issue #11594. --- Source/cmGlobalVisualStudio7Generator.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 6858674..d421c7f 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -297,6 +297,8 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( { cmMakefile* tmf = target->GetMakefile(); std::string dir = tmf->GetStartOutputDirectory(); + dir = root->Convert(dir.c_str(), + cmLocalGenerator::START_OUTPUT); this->WriteProject(fout, vcprojName, dir.c_str(), *target); written = true; -- cgit v0.12 From e1442ac9c16768962b43575ace24c7cf277c2e74 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 20 Dec 2010 11:56:18 -0500 Subject: Avoid msbuild ".\" idiosyncrasy that builds multiple configs (#11594) If a .sln file refers to a project file with a leading ".\", as in ".\foo.vcxproj" instead of just "foo.vcxproj" or a full path then msbuild behaves strangely. Whenever target foo is built as a dependency of another target, msbuild brings multiple configurations up to date instead of just the requested configuration! Avoid a leading ".\" in project file references to avoid this behavior. This alternative fix to that attempted by commit 57e71533 (Avoid msbuild idiosyncrasy that builds multiple configs, 2010-12-10) avoids use of full path project file references which vcbuild does not support. --- Source/cmGlobalVisualStudio71Generator.cxx | 8 ++++---- Source/cmGlobalVisualStudio7Generator.cxx | 12 ++++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index ba18687..adb5f2f 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -182,8 +182,8 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, std::string guid = this->GetGUID(dspname); fout << project << dspname << "\", \"" - << this->ConvertToSolutionPath(dir) - << "\\" << dspname << ext << "\", \"{" << guid << "}\"\n"; + << this->ConvertToSolutionPath(dir) << (dir[0]? "\\":"") + << dspname << ext << "\", \"{" << guid << "}\"\n"; fout << "\tProjectSection(ProjectDependencies) = postProject\n"; this->WriteProjectDepends(fout, dspname, dir, t); fout << "\tEndProjectSection\n"; @@ -196,8 +196,8 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, const char* uname = ui->second.c_str(); fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" << uname << "\", \"" - << this->ConvertToSolutionPath(dir) - << "\\" << uname << ".vcproj" << "\", \"{" + << this->ConvertToSolutionPath(dir) << (dir[0]? "\\":"") + << uname << ".vcproj" << "\", \"{" << this->GetGUID(uname) << "}\"\n" << "\tProjectSection(ProjectDependencies) = postProject\n" << "\t\t{" << guid << "} = {" << guid << "}\n" diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index d421c7f..51b8918 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -299,6 +299,10 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( std::string dir = tmf->GetStartOutputDirectory(); dir = root->Convert(dir.c_str(), cmLocalGenerator::START_OUTPUT); + if(dir == ".") + { + dir = ""; // msbuild cannot handle ".\" prefix + } this->WriteProject(fout, vcprojName, dir.c_str(), *target); written = true; @@ -514,8 +518,8 @@ void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout, fout << project << dspname << "\", \"" - << this->ConvertToSolutionPath(dir) - << "\\" << dspname << ext << "\", \"{" + << this->ConvertToSolutionPath(dir) << (dir[0]? "\\":"") + << dspname << ext << "\", \"{" << this->GetGUID(dspname) << "}\"\nEndProject\n"; UtilityDependsMap::iterator ui = this->UtilityDepends.find(&target); @@ -524,8 +528,8 @@ void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout, const char* uname = ui->second.c_str(); fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" << uname << "\", \"" - << this->ConvertToSolutionPath(dir) - << "\\" << uname << ".vcproj" << "\", \"{" + << this->ConvertToSolutionPath(dir) << (dir[0]? "\\":"") + << uname << ".vcproj" << "\", \"{" << this->GetGUID(uname) << "}\"\n" << "EndProject\n"; } -- cgit v0.12 From 4499d50ad2df7c1db4335d40f9fa20c642f59a5d Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 20 Dec 2010 12:09:23 -0500 Subject: Mark CustomCommand test perconfig.out as SYMBOLIC The custom command with this output does not actually create the file, so mark it as SYMBOLIC. --- Tests/CustomCommand/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index 450323e..6a86a34 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -432,6 +432,7 @@ ADD_CUSTOM_COMMAND( DEPENDS ${PerConfig_DEPENDS} VERBATIM ) +SET_PROPERTY(SOURCE perconfig.out PROPERTY SYMBOLIC 1) ADD_CUSTOM_TARGET(perconfig_target ALL COMMAND ${CMAKE_COMMAND} -E echo "perconfig=$" "config=$" DEPENDS perconfig.out) -- cgit v0.12 From f578381e6624b83843a1b9ff079a8073f7bc210f Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Mon, 20 Dec 2010 15:25:16 -0500 Subject: Fix vs2010 project generation error when HEADER_FILE_ONLY is set. In vs2010 a bad project file could be generated if a .c or .cxx file was marked with HEADER_FILE_ONLY, if it was in a library that contained both c and c++ code. This fixes the error in the code, and adds a test for this case. --- Source/cmVisualStudio10TargetGenerator.cxx | 2 +- Tests/Complex/Executable/CMakeLists.txt | 9 ++++++++- Tests/Complex/Executable/complex_nobuild.c | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 Tests/Complex/Executable/complex_nobuild.c diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index f78aeec..8d3416a 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -700,7 +700,7 @@ void cmVisualStudio10TargetGenerator::WriteCLSources() } (*this->BuildFileStream ) << sourceFile << "\""; // ouput any flags specific to this source file - if(cl && this->OutputSourceSpecificFlags(*source)) + if(!header && cl && this->OutputSourceSpecificFlags(*source)) { // if the source file has specific flags the tag // is ended on a new line diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt index 98b29bb..08cc7d4 100644 --- a/Tests/Complex/Executable/CMakeLists.txt +++ b/Tests/Complex/Executable/CMakeLists.txt @@ -49,10 +49,17 @@ LINK_LIBRARIES(${COMPLEX_LIBS}) SET_SOURCE_FILES_PROPERTIES(complex_nobuild.cxx PROPERTIES HEADER_FILE_ONLY 1) +# Test forcing a .c file to not build. +# This makes sure a mixed language library is created +# with header file only sources +SET_SOURCE_FILES_PROPERTIES(complex_nobuild.c PROPERTIES + HEADER_FILE_ONLY 1) + ADD_EXECUTABLE(A A.cxx A.hh A.h A.txt) ADD_EXECUTABLE(complex complex testcflags.c ) # Sub1/NameConflictTest.c Sub2/NameConflictTest.c) -ADD_EXECUTABLE(complex.file complex.file.cxx complex_nobuild.cxx) +ADD_EXECUTABLE(complex.file complex.file.cxx complex_nobuild.cxx + complex_nobuild.c) IF(COMPLEX_TEST_CMAKELIB) TARGET_LINK_LIBRARIES(complex CMakeLib cmsys cmexpat cmzlib cmlibarchive cmbzip2 cmcurl) ENDIF(COMPLEX_TEST_CMAKELIB) diff --git a/Tests/Complex/Executable/complex_nobuild.c b/Tests/Complex/Executable/complex_nobuild.c new file mode 100644 index 0000000..6b3c2c1 --- /dev/null +++ b/Tests/Complex/Executable/complex_nobuild.c @@ -0,0 +1 @@ +#error "This file should not be compiled." -- cgit v0.12 From afbfb7ac1d1419062fe9563f7bfddf6da8f39029 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Mon, 20 Dec 2010 15:46:11 -0500 Subject: Add more documentation for LANGUAGE property. Make it clear that if you set the language on a file, it will be compiled. --- Source/cmSourceFile.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index b793cd5..26328cf 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -472,7 +472,9 @@ void cmSourceFile::DefineProperties(cmake *cm) "What programming language is the file.", "A property that can be set to indicate what programming language " "the source file is. If it is not set the language is determined " - "based on the file extension. Typical values are CXX C etc."); + "based on the file extension. Typical values are CXX C etc. Setting " + "this property for a file means this file will be compiled. " + "Do not set this for header or files that should not be compiled."); cm->DefineProperty ("LOCATION", cmProperty::SOURCE_FILE, -- cgit v0.12 From 307b8a6e6995b2c08fb71d7eea202e2ab0a8a204 Mon Sep 17 00:00:00 2001 From: Zach Mullen Date: Mon, 20 Dec 2010 15:33:21 -0500 Subject: CTest git update should pass the committer as well as the author --- Source/CTest/cmCTestGIT.cxx | 29 +++++++++++++++++++++++++++++ Source/CTest/cmCTestVC.cxx | 5 +++++ Source/CTest/cmCTestVC.h | 3 +++ 3 files changed, 37 insertions(+) diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index a6f10ec..3456ec4 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -526,6 +526,35 @@ private: } this->Rev.Date += tz; } + else if(strncmp(this->Line.c_str(), "committer ", 10) == 0) + { + Person committer; + this->ParsePerson(this->Line.c_str()+10, committer); + this->Rev.Committer = committer.Name; + this->Rev.CommitterEMail = committer.EMail; + + // Convert the time to a human-readable format that is also easy + // to machine-parse: "CCYY-MM-DD hh:mm:ss". + time_t seconds = static_cast(committer.Time); + struct tm* t = gmtime(&seconds); + char dt[1024]; + sprintf(dt, "%04d-%02d-%02d %02d:%02d:%02d", + t->tm_year+1900, t->tm_mon+1, t->tm_mday, + t->tm_hour, t->tm_min, t->tm_sec); + this->Rev.CommitDate = dt; + + // Add the time-zone field "+zone" or "-zone". + char tz[32]; + if(committer.TimeZone >= 0) + { + sprintf(tz, " +%04ld", committer.TimeZone); + } + else + { + sprintf(tz, " -%04ld", -committer.TimeZone); + } + this->Rev.CommitDate += tz; + } } void DoBodyLine() diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx index f9ad79a..fbee227 100644 --- a/Source/CTest/cmCTestVC.cxx +++ b/Source/CTest/cmCTestVC.cxx @@ -228,6 +228,11 @@ void cmCTestVC::WriteXMLEntry(std::ostream& xml, << "\t\t\t" << cmXMLSafe(rev.Date) << "\n" << "\t\t\t" << cmXMLSafe(rev.Author) << "\n" << "\t\t\t" << cmXMLSafe(rev.EMail) << "\n" + << "\t\t\t" << cmXMLSafe(rev.Committer) << "\n" + << "\t\t\t" << cmXMLSafe(rev.CommitterEMail) + << "\n" + << "\t\t\t" << cmXMLSafe(rev.CommitDate) + << "\n" << "\t\t\t" << cmXMLSafe(rev.Log) << "\n" << "\t\t\t" << cmXMLSafe(rev.Rev) << "\n" << "\t\t\t" << cmXMLSafe(prior) << "\n" diff --git a/Source/CTest/cmCTestVC.h b/Source/CTest/cmCTestVC.h index d36bc8f..44e1dac 100644 --- a/Source/CTest/cmCTestVC.h +++ b/Source/CTest/cmCTestVC.h @@ -74,6 +74,9 @@ protected: std::string Date; std::string Author; std::string EMail; + std::string Committer; + std::string CommitterEMail; + std::string CommitDate; std::string Log; }; -- cgit v0.12 From 59925264829e5c9509f505897aafd33478e80cfe Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 20 Dec 2010 17:16:25 -0500 Subject: CTest: Factor out duplicate Git author/committer code Factor out date/time format code into FormatDateTime function instead of duplicating it. --- Source/CTest/cmCTestGIT.cxx | 72 ++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 44 deletions(-) diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 3456ec4..aa9e55b 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -503,28 +503,7 @@ private: this->ParsePerson(this->Line.c_str()+7, author); this->Rev.Author = author.Name; this->Rev.EMail = author.EMail; - - // Convert the time to a human-readable format that is also easy - // to machine-parse: "CCYY-MM-DD hh:mm:ss". - time_t seconds = static_cast(author.Time); - struct tm* t = gmtime(&seconds); - char dt[1024]; - sprintf(dt, "%04d-%02d-%02d %02d:%02d:%02d", - t->tm_year+1900, t->tm_mon+1, t->tm_mday, - t->tm_hour, t->tm_min, t->tm_sec); - this->Rev.Date = dt; - - // Add the time-zone field "+zone" or "-zone". - char tz[32]; - if(author.TimeZone >= 0) - { - sprintf(tz, " +%04ld", author.TimeZone); - } - else - { - sprintf(tz, " -%04ld", -author.TimeZone); - } - this->Rev.Date += tz; + this->Rev.Date = this->FormatDateTime(author); } else if(strncmp(this->Line.c_str(), "committer ", 10) == 0) { @@ -532,28 +511,7 @@ private: this->ParsePerson(this->Line.c_str()+10, committer); this->Rev.Committer = committer.Name; this->Rev.CommitterEMail = committer.EMail; - - // Convert the time to a human-readable format that is also easy - // to machine-parse: "CCYY-MM-DD hh:mm:ss". - time_t seconds = static_cast(committer.Time); - struct tm* t = gmtime(&seconds); - char dt[1024]; - sprintf(dt, "%04d-%02d-%02d %02d:%02d:%02d", - t->tm_year+1900, t->tm_mon+1, t->tm_mday, - t->tm_hour, t->tm_min, t->tm_sec); - this->Rev.CommitDate = dt; - - // Add the time-zone field "+zone" or "-zone". - char tz[32]; - if(committer.TimeZone >= 0) - { - sprintf(tz, " +%04ld", committer.TimeZone); - } - else - { - sprintf(tz, " -%04ld", -committer.TimeZone); - } - this->Rev.CommitDate += tz; + this->Rev.CommitDate = this->FormatDateTime(committer); } } @@ -566,6 +524,32 @@ private: } this->Rev.Log += "\n"; } + + std::string FormatDateTime(Person const& person) + { + // Convert the time to a human-readable format that is also easy + // to machine-parse: "CCYY-MM-DD hh:mm:ss". + time_t seconds = static_cast(person.Time); + struct tm* t = gmtime(&seconds); + char dt[1024]; + sprintf(dt, "%04d-%02d-%02d %02d:%02d:%02d", + t->tm_year+1900, t->tm_mon+1, t->tm_mday, + t->tm_hour, t->tm_min, t->tm_sec); + std::string out = dt; + + // Add the time-zone field "+zone" or "-zone". + char tz[32]; + if(person.TimeZone >= 0) + { + sprintf(tz, " +%04ld", person.TimeZone); + } + else + { + sprintf(tz, " -%04ld", -person.TimeZone); + } + out += tz; + return out; + } }; char const cmCTestGIT::CommitParser::SectionSep[SectionCount] = -- cgit v0.12 From 667a90a0844a2b00a046e9597811c06905b6347d Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 21 Dec 2010 14:15:05 -0500 Subject: Fix sentence break in add_test documentation Commit 42de5d02 (Add WORKING_DIRECTORY argument to add_test, 2010-12-16) added a new sentence to a paragraph without separating it by " " from the previous sentence. Add the missing spaces. --- Source/cmAddTestCommand.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h index 9eb4e9f..6a0ace0 100644 --- a/Source/cmAddTestCommand.h +++ b/Source/cmAddTestCommand.h @@ -74,7 +74,7 @@ public: "add_executable) it will automatically be replaced by the location " "of the executable created at build time. " "If a CONFIGURATIONS option is given then the test will be executed " - "only when testing under one of the named configurations." + "only when testing under one of the named configurations. " "If a WORKING_DIRECTORY option is given then the test will be executed " "in the given directory." "\n" -- cgit v0.12 From d18c8d6ad7a9111f4fec515ae58096da744f3d61 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Tue, 21 Dec 2010 21:59:39 +0100 Subject: Fix crash in Eclipse generator with empty project (#11616) If there was no language at all enabled, CMAKE_BUILD_TYPE was empty, which was not expected, and made the generator crash. Alex --- Source/cmExtraEclipseCDT4Generator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 502fefa..0ef771f 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -201,7 +201,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() "\n" "\t" << this->GenerateProjectName(mf->GetProjectName(), - mf->GetDefinition("CMAKE_BUILD_TYPE"), + mf->GetSafeDefinition("CMAKE_BUILD_TYPE"), this->GetPathBasename(this->HomeOutputDirectory)) << "\n" "\t\n" -- cgit v0.12 From 104cd4acd8b104326e90267b20f91c9433e779b2 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Wed, 22 Dec 2010 00:01:15 -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 433a86f..124dd40 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 12) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 21) +SET(KWSYS_DATE_STAMP_DAY 22) -- cgit v0.12 From e498527f1ded497ddaf2d3285ace224f2e013a40 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 22 Dec 2010 16:28:54 -0500 Subject: Pass Mac linker flag through all compilers with -Wl, The Mac linker defines flag -headerpad_max_install_names but not all front-ends recognize the flag and pass it through (many did in the past, such as the Apple port of GCC). Use the -Wl, option prefix to tell front-ends to pass it through without trying to interpret it. --- Modules/Platform/Darwin-GNU.cmake | 4 ++-- Modules/Platform/Darwin-icc.cmake | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Modules/Platform/Darwin-GNU.cmake b/Modules/Platform/Darwin-GNU.cmake index f425eb9..8a50a6a 100644 --- a/Modules/Platform/Darwin-GNU.cmake +++ b/Modules/Platform/Darwin-GNU.cmake @@ -20,8 +20,8 @@ set(__DARWIN_COMPILER_GNU 1) macro(__darwin_compiler_gnu lang) # GNU does not have -shared on OS X - set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -headerpad_max_install_names") - set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -headerpad_max_install_names") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") + set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names") endmacro() macro(cmake_gnu_has_isysroot lang) diff --git a/Modules/Platform/Darwin-icc.cmake b/Modules/Platform/Darwin-icc.cmake index 49aa843..b62036c 100644 --- a/Modules/Platform/Darwin-icc.cmake +++ b/Modules/Platform/Darwin-icc.cmake @@ -33,11 +33,11 @@ SET(CMAKE_SHARED_MODULE_PREFIX "lib") SET(CMAKE_SHARED_MODULE_SUFFIX ".so") SET(CMAKE_MODULE_EXISTS 1) SET(CMAKE_DL_LIBS "") -SET(CMAKE_C_LINK_FLAGS "-headerpad_max_install_names") -SET(CMAKE_CXX_LINK_FLAGS "-headerpad_max_install_names") +SET(CMAKE_C_LINK_FLAGS "-Wl,-headerpad_max_install_names") +SET(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names") SET(CMAKE_PLATFORM_HAS_INSTALLNAME 1) -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -headerpad_max_install_names") -SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -headerpad_max_install_names") +SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") +SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -Wl,-headerpad_max_install_names") SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a") -- cgit v0.12 From 97e64e8607dd1f761eaa945c1cc525093725f3fc Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Thu, 23 Dec 2010 00:01: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 124dd40..c799cd9 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 12) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 22) +SET(KWSYS_DATE_STAMP_DAY 23) -- cgit v0.12 From d640d549d5f7648328f72180966b2a0cd604e29a Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Thu, 23 Dec 2010 09:21:56 -0700 Subject: allow absolute paths for dbus interface. --- Modules/Qt4Macros.cmake | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index 6a609a0..86a7404 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -254,7 +254,15 @@ MACRO(QT4_GENERATE_DBUS_INTERFACE _header) # _customName OPTIONS -some -options GET_FILENAME_COMPONENT(_basename ${_header} NAME_WE) IF (_customName) - SET(_target ${CMAKE_CURRENT_BINARY_DIR}/${_customName}) + if (IS_ABSOLUTE ${_customName}) + get_filename_component(_containingDir ${_customName} PATH) + if (NOT EXISTS ${_containingDir}) + file(MAKE_DIRECTORY "${_containingDir}") + endif() + SET(_target ${_customName}) + else() + SET(_target ${CMAKE_CURRENT_BINARY_DIR}/${_customName}) + endif() ELSE (_customName) SET(_target ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.xml) ENDIF (_customName) -- cgit v0.12 From 7159435843ddac21b2dc2b6b1079134ac1e25eef Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Fri, 24 Dec 2010 00:01: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 c799cd9..000d4ff 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 12) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 23) +SET(KWSYS_DATE_STAMP_DAY 24) -- cgit v0.12 From b1fdebc14c0592d6ca72aad4c3b29bccf1bae4b8 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sat, 25 Dec 2010 00:01:13 -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 000d4ff..c1f6f55 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 12) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 24) +SET(KWSYS_DATE_STAMP_DAY 25) -- cgit v0.12 From 0cbf312e895ad172ccea8c395b466efbf868ce41 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sun, 26 Dec 2010 00:01:24 -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 c1f6f55..c9b6b88 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 12) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 25) +SET(KWSYS_DATE_STAMP_DAY 26) -- cgit v0.12 From 0ccc5bcec6872ff6f49ee196e50aea77476a1f98 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Mon, 27 Dec 2010 00:01:14 -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 c9b6b88..1a9a24d 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 12) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 26) +SET(KWSYS_DATE_STAMP_DAY 27) -- cgit v0.12 From 1279bd7bac7c9970ae1ea76744d05299232e4b04 Mon Sep 17 00:00:00 2001 From: Alexey Ozeritsky Date: Mon, 27 Dec 2010 11:14:13 +0300 Subject: find ACML fixes --- Modules/FindLAPACK.cmake | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 40effb0..f7b7ab5 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -157,11 +157,21 @@ if(BLAS_FOUND) LAPACK cheev "" - "acml" + "acml;acml_mv" "" "" ) endif(NOT LAPACK_LIBRARIES) + if(NOT LAPACK_LIBRARIES) + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "acml_mp;acml_mv" + "" + ) + endif(NOT LAPACK_LIBRARIES) endif (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "All") # Apple LAPACK library? -- cgit v0.12 From e64b5daeced6ed29cc9fce252a137a097972b9ce Mon Sep 17 00:00:00 2001 From: Alexey Ozeritsky Date: Mon, 27 Dec 2010 11:37:46 +0300 Subject: fix for Fortran-only projects --- Modules/FindBLAS.cmake | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index b605164..d57513c 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -40,7 +40,11 @@ # License text for the above reference.) get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES) +if (NOT _LANGUAGES_ MATCHES Fortran) include(CheckFunctionExists) +else () +include(CheckFortranFunctionExists) +endif() macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _threads) # This macro checks for the existence of the combination of fortran libraries @@ -98,7 +102,11 @@ if(_libraries_work) # Test this combination of libraries. set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_threads}) # message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") - check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) + if (_LANGUAGES_ MATCHES Fortran) + check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) + else() + check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) + endif() set(CMAKE_REQUIRED_LIBRARIES) mark_as_advanced(${_prefix}${_combined_name}_WORKS) set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) -- cgit v0.12 From 51253da8bb193cdac4ac45ac43b250cecc2c0e87 Mon Sep 17 00:00:00 2001 From: Alexey Ozeritsky Date: Mon, 27 Dec 2010 11:42:41 +0300 Subject: FindLAPACK works with C/C++ only projects (issue 0009976) --- Modules/FindLAPACK.cmake | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index f7b7ab5..bf45406 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -37,17 +37,12 @@ # License text for the above reference.) get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES) -if(NOT _LANGUAGES_ MATCHES Fortran) - if(LAPACK_FIND_REQUIRED) - message(FATAL_ERROR - "FindLAPACK is Fortran-only so Fortran must be enabled.") - else(LAPACK_FIND_REQUIRED) - message(STATUS "Looking for LAPACK... - NOT found (Fortran not enabled)") - return() - endif(LAPACK_FIND_REQUIRED) -endif(NOT _LANGUAGES_ MATCHES Fortran) - +if (NOT _LANGUAGES_ MATCHES Fortran) +include(CheckFunctionExists) +else (NOT _LANGUAGES_ MATCHES Fortran) include(CheckFortranFunctionExists) +endif (NOT _LANGUAGES_ MATCHES Fortran) + set(LAPACK_FOUND FALSE) set(LAPACK95_FOUND FALSE) @@ -112,7 +107,11 @@ if(_libraries_work) set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas} ${_threads}) endif(UNIX AND BLA_STATIC) # message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") - check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS) + if (NOT _LANGUAGES_ MATCHES Fortran) + check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) + else (NOT _LANGUAGES_ MATCHES Fortran) + check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS) + endif (NOT _LANGUAGES_ MATCHES Fortran) set(CMAKE_REQUIRED_LIBRARIES) mark_as_advanced(${_prefix}${_combined_name}_WORKS) set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) @@ -170,6 +169,7 @@ if(BLAS_FOUND) "" "acml_mp;acml_mv" "" + "" ) endif(NOT LAPACK_LIBRARIES) endif (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "All") -- cgit v0.12 From 428e0e0ab95c7bd8cb4cddd637b36d338cad0c10 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Tue, 28 Dec 2010 00:01:24 -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 1a9a24d..0416938 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 12) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 27) +SET(KWSYS_DATE_STAMP_DAY 28) -- cgit v0.12 From 75191fa31281732ddbfd621af80bc188de9cd097 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 28 Dec 2010 09:56:15 -0500 Subject: KWSys: Avoid passing string literal as char* Pass the lpClass argument of RegCreateKeyEx as a real char[] instead of a string literal. At least one platform declares the argument as char* instead of "const char*". --- Source/kwsys/Registry.cxx | 3 ++- Source/kwsys/SystemTools.cxx | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/kwsys/Registry.cxx b/Source/kwsys/Registry.cxx index 284e8ad..cd521c9 100644 --- a/Source/kwsys/Registry.cxx +++ b/Source/kwsys/Registry.cxx @@ -401,8 +401,9 @@ bool RegistryHelper::Open(const char *toplevel, const char *subkey, } else { + char lpClass[] = ""; res = ( RegCreateKeyEx(scope, str.str().c_str(), - 0, "", REG_OPTION_NON_VOLATILE, KEY_READ|KEY_WRITE, + 0, lpClass, REG_OPTION_NON_VOLATILE, KEY_READ|KEY_WRITE, NULL, &this->HKey, &dwDummy) == ERROR_SUCCESS ); } if ( res != 0 ) diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 60d6869..cef2de6 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -734,10 +734,11 @@ bool SystemTools::WriteRegistryValue(const char *key, const char *value, HKEY hKey; DWORD dwDummy; + char lpClass[] = ""; if(RegCreateKeyEx(primaryKey, second.c_str(), 0, - "", + lpClass, REG_OPTION_NON_VOLATILE, SystemToolsMakeRegistryMode(KEY_WRITE, view), NULL, -- cgit v0.12 From 5e9d8a295295ac77dd8984f256420a6a6e4d5465 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Wed, 29 Dec 2010 00:01: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 0416938..68de67f 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 12) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 28) +SET(KWSYS_DATE_STAMP_DAY 29) -- cgit v0.12 From 91c06e90229ca74296f2644feac120dd3ae008f3 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Thu, 30 Dec 2010 00:01:10 -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 68de67f..fd586a7 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 12) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 29) +SET(KWSYS_DATE_STAMP_DAY 30) -- cgit v0.12 From 60fa5bac57a144bb0590550298dbe13d7a135c07 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Fri, 31 Dec 2010 00:01:19 -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 fd586a7..dfbe4bf 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 12) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 30) +SET(KWSYS_DATE_STAMP_DAY 31) -- cgit v0.12 From 6fbdac97d5a22cd9d0f1f994bb9c397618789b1b Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sat, 1 Jan 2011 00:01:24 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index dfbe4bf..114624e 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -12,10 +12,10 @@ #============================================================================= # KWSys version date year component. Format is CCYY. -SET(KWSYS_DATE_STAMP_YEAR 2010) +SET(KWSYS_DATE_STAMP_YEAR 2011) # KWSys version date month component. Format is MM. -SET(KWSYS_DATE_STAMP_MONTH 12) +SET(KWSYS_DATE_STAMP_MONTH 01) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 31) +SET(KWSYS_DATE_STAMP_DAY 01) -- cgit v0.12 From 4e0681abd75fc3cde7b6a63b91015c8b0eaf8c76 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sun, 2 Jan 2011 00:01: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 114624e..1a62653 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2011) SET(KWSYS_DATE_STAMP_MONTH 01) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 01) +SET(KWSYS_DATE_STAMP_DAY 02) -- cgit v0.12 From edff9207ed82d241077d66b20087657f74e8b5b9 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Mon, 3 Jan 2011 00:01:19 -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 1a62653..378e7bc 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2011) SET(KWSYS_DATE_STAMP_MONTH 01) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 02) +SET(KWSYS_DATE_STAMP_DAY 03) -- cgit v0.12 From 51bb49357495ea2742858ffe9d76ab3f44efc06e Mon Sep 17 00:00:00 2001 From: Zach Mullen Date: Mon, 3 Jan 2011 14:41:25 -0500 Subject: Test TIMEOUT property explicitly set to zero should be honored --- Source/CTest/cmCTestRunTest.cxx | 11 ++++-- Source/CTest/cmCTestRunTest.h | 4 +- Source/CTest/cmCTestTestHandler.cxx | 2 + Source/CTest/cmCTestTestHandler.h | 1 + Tests/CMakeLists.txt | 57 +++++++++++++++++----------- Tests/CTestTestZeroTimeout/CMakeLists.txt | 8 ++++ Tests/CTestTestZeroTimeout/CTestConfig.cmake | 7 ++++ Tests/CTestTestZeroTimeout/sleep.c | 16 ++++++++ Tests/CTestTestZeroTimeout/test.cmake.in | 23 +++++++++++ 9 files changed, 101 insertions(+), 28 deletions(-) create mode 100644 Tests/CTestTestZeroTimeout/CMakeLists.txt create mode 100644 Tests/CTestTestZeroTimeout/CTestConfig.cmake create mode 100644 Tests/CTestTestZeroTimeout/sleep.c create mode 100644 Tests/CTestTestZeroTimeout/test.cmake.in diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 76ff23a..42a4cff 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -455,7 +455,8 @@ bool cmCTestRunTest::StartTest(size_t total) { return false; } - return this->ForkProcess(timeout, &this->TestProperties->Environment); + return this->ForkProcess(timeout, this->TestProperties->ExplicitTimeout, + &this->TestProperties->Environment); } //---------------------------------------------------------------------- @@ -598,7 +599,7 @@ double cmCTestRunTest::ResolveTimeout() } //---------------------------------------------------------------------- -bool cmCTestRunTest::ForkProcess(double testTimeOut, +bool cmCTestRunTest::ForkProcess(double testTimeOut, bool explicitTimeout, std::vector* environment) { this->TestProcess = new cmProcess; @@ -619,12 +620,16 @@ bool cmCTestRunTest::ForkProcess(double testTimeOut, { timeout = testTimeOut; } - // always have at least 1 second if we got to here if (timeout <= 0) { timeout = 1; } + // handle timeout explicitly set to 0 + if (testTimeOut == 0 && explicitTimeout) + { + timeout = 0; + } cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index << ": " << "Test timeout computed to be: " << timeout << "\n"); diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h index 66e6b7b..89456d5 100644 --- a/Source/CTest/cmCTestRunTest.h +++ b/Source/CTest/cmCTestRunTest.h @@ -63,8 +63,8 @@ private: void ExeNotFound(std::string exe); // Figures out a final timeout which is min(STOP_TIME, NOW+TIMEOUT) double ResolveTimeout(); - bool ForkProcess(double testTimeOut, - std::vector* environment); + bool ForkProcess(double testTimeOut, bool explicitTimeout, + std::vector* environment); void WriteLogOutputTop(size_t completed, size_t total); //Run post processing of the process output for MemCheck void MemCheckPostProcess(); diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 6d1af2d..fdafb9b 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -2122,6 +2122,7 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "TIMEOUT" ) { rtit->Timeout = atof(val.c_str()); + rtit->ExplicitTimeout = true; } if ( key == "COST" ) { @@ -2295,6 +2296,7 @@ bool cmCTestTestHandler::AddTest(const std::vector& args) test.WillFail = false; test.RunSerial = false; test.Timeout = 0; + test.ExplicitTimeout = false; test.Cost = 0; test.Processors = 1; test.PreviousRuns = 0; diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 7049564..7aa8522 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -99,6 +99,7 @@ public: int PreviousRuns; bool RunSerial; double Timeout; + bool ExplicitTimeout; int Index; //Requested number of process slots int Processors; diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 289e632..466adda 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -45,18 +45,18 @@ IF(BUILD_TESTING) SET(TEST_BUILD_DIRS) # Should the long tests be run? - OPTION(CMAKE_RUN_LONG_TESTS + OPTION(CMAKE_RUN_LONG_TESTS "Should the long tests be run (such as Bootstrap)." ON) MARK_AS_ADVANCED(CMAKE_RUN_LONG_TESTS) IF (CMAKE_RUN_LONG_TESTS) - OPTION(CTEST_TEST_CTEST - "Should the tests that run a full sub ctest process be run?" + OPTION(CTEST_TEST_CTEST + "Should the tests that run a full sub ctest process be run?" OFF) MARK_AS_ADVANCED(CTEST_TEST_CTEST) OPTION(TEST_KDE4_STABLE_BRANCH - "Should the KDE4 stable branch test be run?" + "Should the KDE4 stable branch test be run?" OFF) MARK_AS_ADVANCED(TEST_KDE4_STABLE_BRANCH) ENDIF (CMAKE_RUN_LONG_TESTS) @@ -214,7 +214,7 @@ IF(BUILD_TESTING) # If we are running right now with a UnixMakefiles based generator, # build the "Simple" test with the ExtraGenerators, if available - # This doesn't test whether the generated project files work (unfortunately), + # This doesn't test whether the generated project files work (unfortunately), # mainly it tests that cmake doesn't crash when generating these project files. IF(${CMAKE_TEST_GENERATOR} MATCHES "Unix Makefiles" OR ${CMAKE_TEST_GENERATOR} MATCHES "KDevelop") # check which generators we have @@ -286,10 +286,10 @@ IF(BUILD_TESTING) ADD_TEST(SubProject-Stage2 ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/SubProject/foo" - "${CMake_BINARY_DIR}/Tests/SubProject/foo" + "${CMake_BINARY_DIR}/Tests/SubProject/foo" --build-generator ${CMAKE_TEST_GENERATOR} --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} - --build-nocmake + --build-nocmake --build-project foo --build-target foo --test-command foo @@ -347,7 +347,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-generator ${CMAKE_TEST_GENERATOR} --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-project TargetName - --test-command ${CMAKE_CMAKE_COMMAND} -E compare_files + --test-command ${CMAKE_CMAKE_COMMAND} -E compare_files ${CMake_SOURCE_DIR}/Tests/TargetName/scripts/hello_world ${CMake_BINARY_DIR}/Tests/TargetName/scripts/hello_world) LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TargetName") @@ -359,7 +359,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-two-config --build-generator ${CMAKE_TEST_GENERATOR} --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} - --build-project LibName + --build-project LibName --build-exe-dir "${CMake_BINARY_DIR}/Tests/LibName/lib" --test-command foobar ) @@ -372,7 +372,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-two-config --build-generator ${CMAKE_TEST_GENERATOR} --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} - --build-project CustComDepend + --build-project CustComDepend --build-exe-dir "${CMake_BINARY_DIR}/Tests/CustComDepend/bin" --test-command foo bar.c ) @@ -451,7 +451,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} ) LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BuildDepends") - + SET(SimpleInstallInstallDir "${CMake_BINARY_DIR}/Tests/SimpleInstall/InstallDirectory") ADD_TEST(SimpleInstall ${CMAKE_CTEST_COMMAND} @@ -884,7 +884,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ # RPATH isn't supported under Syllable, so the tests don't # find their libraries. In order to fix that LIBRARY_OUTPUT_DIR # in the tests would have to be adjusted to ${EXECUTABLE_OUTPUT_DIR}/lib . -# For now we just require on Syllable that the user adjusts the DLL_PATH +# For now we just require on Syllable that the user adjusts the DLL_PATH # environment variable, so except the two tests below all other tests will succeed. SET(_DLL_PATH "$ENV{DLL_PATH}") @@ -993,14 +993,14 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ # only add this test on platforms that support it # some old versions of make simply cannot handle spaces in paths - IF (MAKE_IS_GNU OR + IF (MAKE_IS_GNU OR "${CMAKE_TEST_MAKEPROGRAM}" MATCHES "nmake|gmake|wmake" OR "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio|XCode|Borland") ADD_TEST(SubDirSpaces ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/SubDirSpaces" "${CMake_BINARY_DIR}/Tests/SubDirSpaces" - --build-exe-dir + --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubDirSpaces/Executable Sources" --build-generator ${CMAKE_TEST_GENERATOR} --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} @@ -1106,7 +1106,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "${CMake_BINARY_DIR}/Tests/BundleGeneratorTest" --build-two-config --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-project BundleGeneratorTest --build-target package --build-options "-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/BundleGeneratorTest/InstallDirectory" @@ -1341,7 +1341,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ SET_TESTS_PROPERTIES(CTestTestCrash PROPERTIES PASS_REGULAR_EXPRESSION "SegFault") ENDIF(CMAKE_TEST_GENERATOR MATCHES "Watcom WMake") - + CONFIGURE_FILE( "${CMake_SOURCE_DIR}/Tests/CTestTestBadExe/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestBadExe/test.cmake" @@ -1419,7 +1419,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ #make sure all 3 subdirs were added SET_TESTS_PROPERTIES(CTestTestSubdir PROPERTIES PASS_REGULAR_EXPRESSION "0 tests failed out of 3") - + CONFIGURE_FILE( "${CMake_SOURCE_DIR}/Tests/CTestTestTimeout/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestTimeout/test.cmake" @@ -1433,6 +1433,17 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ PASS_REGULAR_EXPRESSION "TestTimeout *\\.+ *\\*\\*\\*Timeout.*CheckChild *\\.+ *Passed") CONFIGURE_FILE( + "${CMake_SOURCE_DIR}/Tests/CTestTestZeroTimeout/test.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestTestZeroTimeout/test.cmake" + @ONLY ESCAPE_QUOTES) + ADD_TEST(CTestTestZeroTimeout ${CMAKE_CTEST_COMMAND} + -S "${CMake_BINARY_DIR}/Tests/CTestTestZeroTimeout/test.cmake" -V + --output-log + "${CMake_BINARY_DIR}/Tests/CTestTestZeroTimeout/testOutput.log") + SET_TESTS_PROPERTIES(CTestTestZeroTimeout PROPERTIES + FAIL_REGULAR_EXPRESSION "\\*\\*\\*Timeout") + + CONFIGURE_FILE( "${CMake_SOURCE_DIR}/Tests/CTestTestDepends/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestDepends/test.cmake" @ONLY ESCAPE_QUOTES) @@ -1614,7 +1625,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ENDIF(UNIX) ENDIF (CMAKE_RUN_LONG_TESTS AND TEST_KDE4_STABLE_BRANCH) - + IF("${CMAKE_TEST_GENERATOR}" MATCHES Xcode) SET(CMAKE_SKIP_BOOTSTRAP_TEST 1) ENDIF("${CMAKE_TEST_GENERATOR}" MATCHES Xcode) @@ -1641,7 +1652,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-noclean --build-makeprogram ${bootstrap} --build-generator "${CMAKE_TEST_GENERATOR}" - --test-command + --test-command ${CMake_BINARY_DIR}/Tests/BootstrapTest/Bootstrap.cmk/cmake) LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BootstrapTest") # Make this test run early during parallel execution @@ -1735,8 +1746,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "-DCMAKE_C_COMPILER=${SDCC_EXECUTABLE}") LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleCOnly_sdcc") ENDIF(SDCC_EXECUTABLE) - - + + FIND_PROGRAM(MINGW_CC_LINUX2WIN_EXECUTABLE i586-mingw32msvc-gcc) FIND_PROGRAM(MINGW_CXX_LINUX2WIN_EXECUTABLE i586-mingw32msvc-g++) MARK_AS_ADVANCED(MINGW_CC_LINUX2WIN_EXECUTABLE MINGW_CXX_LINUX2WIN_EXECUTABLE) @@ -1754,8 +1765,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "-DCMAKE_CXX_COMPILER=${MINGW_CXX_LINUX2WIN_EXECUTABLE}") LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_Mingw_Linux2Win") ENDIF(MINGW_CC_LINUX2WIN_EXECUTABLE AND MINGW_CXX_LINUX2WIN_EXECUTABLE) - - + + ENDIF(CMAKE_TEST_GENERATOR MATCHES "Makefiles" OR CMAKE_TEST_GENERATOR MATCHES "KDevelop") IF(UNIX) diff --git a/Tests/CTestTestZeroTimeout/CMakeLists.txt b/Tests/CTestTestZeroTimeout/CMakeLists.txt new file mode 100644 index 0000000..8a5246d --- /dev/null +++ b/Tests/CTestTestZeroTimeout/CMakeLists.txt @@ -0,0 +1,8 @@ +CMAKE_MINIMUM_REQUIRED (VERSION 2.6) +PROJECT (CTestTestZeroTimeout) +INCLUDE (CTest) + +ADD_EXECUTABLE (Sleep sleep.c) + +ADD_TEST (TestExplicitZeroTimeout Sleep) +SET_TESTS_PROPERTIES(TestExplicitZeroTimeout PROPERTIES TIMEOUT 0) diff --git a/Tests/CTestTestZeroTimeout/CTestConfig.cmake b/Tests/CTestTestZeroTimeout/CTestConfig.cmake new file mode 100644 index 0000000..f8e0609 --- /dev/null +++ b/Tests/CTestTestZeroTimeout/CTestConfig.cmake @@ -0,0 +1,7 @@ +set(CTEST_PROJECT_NAME "CTestTestZeroTimeout") +set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") +set(CTEST_DART_SERVER_VERSION "2") +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "www.cdash.org") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestZeroTimeout/sleep.c b/Tests/CTestTestZeroTimeout/sleep.c new file mode 100644 index 0000000..d40d59d --- /dev/null +++ b/Tests/CTestTestZeroTimeout/sleep.c @@ -0,0 +1,16 @@ +#if defined(_WIN32) +# include +#else +# include +#endif + +/* sleeps for 5 seconds */ +int main(int argc, char** argv) +{ +#if defined(_WIN32) + Sleep(5000); +#else + sleep(5); +#endif + return 0; +} diff --git a/Tests/CTestTestZeroTimeout/test.cmake.in b/Tests/CTestTestZeroTimeout/test.cmake.in new file mode 100644 index 0000000..0ff32a4 --- /dev/null +++ b/Tests/CTestTestZeroTimeout/test.cmake.in @@ -0,0 +1,23 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.1) + +# Settings: +SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +SET(CTEST_SITE "@SITE@") +SET(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-ZeroTimeout") + +SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestZeroTimeout") +SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestZeroTimeout") +SET(CTEST_CVS_COMMAND "@CVSCOMMAND@") +SET(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +SET(CTEST_MEMORYCHECK_COMMAND "@MEMORYCHECK_COMMAND@") +SET(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE "@MEMORYCHECK_SUPPRESSIONS_FILE@") +SET(CTEST_MEMORYCHECK_COMMAND_OPTIONS "@MEMORYCHECK_COMMAND_OPTIONS@") +SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") +SET(CTEST_TEST_TIMEOUT 2) + +CTEST_START(Experimental) +CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -- cgit v0.12