Skip to content

Commit

Permalink
CMake: don't look for strcasecmp/strncasecmp/dirent on Windows
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pvictress committed Jan 4, 2025
1 parent fec39e4 commit 90a8e09
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,15 @@ find_package(m)

include(CheckSymbolExists)
include(CheckIncludeFile)
check_symbol_exists(strcasecmp "strings.h" HAVE_DECL_STRCASECMP)
check_symbol_exists(strncasecmp "strings.h" HAVE_DECL_STRNCASECMP)
check_include_file("dirent.h" HAVE_DIRENT_H)
if(WIN32)
check_symbol_exists(_stricmp "string.h" HAVE_DECL_STRNCASECMP)
check_symbol_exists(_strnicmp "string.h" HAVE_DECL_STRNCASECMP)
check_include_file("windows.h" HAVE_DIRENT_H)
else()
check_symbol_exists(strcasecmp "strings.h" HAVE_DECL_STRCASECMP)
check_symbol_exists(strncasecmp "strings.h" HAVE_DECL_STRNCASECMP)
check_include_file("dirent.h" HAVE_DIRENT_H)
endif()

string(CONCAT WINDOWS_RC_VERSION "${PROJECT_VERSION_MAJOR}, "
"${PROJECT_VERSION_MINOR}, ${PROJECT_VERSION_PATCH}, 0")
Expand Down

0 comments on commit 90a8e09

Please sign in to comment.