[CMake] "simple test program" does not consider LINK_DIRECTORIES

Brandon J. Van Every bvanevery at gmail.com
Wed Aug 9 21:14:06 EDT 2006


William A. Hoffman wrote:
> At 05:40 AM 7/26/2006, che-ranking at arcor.de wrote:
>   
>> Hi everyone,
>>
>> I want to build a Project on windows. This poject uses CMAKE when built on windows (it uses another system on unix/linux systems). I cannot build the project with CMAKE cause it fails to build a "simple test program". The reason for that is that the Linker can't find 'user32.lib'. In my case this file is located in a directory different than MSVC++ because I am using the free MSVC++ Express Edition (so user32.lib is in the directory of the MS Platform SDK). So I thought "No problem, just use LINK_DIRECTORIES to add the SDK directory to the search path for libraries". But this doesn't work. The "simple test program", which seems to be needed by the PROJECT command, is still linked without the SDK directories.
>>
>> Does anyone have a clue how to fix that?
>>     
>
> You have not installed the Express Edition correctly.  Please look at the installation instructions
> for MS SDK and MSVC Express.
>   

This problem is not unique to Express Edition.  I recently removed my 
Platform SDK and VS .NET 2003 installations, then reinstalled VS .NET 
2003.  So, VS .NET 2003 is the only source of files on my system, there 
is no Platform SDK to interfere with anything.  CMake dies on even a 
trivial CMakeLists.txt, says it can't find user32.lib.  It and similar 
files are canonically installed in C:\Program Files\Microsoft Visual 
Studio .NET 2003\Vc7\PlatformSDK\Lib .

So whose fault is this, CMake's or VS .NET 2003's?  Looking at Options 
--> Projects --> VC++ Directories --> Library Files, I see only:
$(VCInstallDir)lib
$(VCInstallDir)atlmfc\lib
$(FrameworkSDKDir)lib

The problem goes away when I add:
$(VCInstallDir)PlatformSDK\lib

Now, regardless of fault, what should CMake be doing?  Since it relies 
on user32.lib to perform even the most trivial of operations in 
CMakeLists.txt, and I didn't put "user32.lib" anywhere in my 
CMakeList.txt, and there are no installation instructions for VS .NET 
2003 that I was a bad boy about not reading... I say that CMake should 
make more effort to find out about the library directories.  Or, it 
should give an error telling the user what to do to fix the problem in 
VS, rather than a screenful of gobbledygoo.  The effect of the latter is 
to make CMake look quite broken and unreliable.

The bad appearance probably doesn't happen so much in practice with VS 
.NET 2003, because people typically install a Platform SDK somewhere 
along the way, for whatever reason they need it.  The PSDK provides 
pathnames and a user32.lib and configures VS appropriately.  The bad 
appearance is going to happen anytime someone just installs a compiler 
and then just tries to use it right away, sans PSDK.  True of people 
trying out Express Edition, and also true of multi-compiler Windows 
developers trying to keep their MinGW, MSVC, and Cygwin installations 
separate.


Cheers,
Brandon Van Every

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20060809/63d925ec/attachment.html


More information about the CMake mailing list