[CMake] Visual Studio problem with many/long additional library paths

Kristian Nielsen knielsen at mysql.com
Tue Apr 18 10:33:08 EDT 2006


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.com-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\,e:\pb\mysql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-standard\storage\myisammrg\$(OutDir),e:\pb\mysql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-standard\storage\myisammrg\,e:\pb\mysql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-standard\mysys\$(OutDir),e:\pb\mysql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-standard\mysys\,e:\pb\mysql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql!
 -5.1.10-beta-standard\extra\yassl\$(OutDir),e:\pb\mysql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-standard\extra\yassl\,e:\pb\mysql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-standard\zlib\$(OutDir),e:\pb\mysql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-standard\zlib\,e:\pb\mysql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-standard\dbug\$(OutDir),e:\pb\mysql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-standard\dbug\,e:\pb\mysql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-standard\extra\yassl\taocrypt\$(OutDir),e:\pb\mysql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-standard\extra\yassl\taocrypt\,e:\pb\mysql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-standard\strings\$(OutDir),e:\pb\mysql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-standard\strings\,e:\pb\my!
 sql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-bet
a-standard\vio\$(OutDir),e:\pb\mysql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-standard\vio\,e:\pb\mysql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-standard\regex\$(OutDir),e:\pb\mysql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-standard\regex\,e:\pb\mysql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-standard\storage\archive\$(OutDir),e:\pb\mysql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-standard\storage\archive\,e:\pb\mysql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-standard\storage\example\$(OutDir),e:\pb\mysql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-standard\storage\example\,e:\pb\mysql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-standard\storage\innobase\$(OutDir),e:\pb\mysql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-standard\storage\innobase\,e:\p!
 b\mysql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-standard\storage\bdb\$(OutDir),e:\pb\mysql-5.1-new\push-elliot at mysql.com-20060418063351.info\mysql-5.1.10-beta-standard\storage\bdb\"

This is generated by

    cmake -G "Visual Studio 7 .NET 2003"

This looks fine, but unfortunately it seems to break some limit in Visual
Studio version 7.1. There is no error message when loading the project file,
but the paths do not work and libraries can not be found.

The limit seems to be a bit more than 2000 characters. If I shorten the path
to less than that, the build work.

Googling turned up nothing. While this does seem to be a bug / misfeature in
Visual Studio, I wondered if anyone has experienced this problem, and perhaps
know of a workaround? Since CMake uses hardcoded paths, this problem is all
the more likely to hit in CMake-generated projects. I wonder if there is
another way to write the .vcproj files that avoid this limitation...

 - Kristian.

-- 
Kristian Nielsen, Software Developer
MySQL AB, Hvidovre, Denmark, www.mysql.com
Are you MySQL certified?  www.mysql.com/certification



More information about the CMake mailing list