[CMake] Project being (unnecessarily) relinked

Jesper Eskilson jesper at eskilson.se
Wed Sep 12 02:51:48 EDT 2007


Mike Jackson wrote:
> 
> 
> On Sep 11, 2007, at 3:03 AM, Jesper Eskilson wrote:
> 
>>> A related question: if I include an external project in my solution
>>> using
>>>
>>> include_external_msproject(Bar ../../Bar/Bar.vcproj)
>>>
>>> can I later refer to this project using
>>>
>>> target_link_libraries(Foo Bar)
>>>
>>> More generally, what is the correct way to specify that a CMake
>>> target should be linked with some external library?
>>
>> It is this last question I would like to get an answer to.
> 
> 
> Say you have  another project that produces a library called libBar.dll 
> and that library is located in C:\Libs then you can refer to that 
> library in CMake directly. In other words, the cmake code you have is 
> absolutely correct:
> 
> Target_link_Libraries(Foo Bar)
> 
> with the following caveat: libBar.dll MUST be in a known directory that 
> the linker will look in. You can make sure of this by adding the 
> following cmake code above the "target_link_libraries" code:
> 
>  LINK_DIRECTORIES ("C:\Libs")

Ah. So if libBar.dll and libBar.lib are in different directories, *both* 
directories must be added using LINK_DIRECTORIES(), right?

That should be documented somewhere (if it is, I've managed to miss it).

-- 
/Jesper



More information about the CMake mailing list