Skip to content

Commit

Permalink
- implemented str(n)icmp function definitions via CMake macro
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-lysiuk committed Oct 5, 2019
1 parent c09f196 commit 4627032
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 50 deletions.
16 changes: 16 additions & 0 deletions CMakeLists.txt
Expand Up @@ -156,6 +156,22 @@ macro( use_fast_math )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ZD_FASTMATH_FLAG}" )
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 )

find_package( BZip2 )
Expand Down
14 changes: 2 additions & 12 deletions libraries/oplsynth/CMakeLists.txt
@@ -1,24 +1,14 @@
cmake_minimum_required( VERSION 2.8.7 )

use_fast_math()
require_stricmp()
require_strnicmp()

if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
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" )
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 )

file( GLOB HEADER_FILES
Expand Down
8 changes: 1 addition & 7 deletions libraries/timidity/CMakeLists.txt
@@ -1,19 +1,13 @@
cmake_minimum_required( VERSION 2.8.7 )

use_fast_math()
require_stricmp()

if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
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" )
endif()

include( CheckFunctionExists )

CHECK_FUNCTION_EXISTS( stricmp STRICMP_EXISTS )
if( NOT STRICMP_EXISTS )
add_definitions( -Dstricmp=strcasecmp )
endif()

include_directories( timidity )

file( GLOB HEADER_FILES
Expand Down
14 changes: 2 additions & 12 deletions libraries/wildmidi/CMakeLists.txt
@@ -1,24 +1,14 @@
cmake_minimum_required( VERSION 2.8.7 )

use_fast_math()
require_stricmp()
require_strnicmp()

if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
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" )
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 )

file( GLOB HEADER_FILES
Expand Down
12 changes: 2 additions & 10 deletions libraries/zmusic/CMakeLists.txt
@@ -1,6 +1,8 @@
cmake_minimum_required( VERSION 2.8.7 )

use_fast_math()
require_stricmp()
require_strnicmp()

if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -fomit-frame-pointer" )
Expand All @@ -9,16 +11,6 @@ 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()

if( DYN_SNDFILE)
add_definitions( -DHAVE_SNDFILE -DDYN_SNDFILE )
else()
Expand Down
11 changes: 2 additions & 9 deletions src/CMakeLists.txt
Expand Up @@ -401,15 +401,8 @@ if( NOT STRUPR_EXISTS )
add_definitions( -DNEED_STRUPR=1 )
endif()

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()
require_stricmp()
require_strnicmp()

if( NOT MSVC )
add_definitions( -D__forceinline=inline )
Expand Down

0 comments on commit 4627032

Please sign in to comment.