diff options
author | Kenney Phillis <kphillisjr@gmail.com> | 2020-03-06 05:18:03 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-04-21 12:10:45 (GMT) |
commit | 7ca13e04fa9301325d7d0f7cd664829e65f2b4c1 (patch) | |
tree | 308334f0e41a9eebca2d5dcdec46fd42d9921930 /Tests/MSManifest | |
parent | b8b804e2ed8dca3c6d116a6e8a1cb66cbd6ad241 (diff) | |
download | CMake-7ca13e04fa9301325d7d0f7cd664829e65f2b4c1.zip CMake-7ca13e04fa9301325d7d0f7cd664829e65f2b4c1.tar.gz CMake-7ca13e04fa9301325d7d0f7cd664829e65f2b4c1.tar.bz2 |
Windows: Merge user-provided manifests into compiled resource
Previously we merged user-provided manifests only into the manifest file
given to the linker. Merge them into the manifest file that is compiled
as a resource too.
Diffstat (limited to 'Tests/MSManifest')
-rw-r--r-- | Tests/MSManifest/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/MSManifest/Subdir/CMakeLists.txt | 7 | ||||
-rw-r--r-- | Tests/MSManifest/Subdir2/CMakeLists.txt | 13 | ||||
-rw-r--r-- | Tests/MSManifest/Subdir2/check.cmake | 22 | ||||
-rw-r--r-- | Tests/MSManifest/Subdir2/main.c | 4 | ||||
-rw-r--r-- | Tests/MSManifest/Subdir2/test_manifest1.in | 5 | ||||
-rw-r--r-- | Tests/MSManifest/Subdir2/test_manifest2.in | 12 | ||||
-rw-r--r-- | Tests/MSManifest/Subdir2/test_manifest3.in | 9 |
8 files changed, 71 insertions, 4 deletions
diff --git a/Tests/MSManifest/CMakeLists.txt b/Tests/MSManifest/CMakeLists.txt index 300cfa6..631c598 100644 --- a/Tests/MSManifest/CMakeLists.txt +++ b/Tests/MSManifest/CMakeLists.txt @@ -1,5 +1,8 @@ cmake_minimum_required(VERSION 3.3) project(MSManifest C) +include(CTest) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) add_subdirectory(Subdir) +add_subdirectory(Subdir2) diff --git a/Tests/MSManifest/Subdir/CMakeLists.txt b/Tests/MSManifest/Subdir/CMakeLists.txt index 11272bb..8664572 100644 --- a/Tests/MSManifest/Subdir/CMakeLists.txt +++ b/Tests/MSManifest/Subdir/CMakeLists.txt @@ -2,10 +2,9 @@ configure_file(test.manifest.in test.manifest) add_executable(MSManifest main.c ${CMAKE_CURRENT_BINARY_DIR}/test.manifest) if(MSVC AND NOT MSVC_VERSION LESS 1400) - add_custom_command(TARGET MSManifest POST_BUILD VERBATIM - COMMAND ${CMAKE_COMMAND} -Dexe=$<TARGET_FILE:MSManifest> - -P ${CMAKE_CURRENT_SOURCE_DIR}/check.cmake - ) + add_test(NAME MSManifest.Single COMMAND + ${CMAKE_COMMAND} -Dexe=$<TARGET_FILE:MSManifest> + -P ${CMAKE_CURRENT_SOURCE_DIR}/check.cmake) add_executable(MSManifestNone main.c) set_property(TARGET MSManifestNone PROPERTY LINK_FLAGS "/MANIFEST:NO") endif() diff --git a/Tests/MSManifest/Subdir2/CMakeLists.txt b/Tests/MSManifest/Subdir2/CMakeLists.txt new file mode 100644 index 0000000..19d8de7 --- /dev/null +++ b/Tests/MSManifest/Subdir2/CMakeLists.txt @@ -0,0 +1,13 @@ +configure_file(test_manifest1.in test_manifest1.manifest) +configure_file(test_manifest2.in test_manifest2.manifest) +configure_file(test_manifest3.in test_manifest3.manifest) +add_executable(MSMultipleManifest main.c + ${CMAKE_CURRENT_BINARY_DIR}/test_manifest1.manifest + ${CMAKE_CURRENT_BINARY_DIR}/test_manifest2.manifest + ${CMAKE_CURRENT_BINARY_DIR}/test_manifest3.manifest) + +if(MSVC AND NOT MSVC_VERSION LESS 1400) + add_test(NAME MSManifest.Multiple COMMAND + ${CMAKE_COMMAND} -Dexe=$<TARGET_FILE:MSMultipleManifest> + -P ${CMAKE_CURRENT_SOURCE_DIR}/check.cmake) +endif() diff --git a/Tests/MSManifest/Subdir2/check.cmake b/Tests/MSManifest/Subdir2/check.cmake new file mode 100644 index 0000000..4a1705b --- /dev/null +++ b/Tests/MSManifest/Subdir2/check.cmake @@ -0,0 +1,22 @@ +file(STRINGS "${exe}" manifest_content1 REGEX "name=\"Kitware.CMake.MSMultipleManifest\"") +if(manifest_content1) + message(STATUS "Expected manifest content found:\n ${manifest_content1}") +else() + message(FATAL_ERROR "Expected manifest content not found in\n ${exe}") +endif() + +# Verify Second Manifest Content is inside Executable. +file(STRINGS "${exe}" manifest_content2 REGEX "8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a") +if(manifest_content2) + message(STATUS "Expected manifest content found:\n ${manifest_content2}") +else() + message(FATAL_ERROR "Expected manifest content not found in\n ${exe}") +endif() + +# Verify Third Manifest Content is inside Executable. +file(STRINGS "${exe}" manifest_content3 REGEX "<dpiAware>true</dpiAware>") +if(manifest_content3) + message(STATUS "Expected manifest content found:\n ${manifest_content3}") +else() + message(FATAL_ERROR "Expected manifest content not found in\n ${exe}") +endif() diff --git a/Tests/MSManifest/Subdir2/main.c b/Tests/MSManifest/Subdir2/main.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/MSManifest/Subdir2/main.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/MSManifest/Subdir2/test_manifest1.in b/Tests/MSManifest/Subdir2/test_manifest1.in new file mode 100644 index 0000000..f36eead --- /dev/null +++ b/Tests/MSManifest/Subdir2/test_manifest1.in @@ -0,0 +1,5 @@ +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> + <assemblyIdentity type="win32" version="1.0.0.0" + name="Kitware.CMake.MSMultipleManifest"/> + <description>CMake Multiple Manifest Test Application</description> +</assembly> diff --git a/Tests/MSManifest/Subdir2/test_manifest2.in b/Tests/MSManifest/Subdir2/test_manifest2.in new file mode 100644 index 0000000..ec96f11 --- /dev/null +++ b/Tests/MSManifest/Subdir2/test_manifest2.in @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"> + <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> + <application> + <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"></supportedOS> + <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"></supportedOS> + <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS> + <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"></supportedOS> + <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS> + </application> + </compatibility> +</assembly> diff --git a/Tests/MSManifest/Subdir2/test_manifest3.in b/Tests/MSManifest/Subdir2/test_manifest3.in new file mode 100644 index 0000000..0770e11 --- /dev/null +++ b/Tests/MSManifest/Subdir2/test_manifest3.in @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" > + <asmv3:application> + <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"> + <dpiAware>true</dpiAware> + <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness> + </asmv3:windowsSettings> + </asmv3:application> +</assembly> |