View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012051CMakeCMakepublic2011-04-06 09:222012-01-02 15:56
ReporterYuchen Deng 
Assigned ToDavid Cole 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionno change required 
PlatformWindowsOSWindows 7OS VersionSP1
Product VersionCMake 2.8.4 
Target VersionCMake 2.8.5Fixed in VersionCMake 2.8.5 
Summary0012051: MSVC, Linker option "/MANIFEST:NO" can not work
DescriptionHi, CMake Term!!
CMake is a great Build System, Many thanks for your work!!
And now I meet a question, and can't solved it by myself.
I am reading the CMake source, and find the local variable 'hasManifest' always been true.
---
int cmake::VisualStudioLink(std::vector<std::string>& args, int type)
{
  ...

  if(hasIncremental && hasManifest)
    {
    if(verbose)
      {
      std::cout << "Visual Studio Incremental Link with embeded manifests\n";
      }
    return cmake::VisualStudioLinkIncremental(expandedArgs, type, verbose);
    }
----

Here is my CMakeLists.txt
---
project(SdkWindow)
cmake_minimum_required(VERSION 2.8)

add_definitions(-D_UNICODE -DUNICODE)
set(CMAKE_LINK_FLAGS "${CMAKE_LINK_FLAGS} /MANIFEST:NO /OPT:REF /OPT:ICF")

aux_source_directory(. SRC_LIST)
add_executable(${PROJECT_NAME} WIN32 ${SRC_LIST})
---

Here is the output log:

**** Build of configuration Default for project SdkWindow ****

cmd /C if not exist Build (mkdir Build && chdir Build && cmake -GNMake Makefiles /MANIFEST:NO .. && nmake verbose=1) else chdir Build && cmake -GNMake Makefiles .. && nmake all
-- The C compiler identification is MSVC
-- The CXX compiler identification is MSVC
-- Check for CL compiler version
-- Check for CL compiler version - 1600
-- Check if this is a free VC compiler
-- Check if this is a free VC compiler - no
-- Check for working C compiler: D:/DengYC/LoveDEV/bin/cl.exe
-- Check for working C compiler: D:/DengYC/LoveDEV/bin/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: D:/DengYC/LoveDEV/bin/cl.exe
-- Check for working CXX compiler: D:/DengYC/LoveDEV/bin/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: D:/DengYC/TestDemos/SDK/SdkWindow/Build

Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.

    D:\DengYC\LoveDEV\bin\cmake.exe -HD:\DengYC\TestDemos\SDK\SdkWindow -BD:\DengYC\TestDemos\SDK\SdkWindow\Build --check-build-system CMakeFiles\Makefile.cmake 0
    D:\DengYC\LoveDEV\bin\cmake.exe -E cmake_progress_start D:\DengYC\TestDemos\SDK\SdkWindow\Build\CMakeFiles D:\DengYC\TestDemos\SDK\SdkWindow\Build\CMakeFiles\progress.marks
    D:\DengYC\LoveDEV\bin\nmake.exe -f CMakeFiles\Makefile2 /nologo - all
    D:\DengYC\LoveDEV\bin\nmake.exe -f CMakeFiles\SdkWindow.dir\build.make /nologo -L CMakeFiles\SdkWindow.dir\depend
    D:\DengYC\LoveDEV\bin\cmake.exe -E cmake_depends "NMake Makefiles" D:\DengYC\TestDemos\SDK\SdkWindow D:\DengYC\TestDemos\SDK\SdkWindow D:\DengYC\TestDemos\SDK\SdkWindow\Build D:\DengYC\TestDemos\SDK\SdkWindow\Build D:\DengYC\TestDemos\SDK\SdkWindow\Build\CMakeFiles\SdkWindow.dir\DependInfo.cmake --color=
Dependee "D:\DengYC\TestDemos\SDK\SdkWindow\Build\CMakeFiles\SdkWindow.dir\DependInfo.cmake" is newer than depender "D:/DengYC/TestDemos/SDK/SdkWindow/Build/CMakeFiles/SdkWindow.dir/depend.internal".
Dependee "D:/DengYC/TestDemos/SDK/SdkWindow/Build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "D:/DengYC/TestDemos/SDK/SdkWindow/Build/CMakeFiles/SdkWindow.dir/depend.internal".
Scanning dependencies of target SdkWindow
    D:\DengYC\LoveDEV\bin\nmake.exe -f CMakeFiles\SdkWindow.dir\build.make /nologo -L CMakeFiles\SdkWindow.dir\build
    D:\DengYC\LoveDEV\bin\cmake.exe -E cmake_progress_report D:\DengYC\TestDemos\SDK\SdkWindow\Build\CMakeFiles 1
[100%] Building CXX object CMakeFiles/SdkWindow.dir/WinMain.cpp.obj
    D:\DengYC\LoveDEV\bin\cl.exe @C:\Users\ADMINI~1\AppData\Local\Temp\nmCDAC.tmp
WinMain.cpp
Linking CXX executable SdkWindow.exe
    D:\DengYC\LoveDEV\bin\cmake.exe -E vs_link_exe D:\DengYC\LoveDEV\bin\cl.exe /nologo @CMakeFiles\SdkWindow.dir\objects1.rsp @C:\Users\ADMINI~1\AppData\Local\Temp\nmCF91.tmp
Visual Studio Incremental Link with embeded manifests
Create SdkWindow.exe.resource.txt
Create empty: SdkWindow.exe.embed.manifest
RC Pass 1:
D:/DengYC/LoveDEV/bin/RC.Exe /foSdkWindow.exe.embed.manifest.res SdkWindow.exe.resource.txt
LINK Pass 1:
D:\DengYC\LoveDEV\bin\cl.exe /nologo @CMakeFiles\SdkWindow.dir\objects1.rsp /DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 /FeSdkWindow.exe /FdD:\DengYC\TestDemos\SDK\SdkWindow\Build\SdkWindow.pdb -link /implib:SdkWindow.lib /version:0.0 /STACK:10000000 /machine:X86 /debug /INCREMENTAL /subsystem:windows kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:SdkWindow.exe.intermediate.manifest SdkWindow.exe.embed.manifest.res
MT:
D:/DengYC/LoveDEV/bin/mt.exe /nologo /out:SdkWindow.exe.embed.manifest /notify_update /manifest SdkWindow.exe.intermediate.manifest
RC Pass 2:
D:/DengYC/LoveDEV/bin/RC.Exe /foSdkWindow.exe.embed.manifest.res SdkWindow.exe.resource.txt
FINAL LINK:
D:\DengYC\LoveDEV\bin\cl.exe /nologo @CMakeFiles\SdkWindow.dir\objects1.rsp /DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 /FeSdkWindow.exe /FdD:\DengYC\TestDemos\SDK\SdkWindow\Build\SdkWindow.pdb -link /implib:SdkWindow.lib /version:0.0 /STACK:10000000 /machine:X86 /debug /INCREMENTAL /subsystem:windows kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:SdkWindow.exe.intermediate.manifest SdkWindow.exe.embed.manifest.res
    D:\DengYC\LoveDEV\bin\cmake.exe -E cmake_progress_report D:\DengYC\TestDemos\SDK\SdkWindow\Build\CMakeFiles 1
[100%] Built target SdkWindow
    D:\DengYC\LoveDEV\bin\cmake.exe -E cmake_progress_start D:\DengYC\TestDemos\SDK\SdkWindow\Build\CMakeFiles 0

**** Build Finished ****

---
And your can see that "/MANIFEST:NO" not work for MSVC.
My MSVC version:
---
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.

I search the whole web, but can not find a way to solved this issue.
So, If your find some time, please have a look.
Many thanks!!
TagsNo tags attached.
Attached Files

 Relationships
duplicate of 0010704closedDavid Cole don't GenerateManifest flag (/Manifest:NO) doesn't work with VS 2010 

  Notes
(0026121)
David Cole (manager)
2011-04-06 11:08

This has already been fixed in the nightly dev builds of CMake. You can wait for the forthcoming CMake 2.8.5 release (about a month to 6 weeks away) or you can use a nightly dev build of CMake until then.
(0026129)
Yuchen Deng (reporter)
2011-04-07 03:31

I am build master of c2f8a137152d9dc4cc08b156284f916561e1455c
But I found the issue still exist.
Here is the latest log.

---

**** Build of configuration Default for project TestGUI ****

cmd /C if not exist Build (mkdir Build && chdir Build && cmake -GNMake Makefiles .. && nmake verbose=1) else chdir Build && nmake all
-- The C compiler identification is MSVC
-- The CXX compiler identification is MSVC
-- Check for CL compiler version
-- Check for CL compiler version - 1600
-- Check if this is a free VC compiler
-- Check if this is a free VC compiler - no
-- Check for working C compiler: D:/DengYC/LoveDEV/bin/cl.exe
-- Check for working C compiler: D:/DengYC/LoveDEV/bin/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: D:/DengYC/LoveDEV/bin/cl.exe
-- Check for working CXX compiler: D:/DengYC/LoveDEV/bin/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: D:/DengYC/LoveDEV/share/Config/TestGUI/Build

Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.

    D:\DengYC\LoveDEV\bin\cmake.exe -HD:\DengYC\LoveDEV\share\Config\TestGUI -BD:\DengYC\LoveDEV\share\Config\TestGUI\Build --check-build-system CMakeFiles\Makefile.cmake 0
    D:\DengYC\LoveDEV\bin\cmake.exe -E cmake_progress_start D:\DengYC\LoveDEV\share\Config\TestGUI\Build\CMakeFiles D:\DengYC\LoveDEV\share\Config\TestGUI\Build\CMakeFiles\progress.marks
    D:\DengYC\LoveDEV\bin\nmake.exe -f CMakeFiles\Makefile2 /nologo - all
    D:\DengYC\LoveDEV\bin\nmake.exe -f CMakeFiles\TestGUI.dir\build.make /nologo -L CMakeFiles\TestGUI.dir\depend
    D:\DengYC\LoveDEV\bin\cmake.exe -E cmake_depends "NMake Makefiles" D:\DengYC\LoveDEV\share\Config\TestGUI D:\DengYC\LoveDEV\share\Config\TestGUI D:\DengYC\LoveDEV\share\Config\TestGUI\Build D:\DengYC\LoveDEV\share\Config\TestGUI\Build D:\DengYC\LoveDEV\share\Config\TestGUI\Build\CMakeFiles\TestGUI.dir\DependInfo.cmake --color=
Dependee "D:\DengYC\LoveDEV\share\Config\TestGUI\Build\CMakeFiles\TestGUI.dir\DependInfo.cmake" is newer than depender "D:/DengYC/LoveDEV/share/Config/TestGUI/Build/CMakeFiles/TestGUI.dir/depend.internal".
Dependee "D:/DengYC/LoveDEV/share/Config/TestGUI/Build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "D:/DengYC/LoveDEV/share/Config/TestGUI/Build/CMakeFiles/TestGUI.dir/depend.internal".
Scanning dependencies of target TestGUI
    D:\DengYC\LoveDEV\bin\nmake.exe -f CMakeFiles\TestGUI.dir\build.make /nologo -L CMakeFiles\TestGUI.dir\build
    D:\DengYC\LoveDEV\bin\cmake.exe -E cmake_progress_report D:\DengYC\LoveDEV\share\Config\TestGUI\Build\CMakeFiles 1
[100%] Building CXX object CMakeFiles/TestGUI.dir/WinMain.cpp.obj
    D:\DengYC\LoveDEV\bin\cl.exe @C:\Users\ADMINI~1\AppData\Local\Temp\nm8FA1.tmp
WinMain.cpp
Linking CXX executable TestGUI.exe
    D:\DengYC\LoveDEV\bin\cmake.exe -E vs_link_exe D:\DengYC\LoveDEV\bin\cl.exe /nologo @CMakeFiles\TestGUI.dir\objects1.rsp @C:\Users\ADMINI~1\AppData\Local\Temp\nm9138.tmp
Visual Studio Incremental Link with embeded manifests
Create TestGUI.exe.resource.txt
Create empty: TestGUI.exe.embed.manifest
RC Pass 1:
D:/DengYC/LoveDEV/bin/RC.Exe /foTestGUI.exe.embed.manifest.res TestGUI.exe.resource.txt
LINK Pass 1:
D:\DengYC\LoveDEV\bin\cl.exe /nologo @CMakeFiles\TestGUI.dir\objects1.rsp /DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 /FeTestGUI.exe /FdD:\DengYC\LoveDEV\share\Config\TestGUI\Build\TestGUI.pdb -link /implib:TestGUI.lib /version:0.0 /STACK:10000000 /machine:X86 /debug /INCREMENTAL /subsystem:windows kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:TestGUI.exe.intermediate.manifest TestGUI.exe.embed.manifest.res
MT:
D:/DengYC/LoveDEV/bin/mt.exe /nologo /out:TestGUI.exe.embed.manifest /notify_update /manifest TestGUI.exe.intermediate.manifest
RC Pass 2:
D:/DengYC/LoveDEV/bin/RC.Exe /foTestGUI.exe.embed.manifest.res TestGUI.exe.resource.txt
FINAL LINK:
D:\DengYC\LoveDEV\bin\cl.exe /nologo @CMakeFiles\TestGUI.dir\objects1.rsp /DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 /FeTestGUI.exe /FdD:\DengYC\LoveDEV\share\Config\TestGUI\Build\TestGUI.pdb -link /implib:TestGUI.lib /version:0.0 /STACK:10000000 /machine:X86 /debug /INCREMENTAL /subsystem:windows kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:TestGUI.exe.intermediate.manifest TestGUI.exe.embed.manifest.res
    D:\DengYC\LoveDEV\bin\cmake.exe -E cmake_progress_report D:\DengYC\LoveDEV\share\Config\TestGUI\Build\CMakeFiles 1
[100%] Built target TestGUI
    D:\DengYC\LoveDEV\bin\cmake.exe -E cmake_progress_start D:\DengYC\LoveDEV\share\Config\TestGUI\Build\CMakeFiles 0

**** Build Finished ****

---

See the final link command:
---
FINAL LINK:
D:\DengYC\LoveDEV\bin\cl.exe /nologo @CMakeFiles\TestGUI.dir\objects1.rsp /DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 /FeTestGUI.exe /FdD:\DengYC\LoveDEV\share\Config\TestGUI\Build\TestGUI.pdb -link /implib:TestGUI.lib /version:0.0 /STACK:10000000 /machine:X86 /debug /INCREMENTAL /subsystem:windows kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:TestGUI.exe.intermediate.manifest TestGUI.exe.embed.manifest.res
---
/MANIFEST:NO still won't work.
(0026130)
Yuchen Deng (reporter)
2011-04-07 03:33

Here is WinMain.cpp content.
---
#include <Windows.h>
#include <tchar.h>

LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg)
    {
    case WM_CREATE:
        return 0;

    case WM_DESTROY:
        PostQuitMessage(0);
        return 0;
    }

    return DefWindowProc(hWnd, uMsg, wParam, lParam);
}

