Markus Israelsson wrote: > Of course I forgot to add. > > None of the libraries are static. They are all SHARED. That is why it > confuses me. I have always used visual studio dependencies to build them > in a certain order. Also the dependency in visual studio means that > library A that uses features of library B which it depends on can find > the symbols in library B (find and link with the lib) without having to > state explicitly in the link libraries properties that it should. This > is true for all versions of microsoft visual studio that I have ever > worked with (vc7, vc8 and vc9). > > I guess that this is not what CMake mean with ADD_DEPENDENCIES.
ADD_DEPENDENCIES is just to add dependencies, not for linking. Implementing this on VS results in the intermediate _Util projects to prevent linking. You should use TARGET_LINK_LIBRARIES for linking: TARGET_LINK_LIBRARIES( FirstProject SecondProject ) -Brad > -----Original Message----- > From: Bill Hoffman [mailto:[EMAIL PROTECTED] > Sent: den 9 maj 2008 14:39 > To: Markus Israelsson > Cc: cmake@cmake.org > Subject: Re: [CMake] Cmake 2.6.0 release and _Util project on Visual > studio 2003 > > Markus Israelsson wrote: >> Hello, >> >> I am wondering if anyone can shed some light on where the >> <ProjectName>_Util projects come from and why they are constructed for > >> visual studio 2003 when using the ADD_DEPENDENCIES property of CMake. >> They do not show up when generating project for other versions of >> visual studio and do not show up when using version 2.4.8 of CMake. >> >> What I have done is basically this (pseudo-code, hope it is > understandable): >> >> PROJECT( FirstProject ) >> >> ADD_SUBDIRECTORY( SecondProject ) - adds a library called > SecondProject. >> ADD_LIBRARY( FirstProject ) >> >> ADD_DEPENDENCIES( FirstProject SecondProject ) >> >> This will create a solution file with these project in visual studio >> 2005 and 2008. >> >> ALL_BUILD >> FirstProject >> SecondProject >> ZERO_CHECK >> >> FirstProject depends on SecondProject when checking dependency setting > >> in visual studio. >> >> However for visual studio 2003 the solution file will look like this. >> >> ALL_BUILD >> FirstProject >> SecondProject >> SecondProject_UTIL >> ZERO_CHECK >> >> FirstProject will depend on SecondProject_UTIL which depends on >> SecondProject. This will of course give a lot of linking errors when >> building. Firstly because the _UTIL project is empty, neither >> Pre-Build Events nor Post-Build Events are set. Secondly because the >> _UTIL project is never built by default. >> >> In order to fix this I have to manually correct the dependencies for >> visual studio 2003. Pretty irritating since when anything is changed >> in the CMakeLists used for generating the solution file the >> dependencies has to be fixed again. >> >> Every project that some other project is dependent on generates this >> extra _UTIL project. >> >> Hope anyone can shed some light on the use of this or have encountered > >> the problem. >> >> best regards, appreciate any help, >> Markus > > HMMM.... > > This was done to avoid something you seem to have been depending on. If > you depend on a project directly with static libraries vs 2003 creates a > combined library. So, in your case FirstProject would have all the > objects of FirstProject and SecondProject in it. This does not happen > on any other platform. The only thing the add_dependencies is supposed > to do is make sure that FirstProject is BUILT before SecondProject. It > is not supposed to combine them. This was a bug in earlier versions of > CMake. Also, for VS 2008 this does not happen. However, if this is a > full CMake project then it should not be a problem since anything that > links to FirstProject will automatically link to SecondProject. > > -Bill > _______________________________________________ > CMake mailing list > CMake@cmake.org > http://www.cmake.org/mailman/listinfo/cmake _______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake