[CMake] how work dependencies
klaas.holwerda
ngi at klaasholwerda.nl
Mon Feb 19 12:07:51 EST 2007
Hi Bill,
Working on the test case you asked for, i discovered the problem.
Using SET_TARGET_PROPERTIES() i changed the name of the libraries.
But also is use TARGET_LINK_LIBRARIES using that real name.
I should have used the original target name it seems.
Using the real name, dependencies are not discovered, but using the
original target used in ADD_LIBRARY() all is fine.
You might say of course.
But what i did, was put all libraries in a variable, to be used in a
template for external user programs to use my libraries in an easy manner.
So there one needs the real names of the libraries. While in the samples
coming with the libraries one prefers the target names itself, since
only then Cmake finds the dependencies.
Still it is a bit strange, because using real names, Cmake did not
understand to relink a sample, when a library was rebuild.
So it knows:
- that it links to a library since the real name is in the links list in
the VC IDE.
- but when that library is out of date, it does not see that, and does
not relink.
Anyway, i now use target names internal for the samples, and create a
variable using real names for external programs.
Thanks!
Klaas
Bill Hoffman wrote:
> klaas.holwerda wrote:
>> Hi,
>>
>> I always thought that Cmake did automatically rebuild libraries,
>> within the same Cmake build, linked to my application.
>> Like if i have several libraries created with ADD_LIBRARY() and
>> linked to my end executable with TARGET_LINK_LIBARIES or just
>> LINK_LIBRARIES.
>> But it seems i am missing something, since it stopped working for me,
>> and i don't know which change did that.
>> Maybe it is SET_TARGET_PROPERTIES() which i use to set output names
>> for libraries, different from the ones in ADD_LIBRARY its target.
>> So the end executable target, is linked with the endname from the
>> properties, not with the original target name of ADD_LIBRARY.
>>
>> SO the question is, do i need to use:
>>
>> ADD_DEPENDCIES explicit, to make target like the above depend on the
>> other lower targets?
>>
>> Or should this be automatic ( which it was for me before ), and is
>> something else wrong?
> It should be working. The best thing to try is make VERBOSE=1 and
> look at the output.
> Can you create a small test case?
>
> -Bill
>
>
More information about the CMake
mailing list