View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0009586CMakeCMakepublic2009-09-23 07:212009-09-25 15:48
ReporterShirokov Anatoly 
Assigned ToBrad King 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake-2-6 
Target VersionFixed in Version 
Summary0009586: Visual Studio 6 + add_executable + WIN32 + ENABLE_EXPORTS ON issue
DescriptionVisual Studio 6 + add_executable + WIN32 + ENABLE_EXPORTS ON does not produce import library
Additional InformationI have the simple project

project(APP)
add_executable(app WIN32 app.cpp)
ADD_DEFINITIONS(-DAPP_EXPORT)
set_target_properties(app
    PROPERTIES
    ENABLE_EXPORTS ON
        RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}
)

CMake does not include the /implib link option to the result APP.DSP file. As a result libraries using APP are not linked.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0017744)
Brad King (manager)
2009-09-25 12:18

CMake's test suite has a "Plugin" test that does exactly this, and it passes on VS 6.

Does your app.cpp contain any __declspec(dllexport) markup to actually export symbols? If not then no .lib will be produced.
(0017746)
Shirokov Anatoly (reporter)
2009-09-25 15:27

Here is app.cpp:

#include <windows.h>

void __declspec(dllexport) dummy()
{

}

int WINAPI WinMain(
  HINSTANCE hInstance, // handle to current instance
  HINSTANCE hPrevInstance, // handle to previous instance
  LPSTR lpCmdLine, // pointer to command line
  int nCmdShow // show state of window
)
{
     return 1;
}

The result app.dsp file contains the following link flags:
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 /IGNORE:4089
# ADD LINK32 /nologo /subsystem:windows /machine:I386 /IGNORE:4089
# ADD LINK32 /out:"C:\Work\cmake\appimplib\build\Release\app.exe"
# ADD LINK32 /STACK:10000000 /machine:I386 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

As you see there is no the /implib link option.

From other side, if I change type of the application to console:
app.cpp:
int main() {return 1;}
void __declspec(dllexport) dummy()
{
}
CMakeLists.txt:
project(APP)
add_executable(app app.cpp)
set_target_properties(app
    PROPERTIES
    ENABLE_EXPORTS ON
        RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}
)

The link options are changed:
# ADD BASE LINK32 /nologo /subsystem:console /machine:I386 /IGNORE:4089
# ADD LINK32 /nologo /subsystem:console /machine:I386 /IGNORE:4089 /version:0.0
# ADD LINK32 /out:"C:\Work\cmake\appimplib\build\Release\app.exe" /implib:C:\Work\cmake\appimplib\build\Release\app.lib
# ADD LINK32 /STACK:10000000 /machine:I386 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

Any comments?
(0017749)
Brad King (manager)
2009-09-25 15:47

Ah, the Plugin test does not do a GUI application.
When this feature was added, the VS 6 project file template for console executables (EXEHeader.dsptemplate) was updated but not the one for windows executables (EXEWinHeader.dsptemplate). I've committed a fix:

Fix Windows GUI implib and image version in VS 6
/cvsroot/CMake/CMake/Templates/EXEWinHeader.dsptemplate,v <-- Templates/EXEWinHeader.dsptemplate
new revision: 1.25; previous revision: 1.24

 Issue History
Date Modified Username Field Change
2009-09-23 07:21 Shirokov Anatoly New Issue
2009-09-25 11:53 Bill Hoffman Status new => assigned
2009-09-25 11:53 Bill Hoffman Assigned To => Brad King
2009-09-25 12:18 Brad King Note Added: 0017744
2009-09-25 15:27 Shirokov Anatoly Note Added: 0017746
2009-09-25 15:47 Brad King Note Added: 0017749
2009-09-25 15:48 Brad King Status assigned => closed
2009-09-25 15:48 Brad King Resolution open => fixed


Copyright © 2000 - 2018 MantisBT Team