- implemented str(n)icmp function definitions via CMake macro

This commit is contained in:
alexey.lysiuk 2019-10-05 14:47:36 +03:00
parent c09f196141
commit 46270326be
6 changed files with 25 additions and 50 deletions

View file

@ -156,6 +156,22 @@ macro( use_fast_math )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ZD_FASTMATH_FLAG}" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ZD_FASTMATH_FLAG}" )
endmacro() endmacro()
include( CheckFunctionExists )
macro( require_stricmp )
CHECK_FUNCTION_EXISTS( stricmp STRICMP_EXISTS )
if( NOT STRICMP_EXISTS )
add_definitions( -Dstricmp=strcasecmp )
endif()
endmacro()
macro( require_strnicmp )
CHECK_FUNCTION_EXISTS( strnicmp STRNICMP_EXISTS )
if( NOT STRNICMP_EXISTS )
add_definitions( -Dstrnicmp=strncasecmp )
endif()
endmacro()
option( NO_OPENAL "Disable OpenAL sound support" OFF ) option( NO_OPENAL "Disable OpenAL sound support" OFF )
find_package( BZip2 ) find_package( BZip2 )

View file

@ -1,24 +1,14 @@
cmake_minimum_required( VERSION 2.8.7 ) cmake_minimum_required( VERSION 2.8.7 )
use_fast_math() use_fast_math()
require_stricmp()
require_strnicmp()
if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE ) if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -fomit-frame-pointer" ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -fomit-frame-pointer" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
endif() endif()
include( CheckFunctionExists )
CHECK_FUNCTION_EXISTS( stricmp STRICMP_EXISTS )
if( NOT STRICMP_EXISTS )
add_definitions( -Dstricmp=strcasecmp )
endif()
CHECK_FUNCTION_EXISTS( strnicmp STRNICMP_EXISTS )
if( NOT STRNICMP_EXISTS )
add_definitions( -Dstrnicmp=strncasecmp )
endif()
include_directories( oplsynth ) include_directories( oplsynth )
file( GLOB HEADER_FILES file( GLOB HEADER_FILES

View file

@ -1,19 +1,13 @@
cmake_minimum_required( VERSION 2.8.7 ) cmake_minimum_required( VERSION 2.8.7 )
use_fast_math() use_fast_math()
require_stricmp()
if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE ) if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -fomit-frame-pointer" ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -fomit-frame-pointer" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
endif() endif()
include( CheckFunctionExists )
CHECK_FUNCTION_EXISTS( stricmp STRICMP_EXISTS )
if( NOT STRICMP_EXISTS )
add_definitions( -Dstricmp=strcasecmp )
endif()
include_directories( timidity ) include_directories( timidity )
file( GLOB HEADER_FILES file( GLOB HEADER_FILES

View file

@ -1,24 +1,14 @@
cmake_minimum_required( VERSION 2.8.7 ) cmake_minimum_required( VERSION 2.8.7 )
use_fast_math() use_fast_math()
require_stricmp()
require_strnicmp()
if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE ) if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -fomit-frame-pointer" ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -fomit-frame-pointer" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
endif() endif()
include( CheckFunctionExists )
CHECK_FUNCTION_EXISTS( stricmp STRICMP_EXISTS )
if( NOT STRICMP_EXISTS )
add_definitions( -Dstricmp=strcasecmp )
endif()
CHECK_FUNCTION_EXISTS( strnicmp STRNICMP_EXISTS )
if( NOT STRNICMP_EXISTS )
add_definitions( -Dstrnicmp=strncasecmp )
endif()
include_directories( wildmidi ) include_directories( wildmidi )
file( GLOB HEADER_FILES file( GLOB HEADER_FILES

View file

@ -1,6 +1,8 @@
cmake_minimum_required( VERSION 2.8.7 ) cmake_minimum_required( VERSION 2.8.7 )
use_fast_math() use_fast_math()
require_stricmp()
require_strnicmp()
if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE ) if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -fomit-frame-pointer" ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -fomit-frame-pointer" )
@ -9,16 +11,6 @@ endif()
include( CheckFunctionExists ) include( CheckFunctionExists )
CHECK_FUNCTION_EXISTS( stricmp STRICMP_EXISTS )
if( NOT STRICMP_EXISTS )
add_definitions( -Dstricmp=strcasecmp )
endif()
CHECK_FUNCTION_EXISTS( strnicmp STRNICMP_EXISTS )
if( NOT STRNICMP_EXISTS )
add_definitions( -Dstrnicmp=strncasecmp )
endif()
if( DYN_SNDFILE) if( DYN_SNDFILE)
add_definitions( -DHAVE_SNDFILE -DDYN_SNDFILE ) add_definitions( -DHAVE_SNDFILE -DDYN_SNDFILE )
else() else()

View file

@ -401,15 +401,8 @@ if( NOT STRUPR_EXISTS )
add_definitions( -DNEED_STRUPR=1 ) add_definitions( -DNEED_STRUPR=1 )
endif() endif()
CHECK_FUNCTION_EXISTS( stricmp STRICMP_EXISTS ) require_stricmp()
if( NOT STRICMP_EXISTS ) require_strnicmp()
add_definitions( -Dstricmp=strcasecmp )
endif()
CHECK_FUNCTION_EXISTS( strnicmp STRNICMP_EXISTS )
if( NOT STRNICMP_EXISTS )
add_definitions( -Dstrnicmp=strncasecmp )
endif()
if( NOT MSVC ) if( NOT MSVC )
add_definitions( -D__forceinline=inline ) add_definitions( -D__forceinline=inline )