[CMake] Cmake 2.2.2 with Visual Studio 6. Bug?

Alexander Neundorf a.neundorf-work at gmx.net
Thu Nov 24 06:26:52 EST 2005


> Von: Daniel Tourde <ted at foi.se> 
>  
> Hello, 
>  
> I am working in an environment where Linux and Windows are trying to  
> collaborate peacefully. 
> We are willing to develop a C++ library that could be easily built and 
> used under Linux and Windows 2000/XP. 
>  
> We have access to 2 development environments: 
> - Kdevelop 3.2.1 (KDE 3.4.1, Gentoo Linux) 
> - M$ Visual Studio 6 
> We decided to use cmake, considering the flexibility it offers in terms 
> of management of Makefiles and other 'niceties' of this kind. 
> Kdevelop 3.2.1 requires cmake 2.2. To test the concepts, I use the 
> basic C++ library template using cmake present in KDevelop (a basic 
> 'hello world!' library based program). I can send the code if required. 
> Then I transfer the files to Windows, use CMakeSetup 2.2.2 to convert 
> the CMakeList.txt files there and try to open the project under VS6 to 
> compile it. This is where the problems start... 
>  
> Here is what I get: 
> - No problems to open the project 
> - However, when I compile it I get the following: 
>   Command line error D2021: invalid numeric argument '/Wall' 
>   Error executing cl.exe 
> When I remove Wall from the CMakeList.txt file, I get other problems of 
> the same type. It seems that somehow, Unix GCC flags are still present, 
> haunting VS6... 
>  
> So, have I done anything wrong? 
> Is it a Cmake 2.2.2 bug? 
> Isn't VS6 supported anymore? 
> Is it a bug of VS6? 
 
It's a problem of the CMakeLists.txt coming with the kdevelop template 
project. You have to correct the CMakeLists.txt. 
It contains a line like the following: 
 
#add definitions, compiler switches, etc.    
ADD_DEFINITIONS(-Wall -O2) 
 
This has to be made conditionally, e.g. as a simple test: 
 
IF (WIN32) 
   ADD_DEFINITIONS( ...whatever you want... ) 
ELSE (WIN32) # not windows, but e.g. linux 
   ADD_DEFINITIONS(-Wall -O2) 
ENDIF (WIN32) 
 
I'll fix the templates in kdevelop, but this won't get release before KDE 
3.5.1. 
 
Bye 
Alex 
 

-- 
Telefonieren Sie schon oder sparen Sie noch?
NEU: GMX Phone_Flat http://www.gmx.net/de/go/telefonie


More information about the CMake mailing list