PDA

View Full Version : [SOLVED] Error "/W needs an argument" when compiling under Win a Linux cmake project



kleag
20th November 2011, 12:41
At work we developed a project under Linux with the cmake build tool and gcc. This project does not use Qt, but I wanted to use Qtcreator as IDE when trying to port the project to Windows.

When trying to compile after solving the dependencis issues, I got



Microsoft (R) Program Maintenance Utility Version 9.00.21022.08
Copyright (C) Microsoft Corporation. Tous droits réservés.

[ 2%] Building CXX object src/common/Data/CMakeFiles/commondata.dir/DataTypes.cpp.obj
clÿ: Ligne de commande error D8004ÿ: '/W' n‚cessite un argument
NMAKE : fatal error U1077: 'C:\PROGRA~1\MICROS~2.0\VC\bin\cl.exe' : code retour '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\nmake.exe"' : code retour '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\nmake.exe"' : code retour '0x2'
Stop.
Le processus "C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\nmake.exe" s'est terminé avec le code 2.
Erreur à la compilation du projet mmcommon (cible : Desktop)
Lors de l'exécution de l'étape "Make"


I searched a lot a lot a lot with no luck. Finall, I found that we forced to use the "-W" switch under Linux to force gcc warning. It was considered also as a switch under Windows by error (while it was -W and not /W).

The bad content of the CMakeLists.txt was:


set(CMAKE_CXX_FLAGS "-W -Wall")

Hope this can help future people having to port cmake based projects to windows...