diff options
60 files changed, 995 insertions, 100 deletions
diff --git a/Help/cpack_gen/dmg.rst b/Help/cpack_gen/dmg.rst index 35320c2..cede0f2 100644 --- a/Help/cpack_gen/dmg.rst +++ b/Help/cpack_gen/dmg.rst @@ -54,10 +54,12 @@ on macOS: Directory where license and menu files for different languages are stored. Setting this causes CPack to look for a ``<language>.menu.txt`` and - ``<language>.license.txt`` file for every language defined in - ``CPACK_DMG_SLA_LANGUAGES``. If both this variable and + ``<language>.license.txt`` or ``<language>.license.rtf`` file for every + language defined in ``CPACK_DMG_SLA_LANGUAGES``. If both this variable and ``CPACK_RESOURCE_FILE_LICENSE`` are set, CPack will only look for the menu - files and use the same license file for all languages. + files and use the same license file for all languages. If both + ``<language>.license.txt`` and ``<language>.license.rtf`` exist, the ``.txt`` + file will be used. .. variable:: CPACK_DMG_SLA_LANGUAGES diff --git a/Help/generator/Ninja Multi-Config.rst b/Help/generator/Ninja Multi-Config.rst index 41cd5c2..e7f362e 100644 --- a/Help/generator/Ninja Multi-Config.rst +++ b/Help/generator/Ninja Multi-Config.rst @@ -31,6 +31,12 @@ targets will always use the configuration specified in Ninja for the same file to be output with different commands in the same build graph. +You can additionally use :variable:`CMAKE_NINJA_MULTI_CROSS_CONFIGS` to limit +the configurations that get cross-generated. If this variable is set, each +``build-<Config>.ninja`` file will only contain rules for the configurations +listed in the variable, plus their own configuration. This also affects which +configurations are built by the ``<target>:all`` target. + If :variable:`CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE` is not enabled, you can still build any target in ``build-<Config>.ninja`` by specifying ``<target>:<Config>`` or ``<target>``, but not ``<target>:<OtherConfig>`` or diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 393735e..3a62371 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -185,6 +185,7 @@ Properties on Targets /prop_tgt/DEPLOYMENT_ADDITIONAL_FILES /prop_tgt/DEPRECATION /prop_tgt/DISABLE_PRECOMPILE_HEADERS + /prop_tgt/DOTNET_TARGET_FRAMEWORK /prop_tgt/DOTNET_TARGET_FRAMEWORK_VERSION /prop_tgt/EchoString /prop_tgt/ENABLE_EXPORTS diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index da2b06e..1f5b39c 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -48,6 +48,7 @@ Variables that Provide Information /variable/CMAKE_DEBUG_TARGET_PROPERTIES /variable/CMAKE_DIRECTORY_LABELS /variable/CMAKE_DL_LIBS + /variable/CMAKE_DOTNET_TARGET_FRAMEWORK /variable/CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION /variable/CMAKE_EDIT_COMMAND /variable/CMAKE_EXECUTABLE_SUFFIX @@ -424,6 +425,7 @@ Variables that Control the Build /variable/CMAKE_MODULE_LINKER_FLAGS_INIT /variable/CMAKE_MSVCIDE_RUN_PATH /variable/CMAKE_MSVC_RUNTIME_LIBRARY + /variable/CMAKE_NINJA_MULTI_CROSS_CONFIGS /variable/CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE /variable/CMAKE_NINJA_MULTI_DEFAULT_BUILD_ALIAS /variable/CMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 4315f0a..44b1f2f 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -279,7 +279,9 @@ Options "file": "/full/path/to/the/CMake/file.txt", "line": 0, "cmd": "add_executable", - "args": ["foo", "bar"] + "args": ["foo", "bar"], + "time": 1579512535.9687231, + "frame": 2 } The members are: @@ -288,8 +290,8 @@ Options The full path to the CMake source file where the function was called. - ``line`` - The line in `file` of the function call. + ``line`` + The line in ``file`` of the function call. ``cmd`` The name of the function that was called. @@ -297,6 +299,12 @@ Options ``args`` A string list of all function parameters. + ``time`` + Timestamp (seconds since epoch) of the function call. + + ``frame`` + Stack frame depth of the function that was called. + Additionally, the first JSON document outputted contains the ``version`` key for the current major and minor version of the diff --git a/Help/prop_tgt/DOTNET_TARGET_FRAMEWORK.rst b/Help/prop_tgt/DOTNET_TARGET_FRAMEWORK.rst new file mode 100644 index 0000000..8698eb6 --- /dev/null +++ b/Help/prop_tgt/DOTNET_TARGET_FRAMEWORK.rst @@ -0,0 +1,13 @@ +DOTNET_TARGET_FRAMEWORK +----------------------- + +Specify the .NET target framework. + +Used to specify the .NET target framework for C++/CLI and C#. For +example: ``netcoreapp2.1``. + +This property is only evaluated for :ref:`Visual Studio Generators` +VS 2010 and above. + +Can be initialized for all targets using the variable +:variable:`CMAKE_DOTNET_TARGET_FRAMEWORK`. diff --git a/Help/prop_tgt/DOTNET_TARGET_FRAMEWORK_VERSION.rst b/Help/prop_tgt/DOTNET_TARGET_FRAMEWORK_VERSION.rst index c100326..b33f4fb 100644 --- a/Help/prop_tgt/DOTNET_TARGET_FRAMEWORK_VERSION.rst +++ b/Help/prop_tgt/DOTNET_TARGET_FRAMEWORK_VERSION.rst @@ -3,11 +3,13 @@ DOTNET_TARGET_FRAMEWORK_VERSION Specify the .NET target framework version. -Used to specify the .NET target framework version for C++/CLI. For -example: ``v4.5``. +Used to specify the .NET target framework version for C++/CLI and C#. +For example: ``v4.5``. This property is only evaluated for :ref:`Visual Studio Generators` VS 2010 and above. -Can be initialized for all targets using the variable -:variable:`CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION`. +To initialize this variable for all targets set +:variable:`CMAKE_DOTNET_TARGET_FRAMEWORK` or +:variable:`CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION`. If both are set, +the latter is ignored. diff --git a/Help/prop_tgt/VS_DOTNET_TARGET_FRAMEWORK_VERSION.rst b/Help/prop_tgt/VS_DOTNET_TARGET_FRAMEWORK_VERSION.rst index 9f5a313..6cb8f86 100644 --- a/Help/prop_tgt/VS_DOTNET_TARGET_FRAMEWORK_VERSION.rst +++ b/Help/prop_tgt/VS_DOTNET_TARGET_FRAMEWORK_VERSION.rst @@ -3,8 +3,9 @@ VS_DOTNET_TARGET_FRAMEWORK_VERSION Specify the .NET target framework version. -Used to specify the .NET target framework version for C++/CLI. For +Used to specify the .NET target framework version for C++/CLI. For example, "v4.5". This property is deprecated and should not be used anymore. Use +:prop_tgt:`DOTNET_TARGET_FRAMEWORK` or :prop_tgt:`DOTNET_TARGET_FRAMEWORK_VERSION` instead. diff --git a/Help/release/dev/cpack-dmg-rtf-for-sla.rst b/Help/release/dev/cpack-dmg-rtf-for-sla.rst new file mode 100644 index 0000000..5941796 --- /dev/null +++ b/Help/release/dev/cpack-dmg-rtf-for-sla.rst @@ -0,0 +1,8 @@ +cpack-dmg-rtf-for-sla +--------------------- + +* The :cpack_gen:`CPack DragNDrop Generator` learned to handle + RTF formatted license files. When :variable:`CPACK_DMG_SLA_DIR` + variable is set, <language>.license.rtf is considered, but + only as a fallback when the plaintext (.txt) file is not found + in order to maintain backwards compatibility. diff --git a/Help/release/dev/vs-dotnet-standard-core.rst b/Help/release/dev/vs-dotnet-standard-core.rst new file mode 100644 index 0000000..9bb292e --- /dev/null +++ b/Help/release/dev/vs-dotnet-standard-core.rst @@ -0,0 +1,7 @@ +vs-dotnet-standard-core +----------------------- + +* :ref:`Visual Studio Generators` for VS 2010 and above learned to + support .NET Standard and .NET Core. See the + :prop_tgt:`DOTNET_TARGET_FRAMEWORK` target property and + associated :variable:`CMAKE_DOTNET_TARGET_FRAMEWORK` variable. diff --git a/Help/variable/CMAKE_DOTNET_TARGET_FRAMEWORK.rst b/Help/variable/CMAKE_DOTNET_TARGET_FRAMEWORK.rst new file mode 100644 index 0000000..8edcd1e --- /dev/null +++ b/Help/variable/CMAKE_DOTNET_TARGET_FRAMEWORK.rst @@ -0,0 +1,16 @@ +CMAKE_DOTNET_TARGET_FRAMEWORK +----------------------------- + +Default value for :prop_tgt:`DOTNET_TARGET_FRAMEWORK` property of +targets. + +This variable is used to initialize the +:prop_tgt:`DOTNET_TARGET_FRAMEWORK` property on all targets. See that +target property for additional information. + +Setting ``CMAKE_DOTNET_TARGET_FRAMEWORK`` may be necessary +when working with ``C#`` and newer .NET framework versions to +avoid referencing errors with the ``ALL_BUILD`` CMake target. + +This variable is only evaluated for :ref:`Visual Studio Generators` +VS 2010 and above. diff --git a/Help/variable/CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION.rst b/Help/variable/CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION.rst index 124fefe..c2eef9e 100644 --- a/Help/variable/CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION.rst +++ b/Help/variable/CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION.rst @@ -6,7 +6,11 @@ property of targets. This variable is used to initialize the :prop_tgt:`DOTNET_TARGET_FRAMEWORK_VERSION` property on all -targets. See that target property for additional information. +targets. See that target property for additional information. When set, +:variable:`CMAKE_DOTNET_TARGET_FRAMEWORK` takes precednece over this +variable. See that variable or the associated target property +:prop_tgt:`DOTNET_TARGET_FRAMEWORK` for additional information. + Setting ``CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION`` may be necessary when working with ``C#`` and newer .NET framework versions to diff --git a/Help/variable/CMAKE_NINJA_MULTI_CROSS_CONFIGS.rst b/Help/variable/CMAKE_NINJA_MULTI_CROSS_CONFIGS.rst new file mode 100644 index 0000000..48f6985 --- /dev/null +++ b/Help/variable/CMAKE_NINJA_MULTI_CROSS_CONFIGS.rst @@ -0,0 +1,7 @@ +CMAKE_NINJA_MULTI_CROSS_CONFIGS +------------------------------- + +Set which configurations get cross-built if +:variable:`CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE` is set. See the +documentation for the :generator:`Ninja Multi-Config` generator for more +information. diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 3b46ca5..f6f6320 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -458,12 +458,13 @@ if(NOT DEFINED CPACK_PACKAGE_VERSION) endif() _cpack_set_default(CPACK_PACKAGE_VENDOR "Humanity") +set(CPACK_DEFAULT_PACKAGE_DESCRIPTION_SUMMARY "${CMAKE_PROJECT_NAME} built using CMake") if(CMAKE_PROJECT_DESCRIPTION) _cpack_set_default(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${CMAKE_PROJECT_DESCRIPTION}") else() _cpack_set_default(CPACK_PACKAGE_DESCRIPTION_SUMMARY - "${CMAKE_PROJECT_NAME} built using CMake") + "${CPACK_DEFAULT_PACKAGE_DESCRIPTION_SUMMARY}") endif() if(CMAKE_PROJECT_HOMEPAGE_URL) _cpack_set_default(CPACK_PACKAGE_HOMEPAGE_URL diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake index f7f68ca..6a40ace 100644 --- a/Modules/FindCUDAToolkit.cmake +++ b/Modules/FindCUDAToolkit.cmake @@ -408,6 +408,11 @@ Result variables The path to the CUDA Toolkit library directory that contains the CUDA Runtime library ``cudart``. +``CUDAToolkit_TARGET_DIR`` + The path to the CUDA Toolkit directory including the target architecture + when cross-compiling. When not cross-compiling this will be equivalant to + ``CUDAToolkit_ROOT_DIR``. + ``CUDAToolkit_NVCC_EXECUTABLE`` The path to the NVIDIA CUDA compiler ``nvcc``. Note that this path may **not** be the same as @@ -641,8 +646,37 @@ endif() get_filename_component(CUDAToolkit_ROOT_DIR ${CUDAToolkit_BIN_DIR} DIRECTORY ABSOLUTE) -# Now that we have the real ROOT_DIR, find components inside it. -list(APPEND CMAKE_PREFIX_PATH ${CUDAToolkit_ROOT_DIR}) +# Handle cross compilation +if(CMAKE_CROSSCOMPILING) + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7-a") + # Support for NVPACK + set (CUDAToolkit_TARGET_NAME "armv7-linux-androideabi") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm") + # Support for arm cross compilation + set(CUDAToolkit_TARGET_NAME "armv7-linux-gnueabihf") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") + # Support for aarch64 cross compilation + if (ANDROID_ARCH_NAME STREQUAL "arm64") + set(CUDAToolkit_TARGET_NAME "aarch64-linux-androideabi") + else() + set(CUDAToolkit_TARGET_NAME "aarch64-linux") + endif (ANDROID_ARCH_NAME STREQUAL "arm64") + elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + set(CUDAToolkit_TARGET_NAME "x86_64-linux") + endif() + + if (EXISTS "${CUDAToolkit_ROOT_DIR}/targets/${CUDAToolkit_TARGET_NAME}") + set(CUDAToolkit_TARGET_DIR "${CUDAToolkit_ROOT_DIR}/targets/${CUDAToolkit_TARGET_NAME}") + # add known CUDA target root path to the set of directories we search for programs, libraries and headers + list(APPEND CMAKE_FIND_ROOT_PATH "${CUDAToolkit_TARGET_DIR}") + endif() +else() + # Not cross compiling + set(CUDAToolkit_TARGET_DIR "${CUDAToolkit_ROOT_DIR}") + # Now that we have the real ROOT_DIR, find components inside it. + list(APPEND CMAKE_PREFIX_PATH ${CUDAToolkit_ROOT_DIR}) +endif() + # Find the include/ directory find_path(CUDAToolkit_INCLUDE_DIR @@ -652,14 +686,20 @@ find_path(CUDAToolkit_INCLUDE_DIR # And find the CUDA Runtime Library libcudart find_library(CUDA_CUDART NAMES cudart - PATH_SUFFIXES lib64 lib/x64 + PATH_SUFFIXES lib64 lib64/stubs lib/x64 ) if (NOT CUDA_CUDART AND NOT CUDAToolkit_FIND_QUIETLY) message(STATUS "Unable to find cudart library.") endif() unset(CUDAToolkit_ROOT_DIR) -list(REMOVE_AT CMAKE_PREFIX_PATH -1) +if(CMAKE_CROSSCOMPILING) + if(CUDAToolkit_TARGET_DIR) + list(REMOVE_AT CMAKE_FIND_ROOT_PATH -1) + endif() +else() + list(REMOVE_AT CMAKE_PREFIX_PATH -1) +endif() #----------------------------------------------------------------------------- # Perform version comparison and validate all required variables are set. @@ -696,7 +736,7 @@ if(CUDAToolkit_FOUND) NAMES ${search_names} PATHS ${CUDAToolkit_LIBRARY_DIR} ENV CUDA_PATH - PATH_SUFFIXES nvidia/current lib64 lib/x64 lib + PATH_SUFFIXES nvidia/current lib64 lib64/stubs lib/x64 lib lib/stubs ) if (NOT CUDA::${lib_name} AND CUDA_${lib_name}_LIBRARY) diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake index e015a98..53cab1a 100644 --- a/Modules/FindGTest.cmake +++ b/Modules/FindGTest.cmake @@ -240,4 +240,15 @@ if(GTEST_FOUND) __gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "RELEASE") __gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "DEBUG") endif() + + # Add targets mapping the same library names as defined in + # GTest's CMake package config. + if(NOT TARGET GTest::gtest) + add_library(GTest::gtest INTERFACE IMPORTED) + target_link_libraries(GTest::gtest INTERFACE GTest::GTest) + endif() + if(NOT TARGET GTest::gtest_main) + add_library(GTest::gtest_main INTERFACE IMPORTED) + target_link_libraries(GTest::gtest_main INTERFACE GTest::Main) + endif() endif() diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake index a7c3eae..a078049 100644 --- a/Modules/FindPackageHandleStandardArgs.cmake +++ b/Modules/FindPackageHandleStandardArgs.cmake @@ -289,10 +289,12 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) string(TOLOWER ${_NAME} _NAME_LOWER) if(FPHSA_FOUND_VAR) - if(FPHSA_FOUND_VAR MATCHES "^${_NAME}_FOUND$" OR FPHSA_FOUND_VAR MATCHES "^${_NAME_UPPER}_FOUND$") + set(_FOUND_VAR_UPPER ${_NAME_UPPER}_FOUND) + set(_FOUND_VAR_MIXED ${_NAME}_FOUND) + if(FPHSA_FOUND_VAR STREQUAL _FOUND_VAR_MIXED OR FPHSA_FOUND_VAR STREQUAL _FOUND_VAR_UPPER) set(_FOUND_VAR ${FPHSA_FOUND_VAR}) else() - message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.") + message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_FOUND_VAR_MIXED}\" and \"${_FOUND_VAR_UPPER}\" are valid names.") endif() else() set(_FOUND_VAR ${_NAME_UPPER}_FOUND) diff --git a/Modules/Internal/CPack/CPackDeb.cmake b/Modules/Internal/CPack/CPackDeb.cmake index c74c324..14bb104 100644 --- a/Modules/Internal/CPack/CPackDeb.cmake +++ b/Modules/Internal/CPack/CPackDeb.cmake @@ -540,7 +540,8 @@ function(cpack_deb_prepare_package_vars) # Ok, description has set. According to the `Debian Policy Manual`_ the frist # line is a pacakge summary. Try to get it as well... # See also: https://www.debian.org/doc/debian-policy/ch-controlfields.html#description - elseif(CPACK_PACKAGE_DESCRIPTION_SUMMARY) + elseif(CPACK_PACKAGE_DESCRIPTION_SUMMARY AND + NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY STREQUAL CPACK_DEFAULT_PACKAGE_DESCRIPTION_SUMMARY) # Merge summary w/ the detailed description string(PREPEND CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}\n") endif() diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index 33cacf1..cb6ae43 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -436,7 +436,7 @@ macro(QT4_CREATE_TRANSLATION _qm_files) if(_my_sources) # make a .pro file to call lupdate on, so we don't make our commands too # long for some systems - get_filename_component(_ts_name ${_ts_file} NAME_WE) + get_filename_component(_ts_name ${_ts_file} NAME) set(_ts_pro ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_ts_name}_lupdate.pro) set(_pro_srcs) foreach(_pro_src ${_my_sources}) @@ -463,13 +463,15 @@ endmacro() macro(QT4_ADD_TRANSLATION _qm_files) foreach (_current_FILE ${ARGN}) get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE) - get_filename_component(qm ${_abs_FILE} NAME_WE) - get_property(output_location SOURCE ${_abs_FILE} PROPERTY OUTPUT_LOCATION) + get_filename_component(qm ${_abs_FILE} NAME) + # everything before the last dot has to be considered the file name (including other dots) + string(REGEX REPLACE "\\.[^.]*$" "" FILE_NAME ${qm}) + get_source_file_property(output_location ${_abs_FILE} OUTPUT_LOCATION) if(output_location) file(MAKE_DIRECTORY "${output_location}") - set(qm "${output_location}/${qm}.qm") + set(qm "${output_location}/${FILE_NAME}.qm") else() - set(qm "${CMAKE_CURRENT_BINARY_DIR}/${qm}.qm") + set(qm "${CMAKE_CURRENT_BINARY_DIR}/${FILE_NAME}.qm") endif() add_custom_command(OUTPUT ${qm} diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 47b13af..844ac9a 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 16) -set(CMake_VERSION_PATCH 20200123) +set(CMake_VERSION_PATCH 20200127) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 810ffb9..fe7abf4 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -138,11 +138,16 @@ int cmCPackDragNDropGenerator::InitializeInternal() } for (auto const& language : languages) { std::string license = slaDirectory + "/" + language + ".license.txt"; - if (!singleLicense && !cmSystemTools::FileExists(license)) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Missing license file " << language << ".license.txt" - << std::endl); - return 0; + std::string license_rtf = slaDirectory + "/" + language + ".license.rtf"; + if (!singleLicense) { + if (!cmSystemTools::FileExists(license) && + !cmSystemTools::FileExists(license_rtf)) { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Missing license file " + << language << ".license.txt" + << " / " << language << ".license.rtf" << std::endl); + return 0; + } } std::string menu = slaDirectory + "/" + language + ".menu.txt"; if (!cmSystemTools::FileExists(menu)) { @@ -793,13 +798,29 @@ bool cmCPackDragNDropGenerator::WriteLicense( licenseLanguage = "English"; } + // License file + std::string license_format = "TEXT"; + std::string actual_license; + if (!licenseFile.empty()) { + if (cmHasLiteralSuffix(licenseFile, ".rtf")) { + license_format = "RTF "; + } + actual_license = licenseFile; + } else { + std::string license_wo_ext = + slaDirectory + "/" + licenseLanguage + ".license"; + if (cmSystemTools::FileExists(license_wo_ext + ".txt")) { + actual_license = license_wo_ext + ".txt"; + } else { + license_format = "RTF "; + actual_license = license_wo_ext + ".rtf"; + } + } + // License header - outputStream << "data 'TEXT' (" << licenseNumber << ", \"" << licenseLanguage - << "\") {\n"; + outputStream << "data '" << license_format << "' (" << licenseNumber + << ", \"" << licenseLanguage << "\") {\n"; // License body - std::string actual_license = !licenseFile.empty() - ? licenseFile - : (slaDirectory + "/" + licenseLanguage + ".license.txt"); cmsys::ifstream license_ifs; license_ifs.open(actual_license.c_str()); if (license_ifs.is_open()) { diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 0911cd0..2dd89e3 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -549,10 +549,19 @@ void cmGlobalNinjaGenerator::Generate() } }; - if (this->NinjaSupportsCleanDeadTool) { + // The `cleandead` tool needs to know about all outputs in the build we just + // wrote out. Ninja-Multi doesn't have a single `build.ninja` we can use that + // is the union of all generated configurations, so we can't run it reliably + // in that case. + if (this->NinjaSupportsCleanDeadTool && !this->IsMultiConfig()) { run_ninja_tool({ "cleandead" }); } - if (this->NinjaSupportsUnconditionalRecompactTool) { + // The `recompact` tool loads the manifest. As above, we don't have a single + // `build.ninja` to load for this in Ninja-Multi. This may be relaxed in the + // future pending further investigation into how Ninja works upstream + // (ninja#1721). + if (this->NinjaSupportsUnconditionalRecompactTool && + !this->IsMultiConfig()) { run_ninja_tool({ "recompact" }); } if (this->NinjaSupportsRestatTool) { @@ -1191,8 +1200,7 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os) build.Outputs.front() = ta.first; build.ExplicitDeps.clear(); if (ta.second.Config == "all") { - for (auto const& config : - ta.second.GeneratorTarget->Makefile->GetGeneratorConfigs()) { + for (auto const& config : this->GetCrossConfigs("")) { this->AppendTargetOutputs(ta.second.GeneratorTarget, build.ExplicitDeps, config); } @@ -1200,7 +1208,9 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os) this->AppendTargetOutputs(ta.second.GeneratorTarget, build.ExplicitDeps, ta.second.Config); } - this->WriteBuild(this->EnableCrossConfigBuild() + this->WriteBuild(this->EnableCrossConfigBuild() && + (ta.second.Config == "all" || + this->GetCrossConfigs("").count(ta.second.Config)) ? os : *this->GetImplFileStream(ta.second.Config), build); @@ -1301,9 +1311,11 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os) } } // Write target - this->WriteBuild( - this->EnableCrossConfigBuild() ? os : *this->GetImplFileStream(config), - build); + this->WriteBuild(this->EnableCrossConfigBuild() && + this->GetCrossConfigs("").count(config) + ? os + : *this->GetImplFileStream(config), + build); } // Add shortcut target @@ -1330,7 +1342,7 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os) // Add target for all configs if (this->EnableCrossConfigBuild()) { build.ExplicitDeps.clear(); - for (auto const& config : configs) { + for (auto const& config : this->GetCrossConfigs("")) { build.ExplicitDeps.push_back(this->BuildAlias( this->ConvertToNinjaPath(currentBinaryDir + "/all"), config)); } @@ -1785,11 +1797,19 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) build.ExplicitDeps.clear(); if (additionalFiles) { - build.ExplicitDeps.push_back( - this->NinjaOutputPath(this->GetAdditionalCleanTargetName())); + for (auto const& config : this->GetCrossConfigs("")) { + build.ExplicitDeps.push_back(this->BuildAlias( + this->NinjaOutputPath(this->GetAdditionalCleanTargetName()), + config)); + } } - build.Variables["TARGETS"] = ""; + std::vector<std::string> byproducts; + for (auto const& config : this->GetCrossConfigs("")) { + byproducts.push_back( + this->BuildAlias(GetByproductsForCleanTargetName(), config)); + } + build.Variables["TARGETS"] = cmJoin(byproducts, " "); for (auto const& fileConfig : configs) { build.Variables["FILE_ARG"] = cmStrCat( @@ -2359,6 +2379,15 @@ void cmGlobalNinjaGenerator::AppendDirectoryForConfig( } } +std::set<std::string> cmGlobalNinjaGenerator::GetCrossConfigs( + const std::string& /*fileConfig*/) const +{ + std::set<std::string> result; + result.insert( + this->Makefiles.front()->GetSafeDefinition("CMAKE_BUILD_TYPE")); + return result; +} + const char* cmGlobalNinjaMultiGenerator::NINJA_COMMON_FILE = "CMakeFiles/common.ninja"; const char* cmGlobalNinjaMultiGenerator::NINJA_FILE_EXTENSION = ".ninja"; @@ -2525,3 +2554,25 @@ const char* cmGlobalNinjaMultiGenerator::GetDefaultBuildAlias() const return this->GetDefaultBuildType(); } + +std::set<std::string> cmGlobalNinjaMultiGenerator::GetCrossConfigs( + const std::string& fileConfig) const +{ + std::vector<std::string> configs; + if (this->EnableCrossConfigBuild()) { + auto configsValue = this->Makefiles.front()->GetSafeDefinition( + "CMAKE_NINJA_MULTI_CROSS_CONFIGS"); + if (!configsValue.empty()) { + cmExpandList(configsValue, configs); + } else { + configs = this->Makefiles.front()->GetGeneratorConfigs(); + } + } + + std::set<std::string> result(configs.cbegin(), configs.cend()); + if (!fileConfig.empty()) { + result.insert(fileConfig); + } + + return result; +} diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index b61999f..d00a061 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -412,6 +412,9 @@ public: virtual const char* GetDefaultBuildAlias() const { return nullptr; } + virtual std::set<std::string> GetCrossConfigs( + const std::string& fileConfig) const; + protected: void Generate() override; @@ -623,6 +626,9 @@ public: const char* GetDefaultBuildAlias() const override; + std::set<std::string> GetCrossConfigs( + const std::string& fileConfig) const override; + protected: bool OpenBuildFileStreams() override; void CloseBuildFileStreams() override; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index dbdde48..1420f7c 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -683,9 +683,15 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsTop( if (!this->IsNMake() && !this->IsWatcomWMake() && !this->BorlandMakeCurlyHack) { // turn off RCS and SCCS automatic stuff from gmake - makefileStream - << "# Remove some rules from gmake that .SUFFIXES does not remove.\n" - << "SUFFIXES =\n\n"; + constexpr const char* vcs_rules[] = { + "%,v", "RCS/%", "RCS/%,v", "SCCS/s.%", "s.%", + }; + for (auto vcs_rule : vcs_rules) { + std::vector<std::string> vcs_depend; + vcs_depend.emplace_back(vcs_rule); + this->WriteMakeRule(makefileStream, "Disable VCS-based implicit rules.", + "%", vcs_depend, no_commands, false); + } } // Add a fake suffix to keep HP happy. Must be max 32 chars for SGI make. std::vector<std::string> depends; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 668a27d..59995be 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -340,6 +340,9 @@ void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const for (std::string const& arg : args) { val["args"].append(arg); } + val["time"] = cmSystemTools::GetTime(); + val["frame"] = + static_cast<std::uint64_t>(this->ExecutionStatusStack.size()); msg << Json::writeString(builder, val); #endif break; diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index a871a92..437548a 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -72,8 +72,9 @@ void cmNinjaNormalTargetGenerator::Generate(const std::string& config) // Write the build statements bool firstForConfig = true; for (auto const& fileConfig : this->GetConfigNames()) { - if (fileConfig != config && - !this->GetGlobalGenerator()->EnableCrossConfigBuild()) { + if (!this->GetGlobalGenerator() + ->GetCrossConfigs(fileConfig) + .count(config)) { continue; } this->WriteObjectBuildStatements(config, fileConfig, firstForConfig); @@ -85,8 +86,9 @@ void cmNinjaNormalTargetGenerator::Generate(const std::string& config) } else { firstForConfig = true; for (auto const& fileConfig : this->GetConfigNames()) { - if (fileConfig != config && - !this->GetGlobalGenerator()->EnableCrossConfigBuild()) { + if (!this->GetGlobalGenerator() + ->GetCrossConfigs(fileConfig) + .count(config)) { continue; } // If this target has cuda language link inputs, and we need to do diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index a0b3138..d46bf56 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -517,6 +517,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, } if (impl->TargetType <= cmStateEnums::UTILITY) { + initProp("DOTNET_TARGET_FRAMEWORK"); initProp("DOTNET_TARGET_FRAMEWORK_VERSION"); } diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index f707bb4..fd94bc9 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -483,23 +483,33 @@ void cmVisualStudio10TargetGenerator::Generate() } e1.Element("ProjectName", projLabel); { - // TODO: add deprecation warning for VS_* property? - const char* targetFrameworkVersion = - this->GeneratorTarget->GetProperty( - "VS_DOTNET_TARGET_FRAMEWORK_VERSION"); - if (!targetFrameworkVersion) { - targetFrameworkVersion = this->GeneratorTarget->GetProperty( - "DOTNET_TARGET_FRAMEWORK_VERSION"); - } - if (!targetFrameworkVersion && this->ProjectType == csproj && - this->GlobalGenerator->TargetsWindowsCE() && - this->GlobalGenerator->GetVersion() == - cmGlobalVisualStudioGenerator::VS12) { - // VS12 .NETCF default to .NET framework 3.9 - targetFrameworkVersion = "v3.9"; - } - if (targetFrameworkVersion) { - e1.Element("TargetFrameworkVersion", targetFrameworkVersion); + const char* targetFramework = + this->GeneratorTarget->GetProperty("DOTNET_TARGET_FRAMEWORK"); + if (targetFramework) { + if (std::strchr(targetFramework, ';') != nullptr) { + e1.Element("TargetFrameworks", targetFramework); + } else { + e1.Element("TargetFramework", targetFramework); + } + } else { + // TODO: add deprecation warning for VS_* property? + const char* targetFrameworkVersion = + this->GeneratorTarget->GetProperty( + "VS_DOTNET_TARGET_FRAMEWORK_VERSION"); + if (!targetFrameworkVersion) { + targetFrameworkVersion = this->GeneratorTarget->GetProperty( + "DOTNET_TARGET_FRAMEWORK_VERSION"); + } + if (!targetFrameworkVersion && this->ProjectType == csproj && + this->GlobalGenerator->TargetsWindowsCE() && + this->GlobalGenerator->GetVersion() == + cmGlobalVisualStudioGenerator::VS12) { + // VS12 .NETCF default to .NET framework 3.9 + targetFrameworkVersion = "v3.9"; + } + if (targetFrameworkVersion) { + e1.Element("TargetFrameworkVersion", targetFrameworkVersion); + } } if (this->ProjectType == vcxproj && this->GlobalGenerator->TargetsWindowsCE()) { @@ -4110,6 +4120,9 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0) e2.Element("Project", "{" + this->GlobalGenerator->GetGUID(name) + "}"); e2.Element("Name", name); this->WriteDotNetReferenceCustomTags(e2, name); + if (dt->IsCSharpOnly() || cmHasLiteralSuffix(path, "csproj")) { + e2.Element("SkipGetTargetFrameworkProperties", "true"); + } // Don't reference targets that don't produce any output. if (dt->GetManagedType("") == cmGeneratorTarget::ManagedType::Undefined) { diff --git a/Tests/CMakeLib/testCMExtAlgorithm.cxx b/Tests/CMakeLib/testCMExtAlgorithm.cxx index c731b72..b8319c3 100644 --- a/Tests/CMakeLib/testCMExtAlgorithm.cxx +++ b/Tests/CMakeLib/testCMExtAlgorithm.cxx @@ -1,5 +1,6 @@ #include <iostream> #include <memory> +#include <type_traits> #include <utility> #include <vector> diff --git a/Tests/FindGTest/Test/CMakeLists.txt b/Tests/FindGTest/Test/CMakeLists.txt index b65b9d2..6537238 100644 --- a/Tests/FindGTest/Test/CMakeLists.txt +++ b/Tests/FindGTest/Test/CMakeLists.txt @@ -8,6 +8,10 @@ add_executable(test_gtest_tgt main.cxx) target_link_libraries(test_gtest_tgt GTest::Main) add_test(NAME test_gtest_tgt COMMAND test_gtest_tgt) +add_executable(test_gtest_tgt_upstream main.cxx) +target_link_libraries(test_gtest_tgt_upstream GTest::gtest_main) +add_test(NAME test_gtest_tgt_upstream COMMAND test_gtest_tgt_upstream) + add_executable(test_gtest_var main.cxx) target_include_directories(test_gtest_var PRIVATE ${GTEST_INCLUDE_DIRS}) target_link_libraries(test_gtest_var PRIVATE ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 0fb0cc4..3be1fd0 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -38,7 +38,7 @@ run_cpack_test(DEB_PACKAGE_VERSION_BACK_COMPATIBILITY "DEB.DEB_PACKAGE_VERSION_B run_cpack_test_subtests(EXTERNAL "none;good;good_multi;bad_major;bad_minor;invalid_good;invalid_bad;stage_and_package" "External" false "MONOLITHIC;COMPONENT") run_cpack_test_subtests( DEB_DESCRIPTION - "CPACK_DEBIAN_PACKAGE_DESCRIPTION;CPACK_PACKAGE_DESCRIPTION;CPACK_PACKAGE_DESCRIPTION_FILE;CPACK_NO_PACKAGE_DESCRIPTION" + "CPACK_DEBIAN_PACKAGE_DESCRIPTION;CPACK_PACKAGE_DESCRIPTION;CPACK_COMPONENT_COMP_DESCRIPTION;CPACK_PACKAGE_DESCRIPTION_FILE;CPACK_NO_PACKAGE_DESCRIPTION" "DEB.DEB_DESCRIPTION" false "MONOLITHIC;COMPONENT" diff --git a/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/VerifyResult.cmake index a8e2e7a..bfe2059 100644 --- a/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/VerifyResult.cmake @@ -58,6 +58,8 @@ if(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_PACKAGE_DESCRIPTION_FILE" AND PACKAGI string(APPEND _expected_description "\n ." ) elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_NO_PACKAGE_DESCRIPTION") set(_expected_description [[ Description: This is the summary line]]) +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_COMPONENT_COMP_DESCRIPTION") + set(_expected_description [[ Description: One line description]]) endif() foreach(_file_no RANGE 1 ${EXPECTED_FILES_COUNT}) diff --git a/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/test.cmake b/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/test.cmake index ce3f651..893eb01 100644 --- a/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/test.cmake +++ b/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/test.cmake @@ -34,6 +34,16 @@ elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_PACKAGE_DESCRIPTION") set(CPACK_PACKAGE_DESCRIPTION "${_description}") endif() +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_COMPONENT_COMP_DESCRIPTION") + # NOTE Documented fallback variable without CPACK_PACKAGE_DESCRIPTION_SUMMARY + if(PACKAGING_TYPE STREQUAL "COMPONENT") + set(CPACK_COMPONENT_SATU_DESCRIPTION "One line description") + set(CPACK_COMPONENT_DUA_DESCRIPTION "One line description") + else() + set(CPACK_PACKAGE_DESCRIPTION "One line description") + endif() + unset(CPACK_PACKAGE_DESCRIPTION_SUMMARY) + elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_PACKAGE_DESCRIPTION_FILE") # NOTE Getting the description from the file set(_file "${CMAKE_CURRENT_BINARY_DIR}/description.txt") diff --git a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake index c47b40e..b4bdb61 100644 --- a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake @@ -8,9 +8,6 @@ endfunction() if(GENERATOR_TYPE STREQUAL "DEB") set(name_ "Package") set(group_ "Section") - # NOTE For a Debian package the first line of the `Description` - # field is generated by CMake and gonna be ignored - set(ignore_rest_cond_ ".*\n") elseif(GENERATOR_TYPE STREQUAL "RPM") set(name_ "Name") set(group_ "Group") @@ -36,6 +33,6 @@ if(GENERATOR_TYPE STREQUAL "RPM") endif() # check package description -checkPackageInfo_("description" "${FOUND_FILE_1}" ".*Description${whitespaces_}:${ignore_rest_cond_}${whitespaces_}Description for pkg_1") -checkPackageInfo_("description" "${FOUND_FILE_2}" ".*Description${whitespaces_}:${ignore_rest_cond_}${whitespaces_}Description for pkg_2") -checkPackageInfo_("description" "${FOUND_FILE_3}" ".*Description${whitespaces_}:${ignore_rest_cond_}${whitespaces_}Description for pkg_3") +checkPackageInfo_("description" "${FOUND_FILE_1}" ".*Description${whitespaces_}:${whitespaces_}Description for pkg_1") +checkPackageInfo_("description" "${FOUND_FILE_2}" ".*Description${whitespaces_}:${whitespaces_}Description for pkg_2") +checkPackageInfo_("description" "${FOUND_FILE_3}" ".*Description${whitespaces_}:${whitespaces_}Description for pkg_3") diff --git a/Tests/RunCMake/CommandLine/trace-json-v1-check.py b/Tests/RunCMake/CommandLine/trace-json-v1-check.py index 14febaf..e617b76 100755 --- a/Tests/RunCMake/CommandLine/trace-json-v1-check.py +++ b/Tests/RunCMake/CommandLine/trace-json-v1-check.py @@ -46,6 +46,7 @@ required_traces = [ { 'args': msg_args, 'cmd': 'message', + 'frame': 3 if expand else 2 }, ] @@ -59,14 +60,17 @@ with open(trace_file, 'r') as fp: for i in fp.readlines(): line = json.loads(i) - assert sorted(line.keys()) == ['args', 'cmd', 'file', 'line'] + assert sorted(line.keys()) == ['args', 'cmd', 'file', 'frame', 'line', 'time'] assert isinstance(line['args'], list) assert isinstance(line['cmd'], unicode) assert isinstance(line['file'], unicode) + assert isinstance(line['frame'], int) assert isinstance(line['line'], int) + assert isinstance(line['time'], float) for j in required_traces: - if j['cmd'] == line['cmd'] and j['args'] == line['args']: - j['found'] = True + # Compare the subset of required keys with line + if {k: line[k] for k in j} == j: + required_traces.remove(j) -assert all([x.get('found', False) == True for x in required_traces]) +assert not required_traces diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake index 7d32b27..9fd64b0 100644 --- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake @@ -128,6 +128,20 @@ run_ninja(SimpleNoCross all-target build-Debug.ninja simplestatic:all) run_ninja(SimpleNoCross all-all build-Debug.ninja all:all) run_cmake_build(SimpleNoCross all-clean Debug clean:all) +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SimpleCrossConfigs-build) +set(RunCMake_TEST_OPTIONS "-DCMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE=ON;-DCMAKE_NINJA_MULTI_CROSS_CONFIGS=Debug\\;Release") +run_cmake_configure(SimpleCrossConfigs) +include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) +run_ninja(SimpleCrossConfigs release-in-release-graph build-Release.ninja simpleexe) +run_cmake_build(SimpleCrossConfigs debug-in-release-graph Release simpleexe:Debug) +run_cmake_build(SimpleCrossConfigs relwithdebinfo-in-release-graph Release simpleexe:RelWithDebInfo) +run_ninja(SimpleCrossConfigs relwithdebinfo-in-relwithdebinfo-graph build-RelWithDebInfo.ninja simpleexe:RelWithDebInfo) +run_ninja(SimpleCrossConfigs release-in-relwithdebinfo-graph build-RelWithDebInfo.ninja simplestatic:Release) +run_cmake_build(SimpleCrossConfigs all-in-relwithdebinfo-graph RelWithDebInfo simplestatic:all) +run_ninja(SimpleCrossConfigs clean-all-in-release-graph build-Release.ninja clean:all) +run_cmake_build(SimpleCrossConfigs all-all-in-release-graph Release all:all) +run_cmake_build(SimpleCrossConfigs all-relwithdebinfo-in-release-graph Release all:RelWithDebInfo) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CustomCommandGenerator-build) set(RunCMake_TEST_OPTIONS "-DCMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE=ON") run_cmake_configure(CustomCommandGenerator) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-all-in-release-graph-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-all-in-release-graph-build-check.cmake new file mode 100644 index 0000000..fee5951 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-all-in-release-graph-build-check.cmake @@ -0,0 +1,45 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_FILE_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_FILE_simplestatic_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_FILE_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + + ${TARGET_FILE_simpleshared_RelWithDebInfo} + ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + + EXCLUDE + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-in-relwithdebinfo-graph-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-in-relwithdebinfo-graph-build-check.cmake new file mode 100644 index 0000000..fee5951 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-in-relwithdebinfo-graph-build-check.cmake @@ -0,0 +1,45 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_FILE_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_FILE_simplestatic_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_FILE_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + + ${TARGET_FILE_simpleshared_RelWithDebInfo} + ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + + EXCLUDE + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-check.cmake new file mode 100644 index 0000000..fee5951 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-check.cmake @@ -0,0 +1,45 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_FILE_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_FILE_simplestatic_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_FILE_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + + ${TARGET_FILE_simpleshared_RelWithDebInfo} + ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + + EXCLUDE + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-result.txt b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-stderr.txt b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-stderr.txt new file mode 100644 index 0000000..fa8b462 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-all-relwithdebinfo-in-release-graph-build-stderr.txt @@ -0,0 +1 @@ +^ninja: error: unknown target 'all:RelWithDebInfo'$ diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-clean-all-in-release-graph-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-clean-all-in-release-graph-ninja-check.cmake new file mode 100644 index 0000000..6c94369 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-clean-all-in-release-graph-ninja-check.cmake @@ -0,0 +1,31 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + + ${TARGET_FILE_simpleshared_RelWithDebInfo} + ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + + EXCLUDE + ${TARGET_OBJECT_FILES_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_OBJECT_FILES_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-debug-in-release-graph-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-debug-in-release-graph-build-check.cmake new file mode 100644 index 0000000..b6c77ab --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-debug-in-release-graph-build-check.cmake @@ -0,0 +1,37 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + EXCLUDE + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-release-in-release-graph-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-release-in-release-graph-ninja-check.cmake new file mode 100644 index 0000000..d8b5218 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-release-in-release-graph-ninja-check.cmake @@ -0,0 +1,31 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + EXCLUDE + ${TARGET_OBJECT_FILES_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simplestatic_Debug} + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-release-in-relwithdebinfo-graph-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-release-in-relwithdebinfo-graph-ninja-check.cmake new file mode 100644 index 0000000..1a37aa3 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-release-in-relwithdebinfo-graph-ninja-check.cmake @@ -0,0 +1,44 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_FILE_simplestatic_Release} + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_FILE_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + + ${TARGET_FILE_simpleshared_RelWithDebInfo} + ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + + EXCLUDE + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-release-graph-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-release-graph-build-check.cmake new file mode 100644 index 0000000..b6c77ab --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-release-graph-build-check.cmake @@ -0,0 +1,37 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + EXCLUDE + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-release-graph-build-result.txt b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-release-graph-build-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-release-graph-build-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-release-graph-build-stderr.txt b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-release-graph-build-stderr.txt new file mode 100644 index 0000000..f3a825c --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-release-graph-build-stderr.txt @@ -0,0 +1 @@ +^ninja: error: unknown target 'simpleexe:RelWithDebInfo'$ diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-relwithdebinfo-graph-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-relwithdebinfo-graph-ninja-check.cmake new file mode 100644 index 0000000..7eddb2f --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs-relwithdebinfo-in-relwithdebinfo-graph-ninja-check.cmake @@ -0,0 +1,43 @@ +check_files("${RunCMake_TEST_BINARY_DIR}" + INCLUDE + ${GENERATED_FILES} + + ${TARGET_FILE_simpleexe_Debug} + ${TARGET_OBJECT_FILES_simpleexe_Debug} + + ${TARGET_FILE_simpleshared_Debug} + ${TARGET_LINKER_FILE_simpleshared_Debug} + ${TARGET_OBJECT_FILES_simpleshared_Debug} + + ${TARGET_OBJECT_FILES_simpleobj_Debug} + + ${TARGET_FILE_simpleexe_Release} + ${TARGET_OBJECT_FILES_simpleexe_Release} + + ${TARGET_FILE_simpleshared_Release} + ${TARGET_LINKER_FILE_simpleshared_Release} + ${TARGET_OBJECT_FILES_simpleshared_Release} + + ${TARGET_OBJECT_FILES_simpleobj_Release} + + ${TARGET_FILE_simpleexe_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleexe_RelWithDebInfo} + + ${TARGET_FILE_simpleshared_RelWithDebInfo} + ${TARGET_LINKER_FILE_simpleshared_RelWithDebInfo} + ${TARGET_OBJECT_FILES_simpleshared_RelWithDebInfo} + + ${TARGET_OBJECT_FILES_simpleobj_RelWithDebInfo} + + EXCLUDE + ${TARGET_OBJECT_FILES_simplestatic_Debug} + + ${TARGET_OBJECT_FILES_simplestatic_Release} + + ${TARGET_OBJECT_FILES_simpleexe_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleshared_MinSizeRel} + ${TARGET_OBJECT_FILES_simplestatic_MinSizeRel} + ${TARGET_OBJECT_FILES_simpleobj_MinSizeRel} + + ${TARGET_OBJECT_FILES_simplestatic_RelWithDebInfo} + ) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs.cmake b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs.cmake new file mode 100644 index 0000000..2a5b708 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleCrossConfigs.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_SOURCE_DIR}/Simple.cmake") diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index 5cbe333..8a04f78 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -53,3 +53,6 @@ if (RunCMake_GENERATOR MATCHES "Visual Studio 1[0-4] 201[0-5]" OR else() run_cmake(UnityBuildNative) endif() + +run_cmake(VsDotnetTargetFramework) +run_cmake(VsDotnetTargetFrameworkVersion) diff --git a/Tests/RunCMake/VS10Project/VSDotnetTargetFrameworkVersion.cmake b/Tests/RunCMake/VS10Project/VSDotnetTargetFrameworkVersion.cmake new file mode 100644 index 0000000..8e0e0b4 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VSDotnetTargetFrameworkVersion.cmake @@ -0,0 +1,10 @@ +enable_language(CSharp) +if(NOT CMAKE_CSharp_COMPILER) + return() +endif() + +set(CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION "v4.6.1") +add_library(foo SHARED foo.cs) + +set(CMAKE_DOTNET_TARGET_FRAMEWORK "netcoreapp3.1") +add_library(bar SHARED foo.cs) diff --git a/Tests/RunCMake/VS10Project/VsDotnetTargetFramework-check.cmake b/Tests/RunCMake/VS10Project/VsDotnetTargetFramework-check.cmake new file mode 100644 index 0000000..e656639 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsDotnetTargetFramework-check.cmake @@ -0,0 +1,40 @@ +set(files foo.csproj bar.csproj) + +set(inLib1 FALSE) +set(targetFrameworkInLib1 FALSE) + +set(inLib2 FALSE) +set(targetFrameworksInLib2 FALSE) + +foreach(file ${files}) + set(csProjectFile ${RunCMake_TEST_BINARY_DIR}/${file}) + + if(NOT EXISTS "${csProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${csProjectFile} does not exist.") + return() + endif() + + file(STRINGS "${csProjectFile}" lines) + + foreach(line IN LISTS lines) + if(NOT inLib1) + if(line MATCHES " *<TargetFramework>netcoreapp3.1</TargetFramework> *$") + set(targetFrameworkInLib1 TRUE) + set(inLib1 TRUE) + endif() + elseif(NOT inLib2) + if(line MATCHES " *<TargetFrameworks>netcoreapp3.1;net461</TargetFrameworks> *$") + set(targetFrameworksInLib2 TRUE) + set(inLib2 TRUE) + endif() + endif() + endforeach() +endforeach() + +if(NOT targetFrameworkInLib1) + set(RunCMake_TEST_FAILED "TargetFramework not set correctly.") +endif() + +if(NOT targetFrameworksInLib2) + set(RunCMake_TEST_FAILED "TargetFrameworks not set correctly.") +endif() diff --git a/Tests/RunCMake/VS10Project/VsDotnetTargetFramework.cmake b/Tests/RunCMake/VS10Project/VsDotnetTargetFramework.cmake new file mode 100644 index 0000000..f553679 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsDotnetTargetFramework.cmake @@ -0,0 +1,11 @@ +enable_language(CSharp) +if(NOT CMAKE_CSharp_COMPILER) + return() +endif() + +set(CMAKE_DOTNET_TARGET_FRAMEWORK "netcoreapp3.1") +set(CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION "net461") +add_library(foo SHARED foo.cs) + +set(CMAKE_DOTNET_TARGET_FRAMEWORK "netcoreapp3.1;net461") +add_library(bar SHARED foo.cs) diff --git a/Tests/RunCMake/VS10Project/VsDotnetTargetFrameworkVersion-check.cmake b/Tests/RunCMake/VS10Project/VsDotnetTargetFrameworkVersion-check.cmake new file mode 100644 index 0000000..d2c3c3b --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsDotnetTargetFrameworkVersion-check.cmake @@ -0,0 +1,40 @@ +set(files foo.csproj bar.csproj) + +set(inLib1 FALSE) +set(targetFrameworkInLib1 FALSE) + +set(inLib2 FALSE) +set(targetFrameworksInLib2 FALSE) + +foreach(file ${files}) + set(csProjectFile ${RunCMake_TEST_BINARY_DIR}/${file}) + + if(NOT EXISTS "${csProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${csProjectFile} does not exist.") + return() + endif() + + file(STRINGS "${csProjectFile}" lines) + + foreach(line IN LISTS lines) + if(NOT inLib1) + if(line MATCHES " *<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> *$") + set(targetFrameworkInLib1 TRUE) + set(inLib1 TRUE) + endif() + elseif(NOT inLib2) + if(line MATCHES " *<TargetFramework>netcoreapp3.1</TargetFramework> *$") + set(targetFrameworksInLib2 TRUE) + set(inLib2 TRUE) + endif() + endif() + endforeach() +endforeach() + +if(NOT targetFrameworkInLib1) + set(RunCMake_TEST_FAILED "TargetFrameworkVersion not set correctly.") +endif() + +if(NOT targetFrameworksInLib2) + set(RunCMake_TEST_FAILED "TargetFramework not set correctly.") +endif() diff --git a/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake b/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake index 47dac34..7ed0773 100644 --- a/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake +++ b/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake @@ -5,3 +5,7 @@ run_cmake(CustomGuid) run_cmake(CustomTypePlatform) run_cmake(CustomGuidTypePlatform) run_cmake(CustomConfig) + +if(RunCMake_GENERATOR MATCHES "Visual Studio ([^9]|9[0-9])") + run_cmake(SkipGetTargetFrameworkProperties) +endif() diff --git a/Tests/RunCMake/include_external_msproject/SkipGetTargetFrameworkProperties-check.cmake b/Tests/RunCMake/include_external_msproject/SkipGetTargetFrameworkProperties-check.cmake new file mode 100644 index 0000000..375b231 --- /dev/null +++ b/Tests/RunCMake/include_external_msproject/SkipGetTargetFrameworkProperties-check.cmake @@ -0,0 +1,21 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/ALL_BUILD.vcxproj" all_build) + +macro(project_reference EXTERNAL_PROJECT) + string(REGEX MATCH + "<ProjectReference.Include=.${${EXTERNAL_PROJECT}}.>.*</SkipGetTargetFrameworkProperties>" + EndOfProjectReference + ${all_build} + ) +endmacro() + +set(external_project "external.project") +project_reference(external_project) +if(NOT ${EndOfProjectReference} MATCHES ".*</ProjectReference>") + set(RunCMake_TEST_FAILED "${test} is being set unexpectedly.") +endif() + +set(external_project "external.csproj") +project_reference(external_project) +if(${EndOfProjectReference} MATCHES ".*</ProjectReference>") + set(RunCMake_TEST_FAILED "${test} is not set.") +endif() diff --git a/Tests/RunCMake/include_external_msproject/SkipGetTargetFrameworkProperties.cmake b/Tests/RunCMake/include_external_msproject/SkipGetTargetFrameworkProperties.cmake new file mode 100644 index 0000000..f660bd0 --- /dev/null +++ b/Tests/RunCMake/include_external_msproject/SkipGetTargetFrameworkProperties.cmake @@ -0,0 +1,5 @@ +include_external_msproject(external1 external.project + GUID aaa-bbb-ccc-000) + +include_external_msproject(external2 external.csproj + GUID aaa-bbb-ccc-001) diff --git a/Utilities/std/cmext/algorithm b/Utilities/std/cmext/algorithm index 609860c..44e61f4 100644 --- a/Utilities/std/cmext/algorithm +++ b/Utilities/std/cmext/algorithm @@ -10,43 +10,154 @@ #include <iterator> #include <memory> #include <utility> -#include <vector> #include <cm/type_traits> #include <cmext/iterator> +#if defined(__SUNPRO_CC) && defined(__sparc) +# include <list> +# include <vector> +#else +# include <cmext/type_traits> +#endif + namespace cm { -template <typename T> -void append(std::vector<std::unique_ptr<T>>& v, - std::vector<std::unique_ptr<T>>&& r) +#if defined(__SUNPRO_CC) && defined(__sparc) +// Oracle DeveloperStudio C++ compiler on Solaris/Sparc fails to compile +// templates with constraints. +// So, on this platform, use only simple templates. +# define APPEND_TWO(C1, C2) \ + template <typename T, typename U> \ + void append(C1<std::unique_ptr<T>>& v, C2<std::unique_ptr<U>>&& r) \ + { \ + std::transform( \ + r.begin(), r.end(), std::back_inserter(v), \ + [](std::unique_ptr<U>& item) { return std::move(item); }); \ + r.clear(); \ + } \ + \ + template <typename T, typename U> \ + void append(C1<T*>& v, C2<std::unique_ptr<U>> const& r) \ + { \ + std::transform( \ + r.begin(), r.end(), std::back_inserter(v), \ + [](const std::unique_ptr<U>& item) { return item.get(); }); \ + } + +# define APPEND_ONE(C) \ + template <typename T, typename InputIt, \ + cm::enable_if_t<cm::is_input_iterator<InputIt>::value, int> = \ + 0> \ + void append(C<T>& v, InputIt first, InputIt last) \ + { \ + v.insert(v.end(), first, last); \ + } \ + \ + template <typename T, typename Range, \ + cm::enable_if_t<cm::is_input_range<Range>::value, int> = 0> \ + void append(C<T>& v, Range const& r) \ + { \ + v.insert(v.end(), r.begin(), r.end()); \ + } + +# define APPEND(C) \ + APPEND_TWO(C, C) \ + APPEND_ONE(C) + +# define APPEND_MIX(C1, C2) \ + APPEND_TWO(C1, C2) \ + APPEND_TWO(C2, C1) + +// For now, manage only support for std::vector and std::list. +// Other sequential container support can be added if needed. +APPEND(std::vector) +APPEND(std::list) +APPEND_MIX(std::vector, std::list) + +# undef APPEND +# undef APPEND_MIX +# undef APPEND_TWO +# undef APPEND_ONE + +#else + +template < + typename Container1, typename Container2, + cm::enable_if_t< + cm::is_sequence_container<Container1>::value && + cm::is_unique_ptr<typename Container1::value_type>::value && + cm::is_unique_ptr<typename Container2::value_type>::value && + std::is_convertible<typename Container2::value_type::pointer, + typename Container1::value_type::pointer>::value, + int> = 0> +void append(Container1& v, Container2&& r) { - std::transform(r.begin(), r.end(), std::back_inserter(v), - [](std::unique_ptr<T>& item) { return std::move(item); }); + std::transform( + r.begin(), r.end(), std::back_inserter(v), + [](typename Container2::value_type& item) { return std::move(item); }); r.clear(); } -template <typename T> -void append(std::vector<T*>& v, std::vector<std::unique_ptr<T>> const& r) +template <typename Container1, typename Container2, + cm::enable_if_t< + cm::is_sequence_container<Container1>::value && + std::is_pointer<typename Container1::value_type>::value && + cm::is_unique_ptr<typename Container2::value_type>::value && + std::is_convertible<typename Container2::value_type::pointer, + typename Container1::value_type>::value, + int> = 0> +# if defined(__SUNPRO_CC) +void append(Container1& v, Container2 const& r, detail::overload_selector<0>) +# else +void append(Container1& v, Container2 const& r) +# endif { - std::transform(r.begin(), r.end(), std::back_inserter(v), - [](const std::unique_ptr<T>& item) { return item.get(); }); + std::transform( + r.begin(), r.end(), std::back_inserter(v), + [](const typename Container2::value_type& item) { return item.get(); }); } -template <typename T, typename InputIt, - cm::enable_if_t<cm::is_input_iterator<InputIt>::value, int> = 0> -void append(std::vector<T>& v, InputIt first, InputIt last) +template < + typename Container, typename InputIt, + cm::enable_if_t< + cm::is_sequence_container<Container>::value && + cm::is_input_iterator<InputIt>::value && + std::is_convertible<typename std::iterator_traits<InputIt>::value_type, + typename Container::value_type>::value, + int> = 0> +void append(Container& v, InputIt first, InputIt last) { v.insert(v.end(), first, last); } -template <typename T, typename Range, - cm::enable_if_t<cm::is_input_range<Range>::value, int> = 0> -void append(std::vector<T>& v, Range const& r) +template <typename Container, typename Range, + cm::enable_if_t< + cm::is_sequence_container<Container>::value && + cm::is_input_range<Range>::value && + !cm::is_unique_ptr<typename Container::value_type>::value && + !cm::is_unique_ptr<typename Range::value_type>::value && + std::is_convertible<typename Range::value_type, + typename Container::value_type>::value, + int> = 0> +# if defined(__SUNPRO_CC) +void append(Container& v, Range const& r, detail::overload_selector<1>) +# else +void append(Container& v, Range const& r) +# endif { v.insert(v.end(), r.begin(), r.end()); } +# if defined(__SUNPRO_CC) +template <typename T, typename U> +void append(T& v, U const& r) +{ + cm::append(v, r, detail::overload_selector<1>{}); +} +# endif +#endif + } // namespace cm #endif diff --git a/Utilities/std/cmext/type_traits b/Utilities/std/cmext/type_traits index da6550d..00984cb 100644 --- a/Utilities/std/cmext/type_traits +++ b/Utilities/std/cmext/type_traits @@ -10,6 +10,24 @@ namespace cm { +#if defined(__SUNPRO_CC) +// Oracle DeveloperStudio C++ compiler do not support overloaded templates with +// same signature but different constraints over template arguments +// (i.e. meta-programming). +// As a work-around, use a structure to avoid templates with same signature. +namespace detail { +template <int N> +struct overload_selector : overload_selector<N - 1> +{ +}; + +template <> +struct overload_selector<0> +{ +}; +} +#endif + // type traits for managed pointer types template <typename> struct is_unique_ptr : std::false_type |