[CMake] Win DLL with rc-file...

Lars Pechan lars.pechan at parkerpechan.com
Sun Oct 31 20:41:39 EST 2004


Hi there,
I have by a complete stroke of luck got this to work, at least with the 
NMake Makefiles generator. VS.NET2003 refuses to open the generated 
vcproj file.

So effectively we have

ADD_LIBRARY(kp1bmp kpres.rc kpmain.c)

(In reality there are a number of steps preceding this in order to 
generate kpres.rc).

This did not link in, or generate, kpres.res. In fact the generated 
Makefile contains no info whatsoever about the rc/res files.

I then thought I'd try by renaming the rc-file to the same base name as 
the target, ie kpres.rc became kp1bmp.rc. Luckily, I did this by 
copying the  generated rc-file rather than changing the name in the 
CMakeLists.txt file. I then touched CMakeLists.txt in order to 
regenerate the Makefile. Bugger me if it didn't work! There it was, the 
generated dll is of the right size and the Makefile finally contains 
the reference to the res-file.

Alright, I thought, perhaps the resource file must share the base name 
with the target. I swiftly modified the generation of the resource file 
so it has the 'right' name. Re-ran cmake and we're back to square one. 
No reference to the res-file in the Makefile.

I did various tests here with modifying paths etc but got nowhere.

I then reverted the base name change, changed the ADD_LIBRARY-line to

ADD_LIBRARY(kp1bmp kp1bmp.rc kpmain.c)

and added a custom command to duplicate the original resource file and 
name it kp1bmp.rc.

For some reason this does work and everything is fine...

I don't know what to make of this, I would like to invest it further 
but I really don't have that much time right now.

/Lars

On 27/10/2004, at 8:32 AM, William A. Hoffman wrote:

> Actually, rc files work fine with nmake and have for some time.  
> Please try and
> make a smaller test case that shows the real problem here before 
> reporting a bug.
>
> -Bill
>
>
> At 03:11 PM 10/26/2004, Brad King wrote:
>> Lars Pechan wrote:
>>> On 27/10/2004, at 1:51 AM, Brad King wrote:
>>>> What generator are you using?  This is the value of CMAKE_GENERATOR 
>>>> in the CMakeCache.txt file.
>>> NMake Makefiles.
>>
>> Okay, it looks like the .rc file support is only working in Visual 
>> Studio generators because CMake adds them to the .dsp file and VS 
>> knows how to handle them.  CMake is not really aware of this file 
>> type as far as I can see.  Please add this as a feature request for 
>> the NMake generator in the bug tracker:
>>
>> http://www.cmake.org/Bug
>>
>> Thanks,
>> -Brad
>> _______________________________________________
>> CMake mailing list
>> CMake at www.cmake.org
>> http://www.cmake.org/mailman/listinfo/cmake
>



More information about the CMake mailing list