[CMake] IMPORTED_LOCATION

Micha Renner Micha.Renner at t-online.de
Mon Dec 1 09:07:41 EST 2008


Am Montag, den 01.12.2008, 08:09 -0500 schrieb Bill Hoffman:
> Micha Renner wrote:
> > Hello, 
> > 
> > I have two questions for the listening below.
> > 
> > 1. Out-commenting the line #4
> > results in a linker error LINK : fatal error LNK1104: File
> > "_sLib-NOTFOUND.obj" can't be opened"
> > 
> > What is the purpose of this command (line #4)?
> > 
> The imported targets are new.  Looks like a small glitch...

This doesn't answer my question. 
Why is it helpful to know the location of the Windows-DLL during the
build-process? 
I'm not an expert, but for me it makes only sense, if I want to use a
DLL, which is not located in an execution-directory of the OS. 
This would a nice feature.

> 
> Here are the docs:
> http://www.cmake.org/cmake/help/cmake2.6docs.html#prop_tgt:IMPORTED_LOCATION
> http://www.cmake.org/cmake/help/cmake2.6docs.html#prop_tgt:IMPORTED_IMPLIB

No, without http://www.cmake.org/Wiki/CMake_2.6_Notes
you are helpless.

> 
> Looks like IMPORTED_LOCATION should be ignored if IMPORTED_IMPLIB is found.

That is not the case, okay. 

> 
> > 2. If line #4 is active. An inspection of the project properties (link
> > -> command line) shows in the implib-section the following result:
> > /IMPLIB:"C:\WORK-C\ArchiveCMake\CMakeListsNeu\BuildDLL-2\TestDLL\CMake
> > \Debug\TestDll2.lib" /ERRORREPORT:PROMPT kernel32.lib user32.lib
> > gdi32.lib winspool.lib shell32.lib ole32.lib 
> > oleaut32.lib uuid.lib comdlg32.lib advapi32.lib  
> > \WORK-C\ArchiveCMake\CMakeListsNeu\BuildDLL-2\DLL\CMake\Debug\SLib.lib
> > 
> > For what reason is there a TestDll2.lib?
> 
> You can export symbols from an executable on windows.  So, CMake will 
> create the import library file.

Who needs this?

Anyway, thanks for help.

Michael


> 
> 
> > 
> > Michael
> > 
> > Start of listening ----------------------------------------------------
> > 
> > 1:PROJECT(TestDLL)
> > 
> > 2:CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
> >  
> > 3:ADD_LIBRARY(_sLib SHARED IMPORTED)
> > 4:SET_PROPERTY(TARGET _sLib PROPERTY IMPORTED_LOCATION /Path/SLib.dll) 
> > 5:SET_PROPERTY(TARGET _sLib PROPERTY IMPORTED_IMPLIB /Path/SLib.lib)
> > 
> > 6:INCLUDE_DIRECTORIES(/myIncludeDir)
> > 
> > 7:SET(_src MRTestC.c)  
> > 8:ADD_EXECUTABLE(TestDll2 ${_src})
> > 9:TARGET_LINK_LIBRARIES(TestDll2 _sLib)
> > 



More information about the CMake mailing list