diff options
-rw-r--r-- | Modules/CPackRPM.cmake | 16 | ||||
-rw-r--r-- | Modules/Compiler/GNU.cmake | 2 | ||||
-rw-r--r-- | Modules/FindProtobuf.cmake | 24 | ||||
-rw-r--r-- | Modules/FindQt4.cmake | 47 | ||||
-rw-r--r-- | Modules/UseQt4.cmake | 7 | ||||
-rw-r--r-- | Source/CTest/cmCTestRunTest.cxx | 24 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 4 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 117 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmScriptGenerator.cxx | 14 | ||||
-rw-r--r-- | Source/cmScriptGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmSourceGroupCommand.cxx | 34 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 32 | ||||
-rw-r--r-- | Source/cmSystemTools.h | 3 | ||||
-rw-r--r-- | Source/cmTestGenerator.cxx | 16 | ||||
-rw-r--r-- | Source/cmTestGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 11 | ||||
-rw-r--r-- | Source/kwsys/kwsysDateStamp.cmake | 2 | ||||
-rw-r--r-- | Tests/CMakeLists.txt | 2 |
19 files changed, 266 insertions, 95 deletions
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index b711bc2..729d8df 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -4,8 +4,10 @@ # used by CPack : http://www.cmake.org/Wiki/CMake:CPackConfiguration # # However CPackRPM has specific features which are controlled by -# the specifics CPACK_RPM_XXX variables. You'll find a detailed usage on -# the wiki: +# the specifics CPACK_RPM_XXX variables. +# Usually those vars correspond to RPM spec file entities, one may find +# information about spec files here http://www.rpm.org/wiki/Docs. +# You'll find a detailed usage of CPackRPM on the wiki: # http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#RPM_.28Unix_Only.29 # However as a handy reminder here comes the list of specific variables: # @@ -68,6 +70,8 @@ # Note that you must enclose the complete requires string between quotes, # for example: # set(CPACK_RPM_PACKAGE_REQUIRES "python >= 2.5.0, cmake >= 2.8") +# The required package list of an RPM file could be printed with +# rpm -qp --requires file.rpm # CPACK_RPM_PACKAGE_SUGGESTS # Mandatory : NO # Default : - @@ -77,6 +81,8 @@ # Mandatory : NO # Default : - # May be used to set RPM dependencies (provides). +# The provided package list of an RPM file could be printed with +# rpm -qp --provides file.rpm # CPACK_RPM_PACKAGE_OBSOLETES # Mandatory : NO # Default : - @@ -364,7 +370,7 @@ if(CPACK_RPM_PACKAGE_RELOCATABLE) endif(CPACK_RPM_PACKAGE_RELOCATABLE) # check if additional fields for RPM spec header are given -FOREACH(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX) +FOREACH(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV) IF(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}) STRING(LENGTH ${_RPM_SPEC_HEADER} _PACKAGE_HEADER_STRLENGTH) MATH(EXPR _PACKAGE_HEADER_STRLENGTH "${_PACKAGE_HEADER_STRLENGTH} - 1") @@ -573,6 +579,10 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@ \@TMP_RPM_REQUIRES\@ \@TMP_RPM_PROVIDES\@ \@TMP_RPM_OBSOLETES\@ +\@TMP_RPM_CONFLICTS\@ +\@TMP_RPM_AUTOPROV\@ +\@TMP_RPM_AUTOREQ\@ +\@TMP_RPM_AUTOREQPROV\@ \@TMP_RPM_BUILDARCH\@ \@TMP_RPM_PREFIX\@ diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index 0bb31f9..8d6f5df 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -33,6 +33,6 @@ macro(__compiler_gnu lang) set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") if(NOT APPLE) - set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ") + set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ") endif(NOT APPLE) endmacro() diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 88ef7cd..38f5a75 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -73,6 +73,20 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) return() endif(NOT ARGN) + if(PROTOBUF_GENERATE_CPP_APPEND_PATH) + # Create an include path for each file specified + foreach(FIL ${ARGN}) + get_filename_component(ABS_FIL ${FIL} ABSOLUTE) + get_filename_component(ABS_PATH ${ABS_FIL} PATH) + list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) + if(${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${ABS_PATH}) + endif() + endforeach() + else() + set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + set(${SRCS}) set(${HDRS}) foreach(FIL ${ARGN}) @@ -86,7 +100,7 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc" "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h" COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} - ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR} --proto_path ${CMAKE_CURRENT_SOURCE_DIR} ${ABS_FIL} + ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL} DEPENDS ${ABS_FIL} COMMENT "Running C++ protocol buffer compiler on ${FIL}" VERBATIM ) @@ -125,11 +139,17 @@ function(_protobuf_find_libraries name filename) endif() endfunction() - # # Main. # +# By default have PROTOBUF_GENERATE_CPP macro pass -I to protoc +# for each directory where a proto file is referenced. +if(NOT DEFINED PROTOBUF_GENERATE_CPP_APPEND_PATH) + set(PROTOBUF_GENERATE_CPP_APPEND_PATH TRUE) +endif() + + # Google's provided vcproj files generate libraries with a "lib" # prefix on Windows if(MSVC) diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 0a11cfb..86fce9d 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -375,12 +375,20 @@ MACRO (_QT4_ADJUST_LIB_VARS _camelCaseBasename) IF (QT_${basename}_LIBRARY_RELEASE) SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) - SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_RELEASE "${QT_${basename}_LIBRARY_RELEASE}" ) + if(QT_USE_FRAMEWORKS) + SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_RELEASE "${QT_${basename}_LIBRARY_RELEASE}/${_camelCaseBasename}" ) + else() + SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_RELEASE "${QT_${basename}_LIBRARY_RELEASE}" ) + endif() ENDIF (QT_${basename}_LIBRARY_RELEASE) IF (QT_${basename}_LIBRARY_DEBUG) SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) - SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}" ) + if(QT_USE_FRAMEWORKS) + SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}/${_camelCaseBasename}" ) + else() + SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}" ) + endif() ENDIF (QT_${basename}_LIBRARY_DEBUG) ENDIF(NOT TARGET Qt4::${_camelCaseBasename}) @@ -535,7 +543,7 @@ IF (QT_QMAKE_EXECUTABLE AND QTVERSION) # ask qmake for the library dir as a hint, then search for QtCore library and use that as a reference for finding the # others and for setting QT_LIBRARY_DIR - IF (NOT QT_QTCORE_LIBRARY OR QT_QMAKE_CHANGED) + IF (NOT (QT_QTCORE_LIBRARY_RELEASE OR QT_QTCORE_LIBRARY_DEBUG) OR QT_QMAKE_CHANGED) _qt4_query_qmake(QT_INSTALL_LIBS QT_LIBRARY_DIR_TMP) SET(QT_QTCORE_LIBRARY_RELEASE NOTFOUND) SET(QT_QTCORE_LIBRARY_DEBUG NOTFOUND) @@ -568,7 +576,18 @@ IF (QT_QMAKE_EXECUTABLE AND QTVERSION) ENDIF(EXISTS ${QT_LIBRARY_DIR_TMP}/libqtmain.a) ENDIF(NOT QT_QTCORE_LIBRARY_RELEASE AND MSVC) - ENDIF (NOT QT_QTCORE_LIBRARY OR QT_QMAKE_CHANGED) + ENDIF () + + IF (APPLE) + SET(CMAKE_FIND_FRAMEWORK_OLD ${CMAKE_FIND_FRAMEWORK}) + IF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) + SET(QT_USE_FRAMEWORKS ON CACHE INTERNAL "" FORCE) + SET(CMAKE_FIND_FRAMEWORK FIRST) + ELSE (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) + SET(QT_USE_FRAMEWORKS OFF CACHE INTERNAL "" FORCE) + SET(CMAKE_FIND_FRAMEWORK LAST) + ENDIF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) + ENDIF (APPLE) _QT4_ADJUST_LIB_VARS(QtCore) @@ -589,18 +608,6 @@ IF (QT_QMAKE_EXECUTABLE AND QTVERSION) ENDIF(Qt4_FIND_REQUIRED) ENDIF() - IF (APPLE) - SET(CMAKE_FIND_FRAMEWORK_OLD ${CMAKE_FIND_FRAMEWORK}) - IF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) - SET(QT_USE_FRAMEWORKS ON CACHE INTERNAL "" FORCE) - SET(CMAKE_FIND_FRAMEWORK FIRST) - ELSE (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) - SET(QT_USE_FRAMEWORKS OFF CACHE INTERNAL "" FORCE) - SET(CMAKE_FIND_FRAMEWORK LAST) - ENDIF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) - MARK_AS_ADVANCED(QT_USE_FRAMEWORKS) - ENDIF (APPLE) - # ask qmake for the binary dir IF (NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED) _qt4_query_qmake(QT_INSTALL_BINS qt_bins) @@ -640,7 +647,7 @@ IF (QT_QMAKE_EXECUTABLE AND QTVERSION) # Qt/Mac frameworks has two include dirs. # One is the framework include for which CMake will add a -F flag # and the other is an include dir for non-framework Qt modules - SET(QT_INCLUDE_DIR ${QT_HEADERS_DIR} ${QT_QTCORE_LIBRARY} ) + SET(QT_INCLUDE_DIR ${QT_HEADERS_DIR} ${QT_QTCORE_LIBRARY_RELEASE} ) ELSE(QT_USE_FRAMEWORKS) SET(QT_INCLUDE_DIR ${QT_HEADERS_DIR}) ENDIF(QT_USE_FRAMEWORKS) @@ -894,12 +901,6 @@ IF (QT_QMAKE_EXECUTABLE AND QTVERSION) # ############################################ - # On OSX when Qt is found as framework, never use the imported targets for now, since - # in this case the handling of the framework directory currently does not work correctly. - IF(QT_USE_FRAMEWORKS) - SET(QT_USE_IMPORTED_TARGETS FALSE) - ENDIF(QT_USE_FRAMEWORKS) - # Set QT_xyz_LIBRARY variable and add # library include path to QT_INCLUDES diff --git a/Modules/UseQt4.cmake b/Modules/UseQt4.cmake index ab028ed..9ce475c 100644 --- a/Modules/UseQt4.cmake +++ b/Modules/UseQt4.cmake @@ -66,6 +66,13 @@ SET(QT_QTSCRIPTTOOLS_MODULE_DEPENDS QTGUI QTCORE) SET(QT_QTWEBKIT_MODULE_DEPENDS QTXMLPATTERNS QTGUI QTCORE) SET(QT_QTDECLARATIVE_MODULE_DEPENDS QTWEBKIT QTSCRIPT QTSVG QTSQL QTXMLPATTERNS QTXML QTOPENGL QTGUI QTNETWORK QTCORE) SET(QT_QTMULTIMEDIA_MODULE_DEPENDS QTGUI QTCORE) +SET(QT_QTOPENGL_MODULE_DEPENDS QTGUI QTCORE) +SET(QT_QTSCRIPT_MODULE_DEPENDS QTCORE) +SET(QT_QTGUI_MODULE_DEPENDS QTCORE) +SET(QT_QTTEST_MODULE_DEPENDS QTCORE) +SET(QT_QTXML_MODULE_DEPENDS QTCORE) +SET(QT_QTSQL_MODULE_DEPENDS QTCORE) +SET(QT_QTNETWORK_MODULE_DEPENDS QTCORE) # Qt modules (in order of dependence) FOREACH(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index b5b46f6..60695da 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -412,6 +412,30 @@ bool cmCTestRunTest::StartTest(size_t total) this->TestResult.TestCount = this->TestProperties->Index; this->TestResult.Name = this->TestProperties->Name; this->TestResult.Path = this->TestProperties->Directory.c_str(); + + if(args.size() >= 2 && args[1] == "NOT_AVAILABLE") + { + this->TestProcess = new cmProcess; + std::string msg; + if(this->CTest->GetConfigType().empty()) + { + msg = "Test not available without configuration."; + msg += " (Missing \"-C <config>\"?)"; + } + else + { + msg = "Test not available in configuration \""; + msg += this->CTest->GetConfigType(); + msg += "\"."; + } + *this->TestHandler->LogFile << msg << std::endl; + cmCTestLog(this->CTest, ERROR_MESSAGE, msg << std::endl); + this->TestResult.Output = msg; + this->TestResult.FullCommandLine = ""; + this->TestResult.CompletionStatus = "Not Run"; + this->TestResult.Status = cmCTestTestHandler::NOT_RUN; + return false; + } // Check if all required files exist for(std::vector<std::string>::iterator i = diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 56f6630..e3b81df 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1320,6 +1320,10 @@ std::string cmCTestTestHandler::FindTheExecutable(const char *exe) std::string resConfig; std::vector<std::string> extraPaths; std::vector<std::string> failedPaths; + if(strcmp(exe, "NOT_AVAILABLE") == 0) + { + return exe; + } return cmCTestTestHandler::FindExecutable(this->CTest, exe, resConfig, extraPaths, diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 20eb50b..2cbd3ed 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2517,62 +2517,119 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root, } } +cmXCodeObject *cmGlobalXCodeGenerator +::CreatePBXGroup(cmXCodeObject *parent, cmStdString name) +{ + cmXCodeObject* parentChildren = NULL; + if(parent) + parentChildren = parent->GetObject("children"); + cmXCodeObject* group = this->CreateObject(cmXCodeObject::PBXGroup); + cmXCodeObject* groupChildren = + this->CreateObject(cmXCodeObject::OBJECT_LIST); + group->AddAttribute("name", this->CreateString(name.c_str())); + group->AddAttribute("children", groupChildren); + if(this->XcodeVersion == 15) + { + group->AddAttribute("refType", this->CreateString("4")); + } + group->AddAttribute("sourceTree", this->CreateString("<group>")); + if(parentChildren) + parentChildren->AddObject(group); + return group; +} + //---------------------------------------------------------------------------- cmXCodeObject* cmGlobalXCodeGenerator ::CreateOrGetPBXGroup(cmTarget& cmtarget, cmSourceGroup* sg) { - cmStdString s = cmtarget.GetName(); - s += "/"; - s += sg->GetName(); - std::map<cmStdString, cmXCodeObject* >::iterator i = + cmStdString s; + cmStdString target; + const char *targetFolder= cmtarget.GetProperty("FOLDER"); + if(targetFolder) { + target = targetFolder; + target += "/"; + } + target += cmtarget.GetName(); + s = target + "/"; + s += sg->GetFullName(); + std::map<cmStdString, cmXCodeObject* >::iterator it = this->GroupNameMap.find(s); - if(i != this->GroupNameMap.end()) + if(it != this->GroupNameMap.end()) { - return i->second; + return it->second; } - i = this->TargetGroup.find(cmtarget.GetName()); + + it = this->TargetGroup.find(target); cmXCodeObject* tgroup = 0; - if(i != this->TargetGroup.end()) + if(it != this->TargetGroup.end()) { - tgroup = i->second; + tgroup = it->second; } else { - tgroup = this->CreateObject(cmXCodeObject::PBXGroup); - this->TargetGroup[cmtarget.GetName()] = tgroup; - cmXCodeObject* tgroupChildren = - this->CreateObject(cmXCodeObject::OBJECT_LIST); - tgroup->AddAttribute("name", this->CreateString(cmtarget.GetName())); - tgroup->AddAttribute("children", tgroupChildren); - if(this->XcodeVersion == 15) + std::vector<std::string> tgt_folders = + cmSystemTools::tokenize(target, "/"); + cmStdString curr_tgt_folder; + for(std::vector<std::string>::size_type i = 0; i < tgt_folders.size();i++) { - tgroup->AddAttribute("refType", this->CreateString("4")); + curr_tgt_folder += tgt_folders[i]; + it = this->TargetGroup.find(curr_tgt_folder); + if(it == this->TargetGroup.end()) + { + tgroup = this->CreatePBXGroup(tgroup,tgt_folders[i]); + this->TargetGroup[curr_tgt_folder] = tgroup; + } + else + { + tgroup = it->second; + continue; + } + if(i == 0) + { + this->SourcesGroupChildren->AddObject(tgroup); + } + curr_tgt_folder += "/"; } - tgroup->AddAttribute("sourceTree", this->CreateString("<group>")); - this->SourcesGroupChildren->AddObject(tgroup); } + this->TargetGroup[target] = tgroup; // If it's the default source group (empty name) then put the source file // directly in the tgroup... // - if (cmStdString(sg->GetName()) == "") + if (cmStdString(sg->GetFullName()) == "") { this->GroupNameMap[s] = tgroup; return tgroup; } - cmXCodeObject* tgroupChildren = tgroup->GetObject("children"); - cmXCodeObject* group = this->CreateObject(cmXCodeObject::PBXGroup); - cmXCodeObject* groupChildren = - this->CreateObject(cmXCodeObject::OBJECT_LIST); - group->AddAttribute("name", this->CreateString(sg->GetName())); - group->AddAttribute("children", groupChildren); - if(this->XcodeVersion == 15) + //It's a recursive folder structure, let's find the real parent group + if(std::string(sg->GetFullName()) != std::string(sg->GetName())) { - group->AddAttribute("refType", this->CreateString("4")); + std::vector<std::string> folders = + cmSystemTools::tokenize(sg->GetFullName(), "\\"); + cmStdString curr_folder = cmtarget.GetName(); + curr_folder += "/"; + for(std::vector<std::string>::size_type i = 0; i < folders.size();i++) + { + curr_folder += folders[i]; + std::map<cmStdString, cmXCodeObject* >::iterator i_folder = + this->GroupNameMap.find(curr_folder); + //Create new folder + if(i_folder == this->GroupNameMap.end()) + { + cmXCodeObject *group = this->CreatePBXGroup(tgroup,folders[i]); + this->GroupNameMap[curr_folder] = group; + tgroup = group; + } + else + { + tgroup = i_folder->second; + } + curr_folder = curr_folder + "\\"; + } + return tgroup; } - group->AddAttribute("sourceTree", this->CreateString("<group>")); - tgroupChildren->AddObject(group); + cmXCodeObject *group = this->CreatePBXGroup(tgroup,sg->GetName()); this->GroupNameMap[s] = group; return group; } diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index eec6df0..39a5fd7 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -88,6 +88,8 @@ public: private: cmXCodeObject* CreateOrGetPBXGroup(cmTarget& cmtarget, cmSourceGroup* sg); + cmXCodeObject* CreatePBXGroup(cmXCodeObject *parent, + cmStdString name); void CreateGroups(cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx index 86ecebe..cabe98a 100644 --- a/Source/cmScriptGenerator.cxx +++ b/Source/cmScriptGenerator.cxx @@ -209,6 +209,7 @@ void cmScriptGenerator::GenerateScriptActionsPerConfig(std::ostream& os, // In a multi-configuration generator we produce a separate rule // in a block for each configuration that is built. We restrict // the list of configurations to those to which this rule applies. + bool first = true; for(std::vector<std::string>::const_iterator i = this->ConfigurationTypes->begin(); i != this->ConfigurationTypes->end(); ++i) @@ -218,10 +219,19 @@ void cmScriptGenerator::GenerateScriptActionsPerConfig(std::ostream& os, { // Generate a per-configuration block. std::string config_test = this->CreateConfigTest(config); - os << indent << "IF(" << config_test << ")\n"; + os << indent << (first? "IF(" : "ELSEIF(") << config_test << ")\n"; this->GenerateScriptForConfig(os, config, indent.Next()); - os << indent << "ENDIF(" << config_test << ")\n"; + first = false; } } + if(!first) + { + if(this->NeedsScriptNoConfig()) + { + os << indent << "ELSE()\n"; + this->GenerateScriptNoConfig(os, indent.Next()); + } + os << indent << "ENDIF()\n"; + } } } diff --git a/Source/cmScriptGenerator.h b/Source/cmScriptGenerator.h index e2a0da5..8b2ca33 100644 --- a/Source/cmScriptGenerator.h +++ b/Source/cmScriptGenerator.h @@ -65,6 +65,8 @@ protected: virtual void GenerateScriptForConfig(std::ostream& os, const char* config, Indent const& indent); + virtual void GenerateScriptNoConfig(std::ostream&, Indent const&) {} + virtual bool NeedsScriptNoConfig() const { return false; } // Test if this generator does something for a given configuration. bool GeneratesForConfig(const char*); diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx index 27d90db..8e61d0a 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/Source/cmSourceGroupCommand.cxx @@ -11,37 +11,6 @@ ============================================================================*/ #include "cmSourceGroupCommand.h" -inline std::vector<std::string> tokenize(const std::string& str, - const std::string& sep) -{ - std::vector<std::string> tokens; - std::string::size_type tokend = 0; - - do - { - std::string::size_type tokstart=str.find_first_not_of(sep, tokend); - if (tokstart==std::string::npos) - { - break; // no more tokens - } - tokend=str.find_first_of(sep,tokstart); - if (tokend==std::string::npos) - { - tokens.push_back(str.substr(tokstart)); - } - else - { - tokens.push_back(str.substr(tokstart,tokend-tokstart)); - } - } while (tokend!=std::string::npos); - - if (tokens.empty()) - { - tokens.push_back(""); - } - return tokens; -} - // cmSourceGroupCommand bool cmSourceGroupCommand ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) @@ -58,7 +27,8 @@ bool cmSourceGroupCommand delimiter = this->Makefile->GetDefinition("SOURCE_GROUP_DELIMITER"); } - std::vector<std::string> folders = tokenize(args[0], delimiter); + std::vector<std::string> folders = + cmSystemTools::tokenize(args[0], delimiter); cmSourceGroup* sg = 0; sg = this->Makefile->GetSourceGroup(folders); diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index c40e905..dbb2226 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2919,3 +2919,35 @@ bool cmSystemTools::RepeatedRemoveDirectory(const char* dir) } return false; } + +//---------------------------------------------------------------------------- +std::vector<std::string> cmSystemTools::tokenize(const std::string& str, + const std::string& sep) +{ + std::vector<std::string> tokens; + std::string::size_type tokend = 0; + + do + { + std::string::size_type tokstart=str.find_first_not_of(sep, tokend); + if (tokstart==std::string::npos) + { + break; // no more tokens + } + tokend=str.find_first_of(sep,tokstart); + if (tokend==std::string::npos) + { + tokens.push_back(str.substr(tokstart)); + } + else + { + tokens.push_back(str.substr(tokstart,tokend-tokstart)); + } + } while (tokend!=std::string::npos); + + if (tokens.empty()) + { + tokens.push_back(""); + } + return tokens; +} diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index fc85d4a..ce49959 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -444,6 +444,9 @@ public: /** Remove a directory; repeat a few times in case of locked files. */ static bool RepeatedRemoveDirectory(const char* dir); + /** Tokenize a string */ + static std::vector<std::string> tokenize(const std::string& str, + const std::string& sep); private: static bool s_ForceUnixPaths; static bool s_RunCommandHideConsole; diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index 39f8638..e0892b2 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -130,6 +130,22 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, } //---------------------------------------------------------------------------- +void cmTestGenerator::GenerateScriptNoConfig(std::ostream& os, + Indent const& indent) +{ + os << indent << "ADD_TEST(" << this->Test->GetName() << " NOT_AVAILABLE)\n"; +} + +//---------------------------------------------------------------------------- +bool cmTestGenerator::NeedsScriptNoConfig() const +{ + return (this->TestGenerated && // test generated for at least one config + this->ActionsPerConfig && // test is config-aware + this->Configurations.empty() && // test runs in all configs + !this->ConfigurationTypes->empty()); // config-dependent command +} + +//---------------------------------------------------------------------------- void cmTestGenerator::GenerateOldStyle(std::ostream& fout, Indent const& indent) { diff --git a/Source/cmTestGenerator.h b/Source/cmTestGenerator.h index 85d9091..2c69fc3 100644 --- a/Source/cmTestGenerator.h +++ b/Source/cmTestGenerator.h @@ -34,6 +34,8 @@ protected: virtual void GenerateScriptForConfig(std::ostream& os, const char* config, Indent const& indent); + virtual void GenerateScriptNoConfig(std::ostream& os, Indent const& indent); + virtual bool NeedsScriptNoConfig() const; void GenerateOldStyle(std::ostream& os, Indent const& indent); cmTest* Test; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 6d2338e..2a4ff92 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -351,6 +351,9 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source, { if(!cmSystemTools::FileExists(sourcePath.c_str())) { + // Make sure the path exists for the file + std::string path = cmSystemTools::GetFilenamePath(sourcePath); + cmSystemTools::MakeDirectory(path.c_str()); std::ofstream fout(sourcePath.c_str()); if(fout) { @@ -358,6 +361,14 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source, fout.flush(); fout.close(); } + else + { + std::string error = "Could not create file: ["; + error += sourcePath; + error += "] "; + cmSystemTools::Error + (error.c_str(), cmSystemTools::GetLastSystemError().c_str()); + } } } cmLocalVisualStudio7Generator* lg = this->LocalGenerator; diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 85d1bee..d6b6c43 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 06) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 08) +SET(KWSYS_DATE_STAMP_DAY 14) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 1be2a24..2ad9a77 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1310,7 +1310,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory" --force-new-ctest-process - --test-command ${CMAKE_CTEST_COMMAND} -V + --test-command ${CMAKE_CTEST_COMMAND} -V -C \${CTEST_CONFIGURATION_TYPE} ) LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory") |