Skip to content

Commit 90a8e09

Browse files
committed
CMake: don't look for strcasecmp/strncasecmp/dirent on Windows
On Windows, strcasecmp and strncasecmp are replaced by _stricmp and _strnicmp, while dirent.h is not available. Adjusted CMake checks accordingly to reflect these platform differences.
1 parent fec39e4 commit 90a8e09

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

CMakeLists.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,15 @@ find_package(m)
124124

125125
include(CheckSymbolExists)
126126
include(CheckIncludeFile)
127-
check_symbol_exists(strcasecmp "strings.h" HAVE_DECL_STRCASECMP)
128-
check_symbol_exists(strncasecmp "strings.h" HAVE_DECL_STRNCASECMP)
129-
check_include_file("dirent.h" HAVE_DIRENT_H)
127+
if(WIN32)
128+
check_symbol_exists(_stricmp "string.h" HAVE_DECL_STRNCASECMP)
129+
check_symbol_exists(_strnicmp "string.h" HAVE_DECL_STRNCASECMP)
130+
check_include_file("windows.h" HAVE_DIRENT_H)
131+
else()
132+
check_symbol_exists(strcasecmp "strings.h" HAVE_DECL_STRCASECMP)
133+
check_symbol_exists(strncasecmp "strings.h" HAVE_DECL_STRNCASECMP)
134+
check_include_file("dirent.h" HAVE_DIRENT_H)
135+
endif()
130136

131137
string(CONCAT WINDOWS_RC_VERSION "${PROJECT_VERSION_MAJOR}, "
132138
"${PROJECT_VERSION_MINOR}, ${PROJECT_VERSION_PATCH}, 0")

0 commit comments

Comments
 (0)