cmake: fixed up to handle Clang and AppleClang

This commit is contained in:
Alam Ed Arias 2016-02-05 21:49:24 -05:00
parent 4d5f16330a
commit 864baeda05
2 changed files with 7 additions and 7 deletions

View file

@ -166,7 +166,7 @@ set(SRB2_CORE_GAME_SOURCES
p_tick.h p_tick.h
) )
if(NOT CLANG) if(NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
set(SRB2_CORE_SOURCES ${SRB2_CORE_SOURCES} string.c) set(SRB2_CORE_SOURCES ${SRB2_CORE_SOURCES} string.c)
endif() endif()
@ -404,7 +404,7 @@ endif()
# Compatibility flag with later versions of GCC # Compatibility flag with later versions of GCC
# We should really fix our code to not need this # We should really fix our code to not need this
if(NOT CLANG AND NOT MSVC) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -mno-ms-bitfields) set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -mno-ms-bitfields)
endif() endif()
@ -429,4 +429,4 @@ endif()
if(NOT ${SRB2_SDL2_AVAILABLE} AND NOT ${SRB2_WIN32_AVAILABLE}) if(NOT ${SRB2_SDL2_AVAILABLE} AND NOT ${SRB2_WIN32_AVAILABLE})
message(FATAL_ERROR "There are no targets available to build an SRB2 executable. :(") message(FATAL_ERROR "There are no targets available to build an SRB2 executable. :(")
endif() endif()

View file

@ -117,7 +117,7 @@ if(${SDL2_FOUND})
add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32 ${SRB2_SDL2_TOTAL_SOURCES}) add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32 ${SRB2_SDL2_TOTAL_SOURCES})
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME ${SRB2_SDL2_EXE_NAME}) set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME ${SRB2_SDL2_EXE_NAME})
if(CLANG) if((CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))
add_framework(CoreFoundation SRB2SDL2) add_framework(CoreFoundation SRB2SDL2)
add_framework(SDL2 SRB2SDL2) add_framework(SDL2 SRB2SDL2)
add_framework(SDL2_mixer SRB2SDL2) add_framework(SDL2_mixer SRB2SDL2)
@ -224,7 +224,7 @@ if(${SDL2_FOUND})
endif() endif()
#### Installation #### #### Installation ####
if (CLANG) if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
install(TARGETS SRB2SDL2 install(TARGETS SRB2SDL2
BUNDLE DESTINATION . BUNDLE DESTINATION .
) )
@ -265,7 +265,7 @@ if(${SDL2_FOUND})
# Mac bundle fixup # Mac bundle fixup
if(CLANG) if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
install(CODE " install(CODE "
include(BundleUtilities) include(BundleUtilities)
fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/Sonic Robo Blast 2.app\" fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/Sonic Robo Blast 2.app\"
@ -279,4 +279,4 @@ if(${SDL2_FOUND})
else() else()
message(WARNING "SDL2 was not found, so the SDL2 target will not be available.") message(WARNING "SDL2 was not found, so the SDL2 target will not be available.")
set(SRB2_SDL2_AVAILABLE NO PARENT_SCOPE) set(SRB2_SDL2_AVAILABLE NO PARENT_SCOPE)
endif() endif()