From 7c81c2f1eed2986fce2aedc81d0e72ecba5a72d6 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 23 Jun 2013 18:37:13 +0200 Subject: [PATCH] - added Edward-san's patch for allowing 'clang' compiler to use the same 'gcc' cmake settings --- CMakeLists.txt | 4 ++-- bzip2/CMakeLists.txt | 4 ++-- dumb/CMakeLists.txt | 8 ++++---- game-music-emu/CMakeLists.txt | 4 ++-- gdtoa/CMakeLists.txt | 4 ++-- jpeg-6b/CMakeLists.txt | 4 ++-- lzma/CMakeLists.txt | 4 ++-- src/CMakeLists.txt | 18 +++++++++--------- tools/updaterevision/CMakeLists.txt | 6 +++--- 9 files changed, 28 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e5d9cc400..22bc0e7cc5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,9 +10,9 @@ ENDIF( NOT CMAKE_BUILD_TYPE ) set( ZDOOM_OUTPUT_DIR ${CMAKE_BINARY_DIR} CACHE PATH "Directory where zdoom.pk3 and the executable will be created." ) set( ZDOOM_EXE_NAME "zdoom" CACHE FILEPATH "Name of the executable to create." ) -if( CMAKE_COMPILER_IS_GNUCXX ) +if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) set( PROFILE 0 CACHE BOOL "Enable profiling with gprof for Debug and RelWithDebInfo build types." ) -endif( CMAKE_COMPILER_IS_GNUCXX ) +endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}") diff --git a/bzip2/CMakeLists.txt b/bzip2/CMakeLists.txt index 5c1255604b..6006f491cb 100644 --- a/bzip2/CMakeLists.txt +++ b/bzip2/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required( VERSION 2.4 ) -if( CMAKE_COMPILER_IS_GNUC ) +if( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -fomit-frame-pointer" ) -endif( CMAKE_COMPILER_IS_GNUC ) +endif( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) add_definitions( -DBZ_NO_STDIO ) add_library( bz2 diff --git a/dumb/CMakeLists.txt b/dumb/CMakeLists.txt index 591e314002..ee50c4a0af 100644 --- a/dumb/CMakeLists.txt +++ b/dumb/CMakeLists.txt @@ -11,9 +11,9 @@ endif( NOT CMAKE_BUILD_TYPE MATCHES "Release" ) set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -DDEBUGMODE=1" ) -if( CMAKE_COMPILER_IS_GNUC ) +if( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-pointer-sign -Wno-uninitialized" ) -endif( CMAKE_COMPILER_IS_GNUC ) +endif( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) CHECK_FUNCTION_EXISTS( itoa ITOA_EXISTS ) if( NOT ITOA_EXISTS ) @@ -101,6 +101,6 @@ add_library( dumb src/it/xmeffect.c ) target_link_libraries( dumb ) -if( CMAKE_COMPILER_IS_GNUCXX ) +if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) set_source_files_properties( src/it/filter.cpp PROPERTIES COMPILE_FLAGS -msse ) -endif( CMAKE_COMPILER_IS_GNUCXX ) +endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) diff --git a/game-music-emu/CMakeLists.txt b/game-music-emu/CMakeLists.txt index 7905f847ab..5c4a030434 100644 --- a/game-music-emu/CMakeLists.txt +++ b/game-music-emu/CMakeLists.txt @@ -6,7 +6,7 @@ if( NOT CMAKE_BUILD_TYPE MATCHES "Release" ) set( CMAKE_BUILD_TYPE "RelWithDebInfo" ) endif( NOT CMAKE_BUILD_TYPE MATCHES "Release" ) -if( CMAKE_COMPILER_IS_GNUCXX ) +if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra" ) if( NOT PROFILE ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fomit-frame-pointer" ) @@ -15,7 +15,7 @@ if( CMAKE_COMPILER_IS_GNUCXX ) if( HAVE_NO_ARRAY_BOUNDS ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-array-bounds" ) endif( HAVE_NO_ARRAY_BOUNDS ) -endif( CMAKE_COMPILER_IS_GNUCXX ) +endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) add_library( gme gme/Blip_Buffer.cpp diff --git a/gdtoa/CMakeLists.txt b/gdtoa/CMakeLists.txt index 6fc394d8d4..4ad0be6de9 100644 --- a/gdtoa/CMakeLists.txt +++ b/gdtoa/CMakeLists.txt @@ -8,9 +8,9 @@ if( MSVC ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4554 /wd4102" ) endif( MSVC ) -if( CMAKE_COMPILER_IS_GNUCXX ) +if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra" ) -endif( CMAKE_COMPILER_IS_GNUCXX ) +endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) add_definitions( -DINFNAN_CHECK -DMULTIPLE_THREADS ) diff --git a/jpeg-6b/CMakeLists.txt b/jpeg-6b/CMakeLists.txt index c3a5f458c6..5c8b5972e5 100644 --- a/jpeg-6b/CMakeLists.txt +++ b/jpeg-6b/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required( VERSION 2.4 ) -if( CMAKE_COMPILER_IS_GNUC ) +if( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -fomit-frame-pointer" ) -endif( CMAKE_COMPILER_IS_GNUC ) +endif( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) add_library( jpeg jcomapi.c diff --git a/lzma/CMakeLists.txt b/lzma/CMakeLists.txt index 6a2561c68c..7582712fea 100644 --- a/lzma/CMakeLists.txt +++ b/lzma/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required( VERSION 2.4 ) -if( CMAKE_COMPILER_IS_GNUC ) +if( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -fomit-frame-pointer" ) -endif( CMAKE_COMPILER_IS_GNUC ) +endif( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) set( LZMA_FILES C/Archive/7z/7zDecode.c diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9436154bb0..08f8e0ba64 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,14 +10,14 @@ include( CheckCXXCompilerFlag ) include( FindPkgConfig ) option( NO_ASM "Disable assembly code" ) -if( CMAKE_COMPILER_IS_GNUCXX ) +if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) option( NO_STRIP "Do not strip Release or MinSizeRel builds" ) # At least some versions of Xcode fail if you strip with the linker # instead of the separate strip utility. if( APPLE ) set( NO_STRIP ON ) endif( APPLE ) -endif( CMAKE_COMPILER_IS_GNUCXX ) +endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) option( DYN_FLUIDSYNTH "Dynamically load fluidsynth" ) @@ -391,7 +391,7 @@ endif( SSE_MATTERS ) # Set up flags for GCC -if( CMAKE_COMPILER_IS_GNUCXX ) +if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) if( PROFILE ) set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -pg" ) set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg" ) @@ -420,7 +420,7 @@ if( CMAKE_COMPILER_IS_GNUCXX ) set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -s" ) set (CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} -s" ) endif( NOT NO_STRIP ) -endif( CMAKE_COMPILER_IS_GNUCXX ) +endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) # Check for functions that may or may not exist. @@ -529,15 +529,15 @@ if( WIN32 ) win32/i_system.cpp win32/st_start.cpp win32/win32video.cpp ) - if( CMAKE_COMPILER_IS_GNUCXX ) + if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) # CMake is not set up to compile and link rc files with GCC. :( add_custom_command( OUTPUT zdoom-rc.o COMMAND windres -o zdoom-rc.o -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zdoom.rc DEPENDS win32/zdoom.rc ) set( SYSTEM_SOURCES ${SYSTEM_SOURCES} zdoom-rc.o ) - else( CMAKE_COMPILER_IS_GNUCXX ) + else( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) set( SYSTEM_SOURCES ${SYSTEM_SOURCES} win32/zdoom.rc ) - endif( CMAKE_COMPILER_IS_GNUCXX ) + endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) else( WIN32 ) set( SYSTEM_SOURCES_DIR sdl ) set( SYSTEM_SOURCES @@ -980,7 +980,7 @@ if( NOT WIN32 ) COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/link-make COMMAND /bin/sh -c ${CMAKE_CURRENT_BINARY_DIR}/link-make ) endif( NOT WIN32 ) -if( CMAKE_COMPILER_IS_GNUCXX ) +if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) # GCC misoptimizes this file set_source_files_properties( oplsynth/fmopl.cpp PROPERTIES COMPILE_FLAGS "-fno-tree-dominator-opts -fno-tree-fre" ) @@ -988,7 +988,7 @@ if( CMAKE_COMPILER_IS_GNUCXX ) if( SSE_MATTERS ) set_source_files_properties( x86.cpp PROPERTIES COMPILE_FLAGS "-msse2 -mmmx" ) endif( SSE_MATTERS ) -endif( CMAKE_COMPILER_IS_GNUCXX ) +endif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) if( MSVC ) set_target_properties(zdoom PROPERTIES LINK_FLAGS "/MANIFEST:NO") diff --git a/tools/updaterevision/CMakeLists.txt b/tools/updaterevision/CMakeLists.txt index aeacf01f39..d985b9e3f0 100644 --- a/tools/updaterevision/CMakeLists.txt +++ b/tools/updaterevision/CMakeLists.txt @@ -1,12 +1,12 @@ cmake_minimum_required( VERSION 2.4 ) if( WIN32 ) - if( CMAKE_COMPILER_IS_GNUC OR CMAKE_COMPILER_IS_GNUCXX ) + if( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/trustinfo.o COMMAND windres -o ${CMAKE_CURRENT_BINARY_DIR}/trustinfo.o -i ${CMAKE_CURRENT_SOURCE_DIR}/trustinfo.rc DEPENDS trustinfo.rc ) set( TRUSTINFO trustinfo.o ) - else( CMAKE_COMPILER_IS_GNUC OR CMAKE_COMPILER_IS_GNUCXX ) + else( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) if( MSVC_VERSION GREATER 1399 ) # VC 8+ adds a manifest automatically to the executable. We need to # merge ours with it. @@ -14,7 +14,7 @@ if( WIN32 ) else( MSVC_VERSION GREATER 1399 ) set( TRUSTINFO trustinfo.rc ) endif( MSVC_VERSION GREATER 1399 ) - endif( CMAKE_COMPILER_IS_GNUC OR CMAKE_COMPILER_IS_GNUCXX ) + endif( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) endif( WIN32 ) add_executable( updaterevision updaterevision.c ${TRUSTINFO} )