[CMake] Dependency question

David Cole david.cole at kitware.com
Fri Oct 28 14:13:48 EDT 2011


On Fri, Oct 28, 2011 at 1:52 PM, Robert Dailey <rcdailey at gmail.com> wrote:
> I tested this and it works! I was using target_link_libraries() before which
> sets the dependency but also links it.
> I noticed that it creates a "fubar_UTILITY" project in addition to "fubar"
> project in my solution when I specify it in add_dependencies()... is this
> normal? What does the _UTILITY project do?
>

Yes, it's normal. The _UTILITY project is there just to establish
dependencies correctly in VS 7.1 and earlier. Starting with VS8 the
_UTILITY targets are no longer generated.


> ---------
> Robert Dailey
>
>
> On Fri, Oct 28, 2011 at 12:32 PM, Robert Dailey <rcdailey at gmail.com> wrote:
>>
>> On Fri, Oct 28, 2011 at 12:25 PM, David Cole <david.cole at kitware.com>
>> wrote:
>>>
>>> On Fri, Oct 28, 2011 at 1:06 PM, Robert Dailey <rcdailey at gmail.com>
>>> wrote:
>>> > I'm using CMake 2.8.6 and generating for VS 2003.
>>> > I have a DLL project that my EXE project needs to depend on, however I
>>> > don't
>>> > want my EXE to link against that DLL's import library, since the EXE
>>> > will
>>> > call LoadLibrary() to dynamically import symbols from the DLL being
>>> > built.
>>> > I want the EXE project to depend on the DLL project so that in visual
>>> > studio
>>> > the DLL is built when I build the EXE (because of project
>>> > dependencies), but
>>> > I don't want the DLL 's import LIB to be linked in via command line.
>>> > Any way to do this?
>>> >
>>> > ---------
>>> > Robert Dailey
>>> >
>>> > --
>>> >
>>> > Powered by www.kitware.com
>>> >
>>> > Visit other Kitware open-source projects at
>>> > http://www.kitware.com/opensource/opensource.html
>>> >
>>> > Please keep messages on-topic and check the CMake FAQ at:
>>> > http://www.cmake.org/Wiki/CMake_FAQ
>>> >
>>> > Follow this link to subscribe/unsubscribe:
>>> > http://www.cmake.org/mailman/listinfo/cmake
>>> >
>>>
>>> add_dependencies(exe dll)
>>>
>>> But use the CMake target names, not "exe" and "dll"...
>>>
>>> That makes sure that the project build for "dll" is completely done
>>> before beginning any build commands for the "exe" project.
>>
>> Correct me if I'm wrong but doesn't this still cause the LIB to be linked?
>> There is an option to inherit dependency libraries in project settings which
>> is enabled, so CMake would somehow need to specify this import library to be
>> ignored.
>


More information about the CMake mailing list