diff options
25 files changed, 128 insertions, 11 deletions
diff --git a/Help/command/list.rst b/Help/command/list.rst index e6a7069..3c092bd 100644 --- a/Help/command/list.rst +++ b/Help/command/list.rst @@ -54,6 +54,17 @@ GET Returns the list of elements specified by indices from the list. +JOIN +"""" + +:: + + list(JOIN <list> <glue> <output variable>) + +Returns a string joining all list's elements using the glue string. +To join multiple strings, which are not part of a list, use ``JOIN`` operator +from :command:`string` command. + Search ^^^^^^ diff --git a/Help/command/string.rst b/Help/command/string.rst index cd94bb4..bb07d29 100644 --- a/Help/command/string.rst +++ b/Help/command/string.rst @@ -161,6 +161,10 @@ JOIN Join all the input arguments together using the glue string and store the result in the named output variable. +To join list's elements, use preferably the ``JOIN`` operator +from :command:`list` command. This allows for the elements to have +special characters like ``;`` in them. + TOLOWER """"""" diff --git a/Help/manual/cmake-compile-features.7.rst b/Help/manual/cmake-compile-features.7.rst index 0124395..e9495c6 100644 --- a/Help/manual/cmake-compile-features.7.rst +++ b/Help/manual/cmake-compile-features.7.rst @@ -335,7 +335,7 @@ versions specified for each: * ``Clang``: Clang compiler versions 2.9 through 3.4. * ``GNU``: GNU compiler versions 4.4 through 5.0. * ``MSVC``: Microsoft Visual Studio versions 2010 through 2017. -* ``SunPro``: Oracle SolarisStudio versions 12.4 through 12.5. +* ``SunPro``: Oracle SolarisStudio versions 12.4 through 12.6. * ``Intel``: Intel compiler versions 12.1 through 17.0. CMake is currently aware of the :prop_tgt:`C standards <C_STANDARD>` diff --git a/Help/prop_tgt/INSTALL_NAME_DIR.rst b/Help/prop_tgt/INSTALL_NAME_DIR.rst index a67ec15..34348bb 100644 --- a/Help/prop_tgt/INSTALL_NAME_DIR.rst +++ b/Help/prop_tgt/INSTALL_NAME_DIR.rst @@ -6,3 +6,7 @@ Mac OSX directory name for installed targets. INSTALL_NAME_DIR is a string specifying the directory portion of the "install_name" field of shared libraries on Mac OSX to use in the installed targets. + +This property is initialized by the value of the variable +:variable:`CMAKE_INSTALL_NAME_DIR` if it is set when a target is +created. diff --git a/Help/release/dev/list-join.rst b/Help/release/dev/list-join.rst new file mode 100644 index 0000000..0756b60 --- /dev/null +++ b/Help/release/dev/list-join.rst @@ -0,0 +1,5 @@ +list-join +--------- + +* The :command:`list` command learned a ``JOIN`` sub-command + to concatenate list's elements separated by a glue string. diff --git a/Modules/Compiler/SunPro-CXX-FeatureTests.cmake b/Modules/Compiler/SunPro-CXX-FeatureTests.cmake index 60280ca..279d875 100644 --- a/Modules/Compiler/SunPro-CXX-FeatureTests.cmake +++ b/Modules/Compiler/SunPro-CXX-FeatureTests.cmake @@ -1,10 +1,14 @@ # Based on GNU 4.8.2 -# http://docs.oracle.com/cd/E37069_01/html/E37071/gncix.html +# https://docs.oracle.com/cd/E37069_01/html/E37071/gncix.html +# https://docs.oracle.com/cd/E77782_01/html/E77784/gkeza.html # Reference: http://gcc.gnu.org/projects/cxx0x.html set(_cmake_oldestSupported "__SUNPRO_CC >= 0x5130") +set(SolarisStudio126_CXX11 "(__SUNPRO_CC >= 0x5150) && __cplusplus >= 201103L") +set(_cmake_feature_test_cxx_decltype_auto "${SolarisStudio126_CXX11}") + set(SolarisStudio125_CXX11 "(__SUNPRO_CC >= 0x5140) && __cplusplus >= 201103L") set(_cmake_feature_test_cxx_binary_literals "${SolarisStudio125_CXX11}") set(_cmake_feature_test_cxx_reference_qualified_functions "${SolarisStudio125_CXX11}") diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index 965948e..202d481 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -498,17 +498,17 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") set(_WX_TOOL gcc) elseif(MSVC) set(_WX_TOOL vc) - if(MSVC_VERSION EQUAL 1910) + if(NOT MSVC_VERSION LESS 1910) set(_WX_TOOLVER 141) - elseif(MSVC_VERSION EQUAL 1900) + elseif(NOT MSVC_VERSION LESS 1900) set(_WX_TOOLVER 140) - elseif(MSVC_VERSION EQUAL 1800) + elseif(NOT MSVC_VERSION LESS 1800) set(_WX_TOOLVER 120) - elseif(MSVC_VERSION EQUAL 1700) + elseif(NOT MSVC_VERSION LESS 1700) set(_WX_TOOLVER 110) - elseif(MSVC_VERSION EQUAL 1600) + elseif(NOT MSVC_VERSION LESS 1600) set(_WX_TOOLVER 100) - elseif(MSVC_VERSION EQUAL 1500) + elseif(NOT MSVC_VERSION LESS 1500) set(_WX_TOOLVER 90) endif() if(CMAKE_SIZEOF_VOID_P EQUAL 8) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ca63858..61d69bc 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180319) +set(CMake_VERSION_PATCH 20180321) #set(CMake_VERSION_RC 1) diff --git a/Source/CursesDialog/cmCursesStandardIncludes.h b/Source/CursesDialog/cmCursesStandardIncludes.h index 332d2af..60bad94 100644 --- a/Source/CursesDialog/cmCursesStandardIncludes.h +++ b/Source/CursesDialog/cmCursesStandardIncludes.h @@ -5,6 +5,11 @@ #include "cmConfigure.h" // IWYU pragma: keep +// Record whether __attribute__ is currently defined. See purpose below. +#ifndef __attribute__ +#define cm_no__attribute__ +#endif + #if defined(__hpux) #define _BOOL_DEFINED #include <sys/time.h> @@ -29,4 +34,12 @@ inline void curses_clear() #undef erase #undef clear +// The curses headers on some platforms (e.g. Solaris) may +// define __attribute__ as a macro. This breaks C++ headers +// in some cases, so undefine it now. +#if defined(cm_no__attribute__) && defined(__attribute__) +#undef __attribute__ +#endif +#undef cm_no__attribute__ + #endif // cmCursesStandardIncludes_h diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index e00450f..b82fc43 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -406,7 +406,7 @@ cmComputeLinkInformation::~cmComputeLinkInformation() } cmComputeLinkInformation::ItemVector const& -cmComputeLinkInformation::GetItems() +cmComputeLinkInformation::GetItems() const { return this->Items; } diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index f8c6214..6c67fb4 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -48,7 +48,7 @@ public: cmGeneratorTarget const* Target; }; typedef std::vector<Item> ItemVector; - ItemVector const& GetItems(); + ItemVector const& GetItems() const; std::vector<std::string> const& GetDirectories(); std::vector<std::string> const& GetDepends(); std::vector<std::string> const& GetFrameworkPaths(); diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index ae4f0a8..62d4ea7 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -42,6 +42,9 @@ bool cmListCommand::InitialPass(std::vector<std::string> const& args, if (subCommand == "INSERT") { return this->HandleInsertCommand(args); } + if (subCommand == "JOIN") { + return this->HandleJoinCommand(args); + } if (subCommand == "REMOVE_AT") { return this->HandleRemoveAtCommand(args); } @@ -294,6 +297,34 @@ bool cmListCommand::HandleInsertCommand(std::vector<std::string> const& args) return true; } +bool cmListCommand::HandleJoinCommand(std::vector<std::string> const& args) +{ + if (args.size() != 4) { + std::ostringstream error; + error << "sub-command JOIN requires three arguments (" << args.size() - 1 + << " found)."; + this->SetError(error.str()); + return false; + } + + const std::string& listName = args[1]; + const std::string& glue = args[2]; + const std::string& variableName = args[3]; + + // expand the variable + std::vector<std::string> varArgsExpanded; + if (!this->GetList(varArgsExpanded, listName)) { + this->Makefile->AddDefinition(variableName, ""); + return true; + } + + std::string value = + cmJoin(cmMakeRange(varArgsExpanded.begin(), varArgsExpanded.end()), glue); + + this->Makefile->AddDefinition(variableName, value.c_str()); + return true; +} + bool cmListCommand::HandleRemoveItemCommand( std::vector<std::string> const& args) { diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h index 2965399..d6870e6 100644 --- a/Source/cmListCommand.h +++ b/Source/cmListCommand.h @@ -37,6 +37,7 @@ protected: bool HandleAppendCommand(std::vector<std::string> const& args); bool HandleFindCommand(std::vector<std::string> const& args); bool HandleInsertCommand(std::vector<std::string> const& args); + bool HandleJoinCommand(std::vector<std::string> const& args); bool HandleRemoveAtCommand(std::vector<std::string> const& args); bool HandleRemoveItemCommand(std::vector<std::string> const& args); bool HandleRemoveDuplicatesCommand(std::vector<std::string> const& args); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 87d3c78..7e6e803 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -29,6 +29,7 @@ struct cmVisualStudio10TargetGenerator::Elem , Indent(i) { } + Elem(const Elem&) = delete; Elem(Elem& par) : S(par.S) , Indent(par.Indent + 1) @@ -47,6 +48,8 @@ struct cmVisualStudio10TargetGenerator::Elem if (HasElements) { S.fill(' '); S.width(Indent * 2); + // write an empty string to get the fill level indent to print + S << ""; S << "</" << tag << ">\n"; } else { S << " />\n"; diff --git a/Tests/RunCMake/list/JOIN-NoArguments-result.txt b/Tests/RunCMake/list/JOIN-NoArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/JOIN-NoArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/JOIN-NoArguments-stderr.txt b/Tests/RunCMake/list/JOIN-NoArguments-stderr.txt new file mode 100644 index 0000000..5e1b98f --- /dev/null +++ b/Tests/RunCMake/list/JOIN-NoArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at JOIN-NoArguments.cmake:1 \(list\): + list sub-command JOIN requires three arguments \(1 found\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/JOIN-NoArguments.cmake b/Tests/RunCMake/list/JOIN-NoArguments.cmake new file mode 100644 index 0000000..2ab449a --- /dev/null +++ b/Tests/RunCMake/list/JOIN-NoArguments.cmake @@ -0,0 +1 @@ +list(JOIN mylist) diff --git a/Tests/RunCMake/list/JOIN-NoVariable-result.txt b/Tests/RunCMake/list/JOIN-NoVariable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/JOIN-NoVariable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/JOIN-NoVariable-stderr.txt b/Tests/RunCMake/list/JOIN-NoVariable-stderr.txt new file mode 100644 index 0000000..db1d773 --- /dev/null +++ b/Tests/RunCMake/list/JOIN-NoVariable-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at JOIN-NoVariable.cmake:1 \(list\): + list sub-command JOIN requires three arguments \(2 found\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/JOIN-NoVariable.cmake b/Tests/RunCMake/list/JOIN-NoVariable.cmake new file mode 100644 index 0000000..b60d8f1 --- /dev/null +++ b/Tests/RunCMake/list/JOIN-NoVariable.cmake @@ -0,0 +1 @@ +list(JOIN mylist "glue") diff --git a/Tests/RunCMake/list/JOIN-TooManyArguments-result.txt b/Tests/RunCMake/list/JOIN-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/JOIN-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/JOIN-TooManyArguments-stderr.txt b/Tests/RunCMake/list/JOIN-TooManyArguments-stderr.txt new file mode 100644 index 0000000..2b09e22 --- /dev/null +++ b/Tests/RunCMake/list/JOIN-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at JOIN-TooManyArguments.cmake:1 \(list\): + list sub-command JOIN requires three arguments \(4 found\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/JOIN-TooManyArguments.cmake b/Tests/RunCMake/list/JOIN-TooManyArguments.cmake new file mode 100644 index 0000000..dc651f6 --- /dev/null +++ b/Tests/RunCMake/list/JOIN-TooManyArguments.cmake @@ -0,0 +1 @@ +list(JOIN mylist "glue" out one_too_many) diff --git a/Tests/RunCMake/list/JOIN.cmake b/Tests/RunCMake/list/JOIN.cmake new file mode 100644 index 0000000..24a623e --- /dev/null +++ b/Tests/RunCMake/list/JOIN.cmake @@ -0,0 +1,18 @@ +list(JOIN undefList % out) +if(NOT out STREQUAL "") + message(FATAL_ERROR "\"list(JOIN undefList % out)\" set out to \"${out}\"") +endif() +set(myList a) +list(JOIN myList % out) +if(NOT out STREQUAL "a") + message(FATAL_ERROR "\"list(JOIN \"a\" % out)\" set out to \"${out}\"") +endif() +set(myList a b) +list(JOIN myList % out) +if(NOT out STREQUAL "a%b") + message(FATAL_ERROR "\"list(JOIN \"a;b\" % out)\" set out to \"${out}\"") +endif() +list(JOIN myList "" out) +if(NOT out STREQUAL "ab") + message(FATAL_ERROR "\"list(JOIN \"a;b\" \"\" out a)\" set out to \"${out}\"") +endif() diff --git a/Tests/RunCMake/list/RunCMakeTest.cmake b/Tests/RunCMake/list/RunCMakeTest.cmake index b002ab3..1be4f85 100644 --- a/Tests/RunCMake/list/RunCMakeTest.cmake +++ b/Tests/RunCMake/list/RunCMakeTest.cmake @@ -15,6 +15,7 @@ run_cmake(INSERT-InvalidIndex) run_cmake(REMOVE_AT-InvalidIndex) run_cmake(FILTER-REGEX-TooManyArguments) +run_cmake(JOIN-TooManyArguments) run_cmake(LENGTH-TooManyArguments) run_cmake(REMOVE_DUPLICATES-TooManyArguments) run_cmake(REVERSE-TooManyArguments) @@ -31,3 +32,7 @@ run_cmake(FILTER-REGEX-InvalidMode) run_cmake(FILTER-REGEX-InvalidOperator) run_cmake(FILTER-REGEX-Valid0) run_cmake(FILTER-REGEX-Valid1) + +run_cmake(JOIN-NoArguments) +run_cmake(JOIN-NoVariable) +run_cmake(JOIN) |