diff options
-rw-r--r-- | Help/command/set.rst | 9 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmSetCommand.cxx | 8 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 18 | ||||
-rw-r--r-- | Tests/RunCMake/VS10ProjectWinCE/VsCEDebuggerDeploy-check.cmake | 8 | ||||
-rw-r--r-- | Tests/RunCMake/set/ExtraEnvValue-stderr.txt | 6 | ||||
-rw-r--r-- | Tests/RunCMake/set/ExtraEnvValue.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/set/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/VSWinStorePhone/CMakeLists.txt | 11 | ||||
-rw-r--r-- | Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.cpp | 4 | ||||
-rw-r--r-- | Tests/VSWinStorePhone/WinRT/Batman.cpp | 14 | ||||
-rw-r--r-- | Tests/VSWinStorePhone/WinRT/Batman.h | 12 | ||||
-rw-r--r-- | Tests/VSWinStorePhone/WinRT/CMakeLists.txt | 13 |
13 files changed, 99 insertions, 8 deletions
diff --git a/Help/command/set.rst b/Help/command/set.rst index dd5ea13..c0e02e2 100644 --- a/Help/command/set.rst +++ b/Help/command/set.rst @@ -86,7 +86,7 @@ Set Environment Variable .. code-block:: cmake - set(ENV{<variable>} <value>...) + set(ENV{<variable>} [<value>]) Sets an :manual:`Environment Variable <cmake-env-variables(7)>` to the given value. @@ -95,3 +95,10 @@ Subsequent calls of ``$ENV{<variable>}`` will return this new value. This command affects only the current CMake process, not the process from which CMake was called, nor the system environment at large, nor the environment of subsequent build or test processes. + +If no argument is given after ``ENV{<variable>}`` or if ``<value>`` is +an empty string, then this command will clear any existing value of the +environment variable. + +Arguments after ``<value>`` are ignored. If extra arguments are found, +then an author warning is issued. diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0a65114..0d1fb40 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 13) -set(CMake_VERSION_PATCH 20190201) +set(CMake_VERSION_PATCH 20190204) #set(CMake_VERSION_RC 1) diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index b09e3ca..6bd071c 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -38,6 +38,14 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args, putEnvArg += args[1]; cmSystemTools::PutEnv(putEnvArg); } + // if there's extra arguments, warn user + // that they are ignored by this command. + if (args.size() > 2) { + std::string m = "Only the first value argument is used when setting " + "an environment variable. Argument '" + + args[2] + "' and later are unused."; + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, m); + } return true; } diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 9d7dd07..178e717 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -376,7 +376,13 @@ void cmVisualStudio10TargetGenerator::Generate() { Elem e0(BuildFileStream, "Project"); e0.Attribute("DefaultTargets", "Build"); - e0.Attribute("ToolsVersion", this->GlobalGenerator->GetToolsVersion()); + const char* toolsVersion = this->GlobalGenerator->GetToolsVersion(); + if (this->GlobalGenerator->GetVersion() == + cmGlobalVisualStudioGenerator::VS12 && + this->GlobalGenerator->TargetsWindowsCE()) { + toolsVersion = "4.0"; + } + e0.Attribute("ToolsVersion", toolsVersion); e0.Attribute("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"); @@ -3884,8 +3890,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0) this->WriteDotNetReferenceCustomTags(e2, name); // If the dependency target is not managed (compiled with /clr or - // C# target) we cannot reference it and have to set - // 'ReferenceOutputAssembly' to false. + // C# target) and not a WinRT component we cannot reference it and + // have to set 'ReferenceOutputAssembly' to false. auto referenceNotManaged = dt->GetManagedType("") < cmGeneratorTarget::ManagedType::Mixed; // Workaround to check for manually set /clr flags. @@ -3902,6 +3908,12 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0) if (referenceNotManaged && dt->GetType() == cmStateEnums::STATIC_LIBRARY) { referenceNotManaged = !dt->IsCSharpOnly(); } + + // Referencing WinRT components is okay. + if (referenceNotManaged) { + referenceNotManaged = !dt->GetPropertyAsBool("VS_WINRT_COMPONENT"); + } + if (referenceNotManaged) { e2.Element("ReferenceOutputAssembly", "false"); e2.Element("CopyToOutputDirectory", "Never"); diff --git a/Tests/RunCMake/VS10ProjectWinCE/VsCEDebuggerDeploy-check.cmake b/Tests/RunCMake/VS10ProjectWinCE/VsCEDebuggerDeploy-check.cmake index c66676f..6ab3833 100644 --- a/Tests/RunCMake/VS10ProjectWinCE/VsCEDebuggerDeploy-check.cmake +++ b/Tests/RunCMake/VS10ProjectWinCE/VsCEDebuggerDeploy-check.cmake @@ -13,6 +13,7 @@ endif() set(FoundCEAdditionalFiles FALSE) set(FoundRemoteDirectory FALSE) +set(FoundToolsVersion4 FALSE) file(STRINGS "${vcProjectFile}" lines) foreach(line IN LISTS lines) @@ -20,6 +21,8 @@ foreach(line IN LISTS lines) set(FoundCEAdditionalFiles TRUE) elseif(line MATCHES " *<RemoteDirectory>[A-Za-z0-9\\]+</RemoteDirectory> *$") set(FoundRemoteDirectory TRUE) + elseif(line MATCHES " *<Project +.*ToolsVersion=\"4.0\".*> *$") + set(FoundToolsVersion4 TRUE) endif() endforeach() @@ -32,3 +35,8 @@ if(NOT FoundRemoteDirectory) set(RunCMake_TEST_FAILED "RemoteDirectory not found or not set correctly.") return() endif() + +if(NOT FoundToolsVersion4) + set(RunCMake_TEST_FAILED "Failed to find correct ToolsVersion=\"4.0\" .") + return() +endif() diff --git a/Tests/RunCMake/set/ExtraEnvValue-stderr.txt b/Tests/RunCMake/set/ExtraEnvValue-stderr.txt new file mode 100644 index 0000000..f61f9d2 --- /dev/null +++ b/Tests/RunCMake/set/ExtraEnvValue-stderr.txt @@ -0,0 +1,6 @@ +CMake Warning \(dev\) at ExtraEnvValue.cmake:1 \(set\): + Only the first value argument is used when setting an environment variable. + Argument 'value_2' and later are unused. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/set/ExtraEnvValue.cmake b/Tests/RunCMake/set/ExtraEnvValue.cmake new file mode 100644 index 0000000..768a6ea --- /dev/null +++ b/Tests/RunCMake/set/ExtraEnvValue.cmake @@ -0,0 +1 @@ +set (ENV{sample_key} value_1 value_2) diff --git a/Tests/RunCMake/set/RunCMakeTest.cmake b/Tests/RunCMake/set/RunCMakeTest.cmake index ea63d0b..b3bd0a4 100644 --- a/Tests/RunCMake/set/RunCMakeTest.cmake +++ b/Tests/RunCMake/set/RunCMakeTest.cmake @@ -4,3 +4,4 @@ run_cmake(ParentScope) run_cmake(ParentPulling) run_cmake(ParentPullingRecursive) run_cmake(UnknownCacheType) +run_cmake(ExtraEnvValue) diff --git a/Tests/VSWinStorePhone/CMakeLists.txt b/Tests/VSWinStorePhone/CMakeLists.txt index acda117..efc7760 100644 --- a/Tests/VSWinStorePhone/CMakeLists.txt +++ b/Tests/VSWinStorePhone/CMakeLists.txt @@ -8,6 +8,8 @@ elseif(MSVC_VERSION GREATER 1600) set(COMPILER_VERSION "11") endif() +add_subdirectory(WinRT) + set (APP_MANIFEST_NAME Package.appxmanifest) if("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsPhone") set(PLATFORM WP) @@ -139,11 +141,14 @@ if("${SHORT_VERSION}" STREQUAL "10.0") message(STATUS "Targeting Windows 10. Setting Extensions to version ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") set_property(TARGET ${EXE_NAME} PROPERTY VS_DESKTOP_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") set_property(TARGET ${EXE_NAME} PROPERTY VS_MOBILE_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") - set_property(TARGET ${EXE_NAME} PROPERTY VS_IOT_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") + + # The last IOT reference is on 10.0.17134.0, so only add it if supported + if("${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}" VERSION_LESS "10.0.17135.0") + set_property(TARGET ${EXE_NAME} PROPERTY VS_IOT_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") + endif() # Add a reference to an SDK set_property(TARGET ${EXE_NAME} PROPERTY VS_SDK_REFERENCES "Microsoft.UniversalCRT.Debug, Version=${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") endif() - -target_link_libraries(${EXE_NAME} d3d11) +target_link_libraries(${EXE_NAME} d3d11 JusticeLeagueWinRT) diff --git a/Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.cpp b/Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.cpp index 1c969cd..3ba35fa 100644 --- a/Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.cpp +++ b/Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.cpp @@ -6,11 +6,15 @@ using namespace DirectX; using namespace Microsoft::WRL; using namespace Windows::Foundation; using namespace Windows::UI::Core; +using namespace JusticeLeagueWinRT; CubeRenderer::CubeRenderer() : m_loadingComplete(false) , m_indexCount(0) { + // Create a new WinRT object to validate that we can link properly + Batman ^ hero = ref new Batman(); + hero->savePeople(); } void CubeRenderer::CreateDeviceResources() diff --git a/Tests/VSWinStorePhone/WinRT/Batman.cpp b/Tests/VSWinStorePhone/WinRT/Batman.cpp new file mode 100644 index 0000000..e092258 --- /dev/null +++ b/Tests/VSWinStorePhone/WinRT/Batman.cpp @@ -0,0 +1,14 @@ +#include "Batman.h" + +using namespace JusticeLeagueWinRT; +using namespace Platform; + +Batman::Batman() +{ +} + +void Batman::savePeople() +{ + int i = 0; + i++; +} diff --git a/Tests/VSWinStorePhone/WinRT/Batman.h b/Tests/VSWinStorePhone/WinRT/Batman.h new file mode 100644 index 0000000..e2dcabc --- /dev/null +++ b/Tests/VSWinStorePhone/WinRT/Batman.h @@ -0,0 +1,12 @@ +#pragma once + +namespace JusticeLeagueWinRT { +public +ref class Batman sealed +{ +public: + Batman(); + + void savePeople(); +}; +} diff --git a/Tests/VSWinStorePhone/WinRT/CMakeLists.txt b/Tests/VSWinStorePhone/WinRT/CMakeLists.txt new file mode 100644 index 0000000..bb93333 --- /dev/null +++ b/Tests/VSWinStorePhone/WinRT/CMakeLists.txt @@ -0,0 +1,13 @@ +project(JusticeLeagueWinRT CXX) + +# create project +add_library(JusticeLeagueWinRT SHARED + "${CMAKE_CURRENT_SOURCE_DIR}/Batman.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/Batman.h" +) + +set_target_properties(JusticeLeagueWinRT PROPERTIES + VS_WINRT_COMPONENT TRUE + VS_GLOBAL_ROOTNAMESPACE "JusticeLeagueWinRT" + OUTPUT_NAME "JusticeLeagueWinRT" +) |