int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE, PTSTR /*pszCmdLine*/, int /*nCmdShow*/)
{
    WNDCLASSEX wcex;
    wcex.cbSize = sizeof(WNDCLASSEX);
    wcex.style = CS_HREDRAW | CS_VREDRAW;
    wcex.lpfnWndProc = WndProc;
    wcex.cbClsExtra = 0;
    wcex.cbWndExtra = 0;
    wcex.hInstance = hInstance;
    wcex.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
    wcex.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
    wcex.lpszMenuName = NULL;
    wcex.lpszClassName = _T("Windows Demo Class");
    wcex.hIconSm = wcex.hIcon;

    if (!RegisterClassEx(&wcex))
    {
        MessageBox(NULL, _T("RegisterClassEx failed!"), _T("Windows Demo"), MB_ICONERROR);
        return 0;
    }

    HWND hWnd = CreateWindowEx(WS_EX_APPWINDOW,
                               _T("Windows Demo Class"),
                               _T("Windows Demo"),
                               WS_OVERLAPPEDWINDOW,
                               CW_USEDEFAULT,
                               CW_USEDEFAULT,
                               CW_USEDEFAULT,
                               CW_USEDEFAULT,
                               NULL,
                               NULL,
                               hInstance,
                               NULL);

    ShowWindow(hWnd, SW_SHOW);
    UpdateWindow(hWnd);

    MSG msg;
    for (int n = GetMessage(&msg, NULL, 0, 0); n && n != -1; n = GetMessage(&msg, NULL, 0, 0))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    return msg.wParam;
}
---
(0026137)
David Cole (manager)
2011-04-07 11:32
edited on: 2011-04-07 11:33

