ref: a21dacec42e2ec31d80942bae35fa19ae07277f9
parent: 25ae4973fab0cfffe47fbc8373dae8a8715786d7
parent: 85e824153a6956f2aab67a395a4826dc50760e33
author: Simon Howard <fraggle+github@gmail.com>
date: Thu Feb 28 10:21:11 EST 2019
Merge pull request #1128 from Altazimuth/i_glob-msvc-cmake-fix Fix i_glob.c compilation under MSVC (and CMake)
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -95,9 +95,14 @@
w_merge.c w_merge.h
z_zone.c z_zone.h)
+set(GAME_INCLUDE_DIRS "${CMAKE_CURRENT_BINARY_DIR}/../")
+
if(MSVC)
list(APPEND GAME_SOURCE_FILES
"../win32/win_opendir.c" "../win32/win_opendir.h")
+
+ list(APPEND GAME_INCLUDE_DIRS
+ "${PROJECT_SOURCE_DIR}/win32/")
endif()
set(DEHACKED_SOURCE_FILES
@@ -126,8 +131,7 @@
add_executable("${PROGRAM_PREFIX}doom" ${SOURCE_FILES_WITH_DEH})
endif()
-target_include_directories("${PROGRAM_PREFIX}doom"
- PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
+target_include_directories("${PROGRAM_PREFIX}doom" PRIVATE ${GAME_INCLUDE_DIRS})
target_link_libraries("${PROGRAM_PREFIX}doom" doom ${EXTRA_LIBS})
if(MSVC)
@@ -141,8 +145,7 @@
add_executable("${PROGRAM_PREFIX}heretic" ${SOURCE_FILES_WITH_DEH})
endif()
-target_include_directories("${PROGRAM_PREFIX}heretic"
- PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
+target_include_directories("${PROGRAM_PREFIX}heretic" PRIVATE ${GAME_INCLUDE_DIRS})
target_link_libraries("${PROGRAM_PREFIX}heretic" heretic ${EXTRA_LIBS})
if(MSVC)
@@ -156,8 +159,7 @@
add_executable("${PROGRAM_PREFIX}hexen" ${SOURCE_FILES})
endif()
-target_include_directories("${PROGRAM_PREFIX}hexen"
- PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
+target_include_directories("${PROGRAM_PREFIX}hexen" PRIVATE ${GAME_INCLUDE_DIRS})
target_link_libraries("${PROGRAM_PREFIX}hexen" hexen ${EXTRA_LIBS})
if(MSVC)
@@ -171,8 +173,7 @@
add_executable("${PROGRAM_PREFIX}strife" ${SOURCE_FILES_WITH_DEH})
endif()
-target_include_directories("${PROGRAM_PREFIX}strife"
- PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
+target_include_directories("${PROGRAM_PREFIX}strife" PRIVATE ${GAME_INCLUDE_DIRS})
target_link_libraries("${PROGRAM_PREFIX}strife" strife ${EXTRA_LIBS})
if(MSVC)
--- a/src/i_glob.c
+++ b/src/i_glob.c
@@ -27,6 +27,8 @@
#if defined(_MSC_VER)
// For Visual C++, we need to include the win_opendir module.
#include <win_opendir.h>
+#include <sys/stat.h>
+#define S_ISDIR(m) (((m)& S_IFMT) == S_IFDIR)
#elif defined(HAVE_DIRENT_H)
#include <dirent.h>
#include <sys/stat.h>