[CMake] Convert unix c++ compiler flags to windows compiler flags?

Denis Scherbakov denis_scherbakov at yahoo.com
Fri Jun 5 09:28:51 EDT 2009



> > SET(CMAKE_CXX_FLAGS 
> > "${CMAKE_CXX_FLAGS} -w -lX11 -Dcimg_use_xshm -lXext
> -Dcimg_use_xrandr -lXrandr 
> > -O3 -fpermissive -march=nocona -m64 -ffast-math
> -funroll-loops
> -finline-functions")
> >
> > Any ideas on who I convert those to windows (Visual
> Studio 2008)
> flags? 

I think there is too much difference in GNU and MS compilers to be able
to just convert. I am sorry to say, but you probably need to dig in into
documentation for each compiler you want to support and do something like:

IF( "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC" )
  SET(CMAKE_CXX_FLAGS "MS compiler flags here")
ELSEIF ( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" )
  SET(CMAKE_CXX_FLAGS "GNU compiler flags here")
ENDIF ()

Denis


      


More information about the CMake mailing list