Sorry for the false resolution as duplicate... I didn't read your report closely enough.

It's still not a CMake bug, though.

This line:
set(CMAKE_LINK_FLAGS "${CMAKE_LINK_FLAGS} /MANIFEST:NO /OPT:REF /OPT:ICF")

Sets a variable that CMake does not know about. CMAKE_LINK_FLAGS does not exist.

You should use one of the following instead:

Variables:
  http://cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_EXE_LINKER_FLAGS [^]
  (or CMAKE_SHARED_LINKER_FLAGS for shared libraries, or CMAKE_MODULE_LINKER_FLAGS for modules)

Target property:
  http://cmake.org/cmake/help/cmake-2-8-docs.html#prop_tgt:LINK_FLAGS [^]

I will close this as "no change required" since you should be able to set "/MANIFEST:NO" with the "NMake Makefiles" generator as long as you use the appropriate CMake variable or property.

(0026147)
Yuchen Deng (reporter)
2011-04-07 23:49

Sorry, I am read the documents not careful enough.
The issue is invalid.
Many thanks!!
(0027023)
David Cole (manager)
2011-07-08 17:58

see previous notes...
(0028099)
David Cole (manager)
2012-01-02 15:56

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2011-04-06 09:22 Yuchen Deng New Issue
2011-04-06 11:08 David Cole Note Added: 0026121
2011-04-06 11:08 David Cole Relationship added duplicate of 0010704
2011-04-06 11:08 David Cole Status new => resolved
2011-04-06 11:08 David Cole Fixed in Version => CMake 2.8.5
2011-04-06 11:08 David Cole Resolution open => duplicate
2011-04-06 11:08 David Cole Assigned To => David Cole
2011-04-07 03:31 Yuchen Deng Note Added: 0026129
2011-04-07 03:31 Yuchen Deng Status resolved => feedback
2011-04-07 03:31 Yuchen Deng Resolution duplicate => reopened
2011-04-07 03:33 Yuchen Deng Note Added: 0026130
2011-04-07 03:33 Yuchen Deng Status feedback => assigned
2011-04-07 11:32 David Cole Note Added: 0026137
2011-04-07 11:33 David Cole Note Edited: 0026137
2011-04-07 23:49 Yuchen Deng Note Added: 0026147
2011-07-08 17:58 David Cole Target Version => CMake 2.8.5
2011-07-08 17:58 David Cole Note Added: 0027023
2011-07-08 17:58 David Cole Status assigned => resolved
2011-07-08 17:58 David Cole Resolution reopened => no change required
2012-01-02 15:56 David Cole Note Added: 0028099
2012-01-02 15:56 David Cole Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team