Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cmake invalid numeric argument '/Wextra'

Tags:

cmake

Windows XP Pro 32bit

Visual studio 2008 VC Express edition.

I have installed cmake and created the CMakeLists.txt and I want to cross-platform for Linux/windows.

Everything works ok for running on linux. So I copied my source directory as I am doing out of source building to my windows xp machine.

I used the cmake-GUI to configure/generate the solution files. Everything ok there.

However, when I opened the solution file and selected build from menu I got the following error.

cl : Command line error D8021 : invalid numeric argument '/Wextra'

Not sure really where to start looking to solve this error. If any one can point me in the right direction.

Many thanks for any suggestions,

like image 410
ant2009 Avatar asked Feb 16 '10 15:02

ant2009


1 Answers

Your CMakeLists.txt defines compile flag -Wextra for GCC and then CMake tried to use that on cl (the Microsoft compiler) too. Fix the CMakeLists.txt so that it tests for compiler before setting warning flags, i.e.

# Set default compile flags for GCC
if(CMAKE_COMPILER_IS_GNUCXX)
    message(STATUS "GCC detected, adding compile flags")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98 -pedantic -Wall -Wextra")
endif(CMAKE_COMPILER_IS_GNUCXX)
like image 135
Tronic Avatar answered Nov 06 '22 00:11

Tronic