[Cmake] CMake variable MINGW

William A. Hoffman billlist at nycap.rr.com
Fri, 09 Jan 2004 07:57:53 -0500


I guess I had not thought of cygwin gcc being used as a MinGW compiler.
I figured MinGW was MinGW using MSYS and the gcc from there.
I guess the cxx flags could be added to the EXEC_PROGRAM.  Did you try
that?  Does it work?

-Bill




At 06:05 PM 1/8/2004, Wheeler, Frederick W (Research) wrote:
>I am trying to get VXL to compile with MinGW, using gcc with the -mno-cygwin
>option, run from cygwin.  The test for MinGW in
>CMakeDetermineCCompiler.cmake runs the C compiler without the command line
>options (I think).  I pasted the relevant section of
>CMakeDetermineCCompiler.cmake below.  In my situation, the compiler
>arguments are needed for it to act like a MinGW compiler.
>
>Should CMakeDetermineCCompiler.cmake use the given args to the C compiler?
>
>Is there some other way I should be doing this with CMake?
>
>Is there a shortcut I can take right away?  Notice I tried -DMINGW:BOOL=1
>below.  That does not seem to alter the setting of the CMake built-in MINGW
>variable.
>
>Thanks,
>Fred Wheeler
>
>
>mkdir -p $TOP/vxl_bld_min
>rm -f $TOP/vxl_bld_min/CMakeCache.txt
>cd $TOP/vxl_bld_min
># use the windows version of cmake, but make Unix Makefiles
>"/cygdrive/c/Program Files/CMake/bin/cmake" \
>  -G"Unix Makefiles" \
>  -DCMAKE_INSTALL_PREFIX:PATH="`cygpath -w $TOP/vxl_usr_min`" \
>  -DCMAKE_C_COMPILER:FILEPATH="`cygpath -w /usr/bin/gcc`" \
>  -DCMAKE_CXX_COMPILER:FILEPATH="`cygpath -w /usr/bin/g++`" \
>  -DCMAKE_C_LINK_SHARED:FILEPATH="`cygpath -w /usr/bin/gcc`" \
>  -DCMAKE_CXX_LINK_SHARED:FILEPATH="`cygpath -w /usr/bin/g++`" \
>  -DMINGW:BOOL=1 \
>  -DCMAKE_C_FLAGS:STRING="-Wall -g -O0 -mno-cygwin" \
>  -DCMAKE_CXX_FLAGS:STRING="-Wall -g -O0 -mno-cygwin" \
>  -DX11_X11_INCLUDE_PATH:PATH=IGNORE \
>  -DVXL_FORCE_V3P_ZLIB:BOOL=YES \
>  -DVXL_FORCE_V3P_PNG:BOOL=YES \
>  -DVXL_FORCE_V3P_JPEG:BOOL=YES \
>  -DVXL_FORCE_V3P_MPEG2:BOOL=YES \
>  -DVXL_FORCE_V3P_TIFF:BOOL=YES \
>  -DBUILD_VGUI:BOOL=NO \
>  -DCMAKE_VERBOSE_MAKEFILE:BOOL=OFF \
>  "`cygpath -w $TOP/vxl_src`"
>
>
>Relevant section of CMakeDetermineCCompiler.cmake
>
># test to see if the c compiler is gnu
>EXEC_PROGRAM(${CMAKE_C_COMPILER} ARGS -E
>"\"${CMAKE_ROOT}/Modules/CMakeTestGNU.c\"" OUTPUT_VARIABLE
>CMAKE_COMPILER_OUTPUT RETURN_VALUE CMAKE_COMPILER_RETURN)
>IF(NOT CMAKE_COMPILER_RETURN)
>  IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" )
>    SET(CMAKE_COMPILER_IS_GNUCC 1)
>    FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeOutput.log
>      "Determining if the C compiler is GNU succeeded with "
>      "the following output:\n${CMAKE_COMPILER_OUTPUT}\n\n")
>  ELSE("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" )
>    FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeOutput.log
>      "Determining if the C compiler is GNU failed with "
>      "the following output:\n${CMAKE_COMPILER_OUTPUT}\n\n")
>  ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" )
>  IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_MINGW.*" )
>    SET(CMAKE_COMPILER_IS_MINGW 1)
>  ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_MINGW.*" )
>  IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" )
>    SET(CMAKE_COMPILER_IS_CYGWIN 1)
>  ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" )
>
>ENDIF(NOT CMAKE_COMPILER_RETURN)
>_______________________________________________
>Cmake mailing list
>Cmake at www.cmake.org
>http://www.cmake.org/mailman/listinfo/cmake