@@ -176,7 +176,7 @@ FILE(COPY ${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.cmake DESTINATION ${CMAKE_CURR
176176
177177# Set Memory test program for non-MSVC based builds.
178178# Assume valgrind for now.
179- IF (NOT MSVC )
179+ IF (( NOT MSVC ) AND ( NOT MINGW) )
180180 SET (CTEST_MEMORYCHECK_COMMAND valgrind CACHE STRING "" )
181181ENDIF ()
182182
@@ -254,6 +254,14 @@ ENDIF(CMAKE_COMPILER_IS_GNUCC OR APPLE)
254254
255255# End default linux gcc & apple compiler options.
256256
257+ # Use relative pathnames in __FILE__ macros on MINGW:
258+ IF (MINGW)
259+ CHECK_C_COMPILER_FLAG ("-fmacro-prefix-map='${CMAKE_SOURCE_DIR} '=." CC_HAS_MACRO_PREFIX_MAP )
260+ IF (CC_HAS_MACRO_PREFIX_MAP)
261+ SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmacro-prefix-map='${CMAKE_SOURCE_DIR} '=." )
262+ ENDIF ()
263+ ENDIF ()
264+
257265ADD_DEFINITIONS ()
258266
259267# Suppress CRT Warnings.
@@ -262,6 +270,11 @@ IF(MSVC)
262270 ADD_DEFINITIONS (-D_CRT_SECURE_NO_WARNINGS )
263271ENDIF ()
264272
273+ # Support ANSI format specifiers for *printf on MINGW:
274+ IF (MINGW)
275+ ADD_DEFINITIONS (-D__USE_MINGW_ANSI_STDIO=1 )
276+ ENDIF ()
277+
265278#####
266279# System inspection checks
267280#####
@@ -279,7 +292,7 @@ SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/libsrc)
279292# Configuration for post-install RPath
280293# Adapted from http://www.cmake.org/Wiki/CMake_RPATH_handling
281294##
282- IF (NOT MSVC AND BUILD_SHARED_LIBS )
295+ IF (NOT WIN32 AND BUILD_SHARED_LIBS )
283296 # use, i.e. don't skip the full RPATH for the build tree
284297 SET (CMAKE_SKIP_BUILD_RPATH FALSE )
285298
@@ -1243,7 +1256,7 @@ IF(ENABLE_TESTS)
12431256 SET (NC_CTEST_DROP_LOC_PREFIX "" CACHE STRING "Prefix for Dashboard location on remote server when using CTest-based testing." )
12441257 SET (SUBMIT_URL "https://cdash.unidata.ucar.edu:443" )
12451258 FIND_PROGRAM (HOSTNAME_CMD NAMES hostname )
1246- IF (NOT MSVC )
1259+ IF (NOT WIN32 )
12471260 SET (HOSTNAME_ARG "-s" )
12481261 ENDIF ()
12491262 IF (HOSTNAME_CMD)
0 commit comments