[CMake] Visual Studio problem with many/long additional library paths
Karr, David A (Titan) at TITAN
david.karr at L-3Com.com
Thu Apr 20 13:33:26 EDT 2006
> From: Kristian Nielsen <knielsen at mysql.com>
>
> A cmakelists.txt file of mine contains the following:
>
> ADD_EXECUTABLE(mysqld ../sql-common/client.c ...)
> TARGET_LINK_LIBRARIES(mysqld heap myisam myisammrg mysys yassl zlib
dbug
> yassl
> taocrypt strings vio regex wsock32)
> TARGET_LINK_LIBRARIES(mysqld archive)
> TARGET_LINK_LIBRARIES(mysqld example)
> TARGET_LINK_LIBRARIES(mysqld innobase)
> TARGET_LINK_LIBRARIES(mysqld bdb)
>
> This generates the following long line in mysqld.vcproj:
>
>
AdditionalLibraryDirectories="e:\pb\mysql-
> 5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-
>
standard\storage\heap\$(OutDir),e:\pb\mysql-5.1-new\push-elliot at mysql.co
m-
>
20060418063351.info\mysql-5.1.10-beta-standard\storage\heap\,e:\pb\mysql
-
> 5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-
> standard\storage\myisam\$(OutDir),e:\pb\mysql-5.1-new\push-
> elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-
> standard\storage\myisam\,[remainder of very long string deleted]
I have not yet encountered the line length limit in Visual Studio, but I
have found the length of the directory list makes it hard sometimes to
debug problems with missing/wrong libraries in the path. I have noticed
that for every library you name in a TARGET_LINK_LIBRARIES command, two
directory names are generated: one of them ends with the name of the
library, for example "...\myisam\", and the other ends with OutDir, for
example "...\myisam\$(OutDir)". In my own projects, as far as I can
tell, the OutDir directories never exist, so listing them effectively
more than doubles the length of the list without adding any benefit.
It would be helpful (at least in my case) to be able to turn off the
production of the "OutDir" directories in this list, I just haven't
gotten around to figuring out how. Is there a simple way to control
this?
If you actually do find the desired library in $(OutDir) then I have a
hunch it was a waste of time looking in the directory that didn't end in
$(OutDir), so again if you can control it so you just get the directory
you wanted instead of both, that also would reduce the length of this
long string by nearly half.
My own lists of libraries tend to be bloated by the repetition of some
directories (i.e. the exact same directory at different points in the
string), but I think this has something to do with the fact that I am
naming libraries in TARGET_LINK_LIBRARIES that are themselves built by
CMake and they have their own TARGET_LINK_LIBRARIES commands. Sometimes
a project depends on libraries X and Y where X also depends on Y, and I
think this makes Y show up twice. But that seems like a harder problem
to solve, and I don't really expect there to be a fix for it.
David Karr
More information about the CMake
mailing list