diff options
33 files changed, 294 insertions, 27 deletions
diff --git a/Help/cpack_gen/ifw.rst b/Help/cpack_gen/ifw.rst index e43b1d6..feccd3d 100644 --- a/Help/cpack_gen/ifw.rst +++ b/Help/cpack_gen/ifw.rst @@ -135,6 +135,10 @@ Package Wizard style to be used ("Modern", "Mac", "Aero" or "Classic"). +.. variable:: CPACK_IFW_PACKAGE_STYLE_SHEET + + Filename for a stylesheet. + .. variable:: CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH Default width of the wizard in pixels. Setting a banner image will override this. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 3dc3221..ce62893 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -404,16 +404,25 @@ Target-Dependent Queries :prop_tgt:`LIBRARY_OUTPUT_NAME_<CONFIG>` and :prop_tgt:`RUNTIME_OUTPUT_NAME_<CONFIG>`. + The :prop_tgt:`<CONFIG>_POSTFIX` and :prop_tgt:`DEBUG_POSTFIX` target + properties can also be considered. + Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. ``$<TARGET_FILE_PREFIX:tgt>`` Prefix of main file where ``tgt`` is the name of a target. + See also the :prop_tgt:`PREFIX` target property. + Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. ``$<TARGET_FILE_SUFFIX:tgt>`` Suffix of main file where ``tgt`` is the name of a target. + The suffix corresponds to the file extension (such as ".so" or ".exe"). + + See also the :prop_tgt:`SUFFIX` target property. + Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. ``$<TARGET_FILE_NAME:tgt>`` @@ -435,16 +444,27 @@ Target-Dependent Queries :prop_tgt:`ARCHIVE_OUTPUT_NAME_<CONFIG>` and :prop_tgt:`LIBRARY_OUTPUT_NAME_<CONFIG>`. + The :prop_tgt:`<CONFIG>_POSTFIX` and :prop_tgt:`DEBUG_POSTFIX` target + properties can also be considered. + Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. ``$<TARGET_LINKER_FILE_PREFIX:tgt>`` Prefix of file used to link where ``tgt`` is the name of a target. + See also the :prop_tgt:`PREFIX` and :prop_tgt:`IMPORT_PREFIX` target + properties. + Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. ``$<TARGET_LINKER_FILE_SUFFIX:tgt>`` Suffix of file used to link where ``tgt`` is the name of a target. + The suffix corresponds to the file extension (such as ".so" or ".lib"). + + See also the :prop_tgt:`SUFFIX` and :prop_tgt:`IMPORT_SUFFIX` target + properties. + Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. ``$<TARGET_LINKER_FILE_NAME:tgt>`` @@ -475,6 +495,9 @@ Target-Dependent Queries See also the :prop_tgt:`PDB_NAME` target property and its configuration specific variant :prop_tgt:`PDB_NAME_<CONFIG>`. + The :prop_tgt:`<CONFIG>_POSTFIX` and :prop_tgt:`DEBUG_POSTFIX` target + properties can also be considered. + Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. ``$<TARGET_PDB_FILE_NAME:tgt>`` diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 3e1680c..df0d4c5 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -286,6 +286,9 @@ following options: The :envvar:`CMAKE_BUILD_PARALLEL_LEVEL` environment variable, if set, specifies a default parallel level when this option is not given. + Some native build tools always build in parallel. The use of ``<jobs>`` + value of ``1`` can be used to limit to a single job. + ``--target <tgt>..., -t <tgt>...`` Build ``<tgt>`` instead of default targets. May be specified multiple times. diff --git a/Help/release/dev/cpackifw-package-style-sheet.rst b/Help/release/dev/cpackifw-package-style-sheet.rst new file mode 100644 index 0000000..cf99244 --- /dev/null +++ b/Help/release/dev/cpackifw-package-style-sheet.rst @@ -0,0 +1,6 @@ +cpackifw-package-style-sheet +---------------------------- + +* The :cpack_gen:`CPack IFW Generator` gained a new + :variable:`CPACK_IFW_PACKAGE_STYLE_SHEET` variable to customize the + installer stylesheet. diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index c1c9982..746a806 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -189,7 +189,7 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} set(id_platform ${CMAKE_VS_PLATFORM_NAME}) set(id_lang "${lang}") set(id_PostBuildEvent_Command "") - if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "^[Ll][Ll][Vv][Mm]$") + if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "^[Ll][Ll][Vv][Mm](_v[0-9]+(_xp)?)?$") set(id_cl_var "ClangClExecutable") elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*") set(id_cl clang.exe) diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index 6fb0200..c116078 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -29,9 +29,11 @@ if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5) set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14") set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14") + set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y") set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") + set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) endif() set(_clang_version_std17 5.0) diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake index 1253291..fcaaeab 100644 --- a/Modules/Compiler/GNU-CXX.cmake +++ b/Modules/Compiler/GNU-CXX.cmake @@ -38,6 +38,10 @@ elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") endif() +if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) + set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) +endif() + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0) set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17") set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17") diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake index 032071c..44b0c3d 100644 --- a/Modules/Compiler/Intel-CXX.cmake +++ b/Modules/Compiler/Intel-CXX.cmake @@ -40,6 +40,16 @@ else() set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17") endif() + # While full C++14 support was first introduced in Intel 17, + # Intel 18.0.0-4 don't have full support as they broke + # support for cxx_relaxed_constexpr. + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 18.0.4) + set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) + elseif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17.0.0 + AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0.0) + set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) + endif() + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.2) set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14") elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.0) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a6c9d01..6bedd4e 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 14) -set(CMake_VERSION_PATCH 20190503) +set(CMake_VERSION_PATCH 20190506) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 01e3ea4..a075a17 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -152,6 +152,15 @@ void cmCPackIFWInstaller::ConfigureFromOptions() } } + // StyleSheet + if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_STYLE_SHEET")) { + if (cmSystemTools::FileExists(option)) { + this->StyleSheet = option; + } else { + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_STYLE_SHEET", option); + } + } + // WizardDefaultWidth if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH")) { @@ -381,6 +390,14 @@ void cmCPackIFWInstaller::GenerateInstallerFile() xout.Element("WizardStyle", this->WizardStyle); } + // Stylesheet + if (!this->StyleSheet.empty()) { + std::string name = cmSystemTools::GetFilenameName(this->StyleSheet); + std::string path = this->Directory + "/config/" + name; + cmsys::SystemTools::CopyFileIfDifferent(this->StyleSheet, path); + xout.Element("StyleSheet", name); + } + // WizardDefaultWidth if (!this->WizardDefaultWidth.empty()) { xout.Element("WizardDefaultWidth", this->WizardDefaultWidth); diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h index 37ad339..be51fa5 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.h +++ b/Source/CPack/IFW/cmCPackIFWInstaller.h @@ -72,6 +72,9 @@ public: /// Wizard style name std::string WizardStyle; + /// Filename for a style sheet + std::string StyleSheet; + /// Wizard width std::string WizardDefaultWidth; diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 3ceb824..58b9e70 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -98,6 +98,7 @@ static void cpackProgressCallback(const std::string& message, float /*unused*/) // this is CPack. int main(int argc, char const* const* argv) { + cmSystemTools::EnsureStdPipes(); #if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE) // Replace streambuf so we can output Unicode to console cmsys::ConsoleBuf::Manager consoleOut(std::cout); diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index 745c6bb..7caed0c 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -67,6 +67,7 @@ void onsig(int /*unused*/) int main(int argc, char const* const* argv) { + cmSystemTools::EnsureStdPipes(); cmsys::Encoding::CommandLineArguments encoding_args = cmsys::Encoding::CommandLineArguments::Main(argc, argv); argc = encoding_args.argc(); diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 8d9a50c..c9ebba8 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -55,6 +55,7 @@ Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin); int main(int argc, char** argv) { + cmSystemTools::EnsureStdPipes(); cmsys::Encoding::CommandLineArguments encoding_args = cmsys::Encoding::CommandLineArguments::Main(argc, argv); int argc2 = encoding_args.argc(); diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 06e02aa..8c6fb34 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1961,7 +1961,8 @@ struct TargetOutputNameArtifactResultGetter<ArtifactNameTag> const GeneratorExpressionContent* /*unused*/) { return target->GetOutputName(context->Config, - cmStateEnums::RuntimeBinaryArtifact); + cmStateEnums::RuntimeBinaryArtifact) + + target->GetFilePostfix(context->Config); } }; @@ -1983,7 +1984,8 @@ struct TargetOutputNameArtifactResultGetter<ArtifactLinkerTag> target->HasImportLibrary(context->Config) ? cmStateEnums::ImportLibraryArtifact : cmStateEnums::RuntimeBinaryArtifact; - return target->GetOutputName(context->Config, artifact); + return target->GetOutputName(context->Config, artifact) + + target->GetFilePostfix(context->Config); } }; @@ -2023,7 +2025,8 @@ struct TargetOutputNameArtifactResultGetter<ArtifactPdbTag> return std::string(); } - return target->GetPDBOutputName(context->Config); + return target->GetPDBOutputName(context->Config) + + target->GetFilePostfix(context->Config); } }; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 3fb95bf..036a07d 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -491,6 +491,22 @@ std::string cmGeneratorTarget::GetFileSuffix( return suffix; } +std::string cmGeneratorTarget::GetFilePostfix(const std::string& config) const +{ + const char* postfix = nullptr; + if (!config.empty()) { + std::string configProp = cmSystemTools::UpperCase(config); + configProp += "_POSTFIX"; + postfix = this->GetProperty(configProp); + // Mac application bundles and frameworks have no postfix. + if (!this->IsImported() && postfix && + (this->IsAppBundleOnApple() || this->IsFrameworkOnApple())) { + postfix = nullptr; + } + } + return postfix ? postfix : std::string(); +} + const char* cmGeneratorTarget::GetFilePrefixInternal( cmStateEnums::ArtifactType artifact, const std::string& language) const { @@ -3930,17 +3946,7 @@ void cmGeneratorTarget::GetFullNameInternal( } // Compute the full name for main target types. - const char* configPostfix = nullptr; - if (!config.empty()) { - std::string configProp = cmSystemTools::UpperCase(config); - configProp += "_POSTFIX"; - configPostfix = this->GetProperty(configProp); - // Mac application bundles and frameworks have no postfix. - if (configPostfix && - (this->IsAppBundleOnApple() || this->IsFrameworkOnApple())) { - configPostfix = nullptr; - } - } + const std::string configPostfix = this->GetFilePostfix(config); // frameworks have directory prefix but no suffix std::string fw_prefix; @@ -3965,7 +3971,7 @@ void cmGeneratorTarget::GetFullNameInternal( outBase += this->GetOutputName(config, artifact); // Append the per-configuration postfix. - outBase += configPostfix ? configPostfix : ""; + outBase += configPostfix; // Name shared libraries with their version number on some platforms. if (const char* soversion = this->GetProperty("SOVERSION")) { diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 81f5255..0e0ee6a 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -543,6 +543,9 @@ public: cmStateEnums::ArtifactType artifact = cmStateEnums::RuntimeBinaryArtifact) const; + /** Get target file postfix */ + std::string GetFilePostfix(const std::string& config) const; + /** Clears cached meta data for local and external source files. * The meta data will be recomputed on demand. */ diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index bc853b7..17ed3f6 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -43,6 +43,7 @@ #include <assert.h> #include <ctype.h> #include <errno.h> +#include <fcntl.h> #include <iostream> #include <sstream> #include <stdio.h> @@ -56,8 +57,6 @@ # include <windows.h> // include wincrypt.h after windows.h # include <wincrypt.h> - -# include <fcntl.h> /* _O_TEXT */ #else # include <sys/time.h> # include <unistd.h> @@ -2007,6 +2006,71 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line, } } +#ifdef _WIN32 +static void EnsureStdPipe(DWORD fd) +{ + if (GetStdHandle(fd) != INVALID_HANDLE_VALUE) { + return; + } + SECURITY_ATTRIBUTES sa; + sa.nLength = sizeof(sa); + sa.lpSecurityDescriptor = NULL; + sa.bInheritHandle = TRUE; + + HANDLE h = CreateFileW( + L"NUL", + fd == STD_INPUT_HANDLE ? FILE_GENERIC_READ + : FILE_GENERIC_WRITE | FILE_READ_ATTRIBUTES, + FILE_SHARE_READ | FILE_SHARE_WRITE, &sa, OPEN_EXISTING, 0, NULL); + + if (h == INVALID_HANDLE_VALUE) { + LPSTR message = NULL; + DWORD size = FormatMessageA( + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPSTR)&message, 0, NULL); + std::string msg = std::string(message, size); + LocalFree(message); + std::cerr << "failed to open NUL for missing stdio pipe: " << msg; + abort(); + } + + SetStdHandle(fd, h); +} + +void cmSystemTools::EnsureStdPipes() +{ + EnsureStdPipe(STD_INPUT_HANDLE); + EnsureStdPipe(STD_OUTPUT_HANDLE); + EnsureStdPipe(STD_ERROR_HANDLE); +} +#else +static void EnsureStdPipe(int fd) +{ + if (fcntl(fd, F_GETFD) != -1 || errno != EBADF) { + return; + } + + int f = open("/dev/null", fd == STDIN_FILENO ? O_RDONLY : O_WRONLY); + if (f == -1) { + perror("failed to open /dev/null for missing stdio pipe"); + abort(); + } + if (f != fd) { + dup2(f, fd); + close(f); + } +} + +void cmSystemTools::EnsureStdPipes() +{ + EnsureStdPipe(STDIN_FILENO); + EnsureStdPipe(STDOUT_FILENO); + EnsureStdPipe(STDERR_FILENO); +} +#endif + void cmSystemTools::DoNotInheritStdPipes() { #ifdef _WIN32 diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 05bd351..8a87a37 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -435,6 +435,8 @@ public: // not get stuck waiting for all the output on the pipes. static void DoNotInheritStdPipes(); + static void EnsureStdPipes(); + /** Copy the file create/access/modify times from the file named by the first argument to that named by the second. */ static bool CopyFileTime(const std::string& fromFile, diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 5631d10..e639c66 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -24,6 +24,7 @@ #endif #include <cassert> +#include <climits> #include <ctype.h> #include <iostream> #include <string.h> @@ -69,7 +70,7 @@ static const char* cmDocumentationUsageNote[][2] = { " --config <cfg> = For multi-configuration tools, choose <cfg>.\n" \ " --clean-first = Build target 'clean' first, then build.\n" \ " (To clean only, use --target 'clean'.)\n" \ - " --verbose, -v = Enable verbose output - if supported - including\n" \ + " --verbose, -v = Enable verbose output - if supported - including\n" \ " the build commands to be executed. \n" \ " -- = Pass remaining options to the native tool.\n" @@ -183,6 +184,7 @@ static void cmakemainProgressCallback(const std::string& m, float prog, int main(int ac, char const* const* av) { + cmSystemTools::EnsureStdPipes(); #if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE) // Replace streambuf so we can output Unicode to console cmsys::ConsoleBuf::Manager consoleOut(std::cout); @@ -395,7 +397,14 @@ int extract_job_number(int& index, char const* current, char const* next, if (jobString.empty()) { jobs = cmake::DEFAULT_BUILD_PARALLEL_LEVEL; } else if (cmSystemTools::StringToULong(jobString.c_str(), &numJobs)) { - jobs = int(numJobs); + if (numJobs == 0) { + std::cerr + << "The <jobs> value requires a positive integer argument.\n\n"; + } else if (numJobs > INT_MAX) { + std::cerr << "The <jobs> value is too large.\n\n"; + } else { + jobs = int(numJobs); + } } else { std::cerr << "'" << command.substr(0, len_of_flag) << "' invalid number '" << jobString << "' given.\n\n"; @@ -507,7 +516,17 @@ static int do_build(int ac, char const* const* av) } else { unsigned long numJobs = 0; if (cmSystemTools::StringToULong(parallel.c_str(), &numJobs)) { - jobs = int(numJobs); + if (numJobs == 0) { + std::cerr << "The CMAKE_BUILD_PARALLEL_LEVEL environment variable " + "requires a positive integer argument.\n\n"; + dir.clear(); + } else if (numJobs > INT_MAX) { + std::cerr << "The CMAKE_BUILD_PARALLEL_LEVEL environment variable " + "is too large.\n\n"; + dir.clear(); + } else { + jobs = int(numJobs); + } } else { std::cerr << "'CMAKE_BUILD_PARALLEL_LEVEL' environment variable\n" << "invalid number '" << parallel << "' given.\n\n"; diff --git a/Source/ctest.cxx b/Source/ctest.cxx index 461021b..3b3630f 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -143,6 +143,7 @@ static const char* cmDocumentationOptions[][2] = { // this is a test driver program for cmCTest. int main(int argc, char const* const* argv) { + cmSystemTools::EnsureStdPipes(); #if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE) // Replace streambuf so we can output Unicode to console cmsys::ConsoleBuf::Manager consoleOut(std::cout); diff --git a/Tests/RunCMake/CommandLine/BuildDir--build--parallel-large-result.txt b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-large-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-large-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/BuildDir--build--parallel-large-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-large-stderr.txt new file mode 100644 index 0000000..94fc157 --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-large-stderr.txt @@ -0,0 +1,3 @@ +^The <jobs> value is too large\. ++ +Usage: cmake --build <dir> \[options\] \[-- \[native-options\]\] diff --git a/Tests/RunCMake/CommandLine/BuildDir--build--parallel-zero-result.txt b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-zero-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-zero-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/BuildDir--build--parallel-zero-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-zero-stderr.txt new file mode 100644 index 0000000..8ed4fee --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir--build--parallel-zero-stderr.txt @@ -0,0 +1,3 @@ +^The <jobs> value requires a positive integer argument\. ++ +Usage: cmake --build <dir> \[options\] \[-- \[native-options\]\] diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-jobs-large-result.txt b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-large-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-large-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-jobs-large-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-large-stderr.txt new file mode 100644 index 0000000..94fc157 --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-large-stderr.txt @@ -0,0 +1,3 @@ +^The <jobs> value is too large\. ++ +Usage: cmake --build <dir> \[options\] \[-- \[native-options\]\] diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-jobs-zero-result.txt b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-zero-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-zero-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/BuildDir--build-jobs-zero-stderr.txt b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-zero-stderr.txt new file mode 100644 index 0000000..8ed4fee --- /dev/null +++ b/Tests/RunCMake/CommandLine/BuildDir--build-jobs-zero-stderr.txt @@ -0,0 +1,3 @@ +^The <jobs> value requires a positive integer argument\. ++ +Usage: cmake --build <dir> \[options\] \[-- \[native-options\]\] diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index ea749ea..b9aa536 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -149,6 +149,14 @@ function(run_BuildDir) ${CMAKE_COMMAND} --build BuildDir-build --parallel2) run_cmake_command(BuildDir--build--parallel-no-space-good-number-trailing--target ${CMAKE_COMMAND} -E chdir .. ${CMAKE_COMMAND} --build BuildDir-build --parallel2 --target CustomTarget) + run_cmake_command(BuildDir--build-jobs-zero ${CMAKE_COMMAND} -E chdir .. + ${CMAKE_COMMAND} --build BuildDir-build -j 0) + run_cmake_command(BuildDir--build--parallel-zero ${CMAKE_COMMAND} -E chdir .. + ${CMAKE_COMMAND} --build BuildDir-build --parallel 0) + run_cmake_command(BuildDir--build-jobs-large ${CMAKE_COMMAND} -E chdir .. + ${CMAKE_COMMAND} --build BuildDir-build -j 4294967293) + run_cmake_command(BuildDir--build--parallel-large ${CMAKE_COMMAND} -E chdir .. + ${CMAKE_COMMAND} --build BuildDir-build --parallel 4294967293) # No default jobs for Xcode and FreeBSD build command if(NOT RunCMake_GENERATOR MATCHES "Xcode" AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD") @@ -443,4 +451,8 @@ function(reject_fifo) endfunction() if(CMAKE_HOST_UNIX AND NOT CMAKE_SYSTEM_NAME STREQUAL "CYGWIN") reject_fifo() + run_cmake_command(closed_stdin sh -c "\"${CMAKE_COMMAND}\" --version <&-") + run_cmake_command(closed_stdout sh -c "\"${CMAKE_COMMAND}\" --version >&-") + run_cmake_command(closed_stderr sh -c "\"${CMAKE_COMMAND}\" --version 2>&-") + run_cmake_command(closed_stdall sh -c "\"${CMAKE_COMMAND}\" --version <&- >&- 2>&-") endif() diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 477b593..a491e99 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -41,8 +41,8 @@ run_cmake(TARGET_FILE_SUFFIX) run_cmake(TARGET_FILE_SUFFIX-imported-target) run_cmake(TARGET_FILE_SUFFIX-non-valid-target) run_cmake(TARGET_LINKER_FILE_SUFFIX-non-valid-target) -run_cmake(TARGET_FILE_BASE_NAME) -run_cmake(TARGET_FILE_BASE_NAME-imported-target) +run_cmake_with_options(TARGET_FILE_BASE_NAME -DCMAKE_BUILD_TYPE:STRING=Debug) +run_cmake_with_options(TARGET_FILE_BASE_NAME-imported-target -DCMAKE_BUILD_TYPE:STRING=Debug) run_cmake(TARGET_FILE_BASE_NAME-non-valid-target) run_cmake(TARGET_LINKER_FILE_BASE_NAME-non-valid-target) run_cmake(TARGET_PROPERTY-LOCATION) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target.cmake index aa54b31..40f7c66 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target.cmake +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target.cmake @@ -46,17 +46,14 @@ add_executable (exec3 IMPORTED) set_property (TARGET exec3 PROPERTY RUNTIME_OUTPUT_NAME exec3_runtime) set_property (TARGET exec3 PROPERTY LIBRARY_OUTPUT_NAME exec3_library) set_property (TARGET exec3 PROPERTY ARCHIVE_OUTPUT_NAME exec3_archive) -set_property (TARGET exec3 PROPERTY PDB_NAME exec3_pdb) add_library (shared3 SHARED IMPORTED) set_property (TARGET shared3 PROPERTY RUNTIME_OUTPUT_NAME shared3_runtime) set_property (TARGET shared3 PROPERTY LIBRARY_OUTPUT_NAME shared3_library) set_property (TARGET shared3 PROPERTY ARCHIVE_OUTPUT_NAME shared3_archive) -set_property (TARGET shared3 PROPERTY PDB_NAME shared3_pdb) add_library (static3 STATIC IMPORTED) set_property (TARGET static3 PROPERTY RUNTIME_OUTPUT_NAME static3_runtime) set_property (TARGET static3 PROPERTY LIBRARY_OUTPUT_NAME static3_library) set_property (TARGET static3 PROPERTY ARCHIVE_OUTPUT_NAME static3_archive) -set_property (TARGET static3 PROPERTY PDB_NAME static3_pdb) string (APPEND GENERATE_CONTENT [[ @@ -73,7 +70,37 @@ get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(_isMultiConfig) list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG) set(GENERATE_CONDITION CONDITION $<CONFIG:${FIRST_CONFIG}>) +else() + set (FIRST_CONFIG ${CMAKE_BUILD_TYPE}) endif() +string (TOUPPER "${FIRST_CONFIG}" FIRST_CONFIG) + + +add_executable (exec4 IMPORTED) +set_property (TARGET exec4 PROPERTY RUNTIME_OUTPUT_NAME exec4_runtime) +set_property (TARGET exec4 PROPERTY LIBRARY_OUTPUT_NAME exec4_library) +set_property (TARGET exec4 PROPERTY ARCHIVE_OUTPUT_NAME exec4_archive) +set_property (TARGET exec4 PROPERTY ${FIRST_CONFIG}_POSTFIX _postfix) +add_library (shared4 SHARED IMPORTED) +set_property (TARGET shared4 PROPERTY RUNTIME_OUTPUT_NAME shared4_runtime) +set_property (TARGET shared4 PROPERTY LIBRARY_OUTPUT_NAME shared4_library) +set_property (TARGET shared4 PROPERTY ARCHIVE_OUTPUT_NAME shared4_archive) +set_property (TARGET shared4 PROPERTY ${FIRST_CONFIG}_POSTFIX _postfix) +add_library (static4 STATIC IMPORTED) +set_property (TARGET static4 PROPERTY RUNTIME_OUTPUT_NAME static4_runtime) +set_property (TARGET static4 PROPERTY LIBRARY_OUTPUT_NAME static4_library) +set_property (TARGET static4 PROPERTY ARCHIVE_OUTPUT_NAME static4_archive) +set_property (TARGET static4 PROPERTY ${FIRST_CONFIG}_POSTFIX _postfix) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_FILE_BASE_NAME executable all properties + postfix" "$<TARGET_FILE_BASE_NAME:exec4>" "exec4_runtime_postfix") +check_value ("TARGET_FILE_BASE_NAME shared all properties + postfix" "$<TARGET_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared4_runtime,shared4_library>_postfix") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties + postfix" "$<TARGET_LINKER_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared4_archive,shared4_library>_postfix") +check_value ("TARGET_FILE_BASE_NAME static all properties + postfix" "$<TARGET_FILE_BASE_NAME:static4>" "static4_archive_postfix") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker all properties + postfix" "$<TARGET_LINKER_FILE_BASE_NAME:static4>" "static4_archive_postfix") +]]) + file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_FILE_BASE_NAME-generated.cmake" CONTENT "${GENERATE_CONTENT}" ${GENERATE_CONDITION}) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME.cmake index 5ea53a0..f88d710 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME.cmake +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME.cmake @@ -90,7 +90,46 @@ get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(_isMultiConfig) list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG) set(GENERATE_CONDITION CONDITION $<CONFIG:${FIRST_CONFIG}>) +else() + set (FIRST_CONFIG ${CMAKE_BUILD_TYPE}) endif() +string (TOUPPER "${FIRST_CONFIG}" FIRST_CONFIG) + + +add_executable (exec4 empty.c) +set_property (TARGET exec4 PROPERTY RUNTIME_OUTPUT_NAME exec4_runtime) +set_property (TARGET exec4 PROPERTY LIBRARY_OUTPUT_NAME exec4_library) +set_property (TARGET exec4 PROPERTY ARCHIVE_OUTPUT_NAME exec4_archive) +set_property (TARGET exec4 PROPERTY PDB_NAME exec4_pdb) +set_property (TARGET exec4 PROPERTY ${FIRST_CONFIG}_POSTFIX _postfix) +add_library (shared4 SHARED empty.c) +set_property (TARGET shared4 PROPERTY RUNTIME_OUTPUT_NAME shared4_runtime) +set_property (TARGET shared4 PROPERTY LIBRARY_OUTPUT_NAME shared4_library) +set_property (TARGET shared4 PROPERTY ARCHIVE_OUTPUT_NAME shared4_archive) +set_property (TARGET shared4 PROPERTY PDB_NAME shared4_pdb) +set_property (TARGET shared4 PROPERTY ${FIRST_CONFIG}_POSTFIX _postfix) +add_library (static4 STATIC empty.c) +set_property (TARGET static4 PROPERTY RUNTIME_OUTPUT_NAME static4_runtime) +set_property (TARGET static4 PROPERTY LIBRARY_OUTPUT_NAME static4_library) +set_property (TARGET static4 PROPERTY ARCHIVE_OUTPUT_NAME static4_archive) +set_property (TARGET static4 PROPERTY PDB_NAME static4_pdb) +set_property (TARGET static4 PROPERTY ${FIRST_CONFIG}_POSTFIX _postfix) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_FILE_BASE_NAME executable all properties + postfix" "$<TARGET_FILE_BASE_NAME:exec4>" "exec4_runtime_postfix") +check_value ("TARGET_FILE_BASE_NAME shared all properties + postfix" "$<TARGET_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared4_runtime,shared4_library>_postfix") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties + postfix" "$<TARGET_LINKER_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared4_archive,shared4_library>_postfix") +check_value ("TARGET_FILE_BASE_NAME static all properties + postfix" "$<TARGET_FILE_BASE_NAME:static4>" "static4_archive_postfix") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker all properties + postfix" "$<TARGET_LINKER_FILE_BASE_NAME:static4>" "static4_archive_postfix") +]]) +if (CMAKE_C_LINKER_SUPPORTS_PDB) + string (APPEND GENERATE_CONTENT [[ +check_value ("TARGET_PDB_FILE_BASE_NAME executable PDB all properties + postfix" "$<TARGET_PDB_FILE_BASE_NAME:exec4>" "exec4_pdb_postfix") +check_value ("TARGET_PDB_FILE_BASE_NAME shared PDB all properties + postfix" "$<TARGET_PDB_FILE_BASE_NAME:shared4>" "shared4_pdb_postfix") +]]) +endif() + file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_FILE_BASE_NAME-generated.cmake" CONTENT "${GENERATE_CONTENT}" ${GENERATE_CONDITION}) |