Attempt 2 at making warnings work

Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
This commit is contained in:
Gabriel Ravier 2019-10-27 21:02:59 +01:00
parent 44d6dac407
commit d6ec92cba5
2 changed files with 25 additions and 26 deletions

View file

@ -25,13 +25,13 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
message(STATUS "Compiling with clang") message(STATUS "Compiling with clang")
endif() endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# Using GCC # Using GCC
set(COMPILER_IS_GCC true) set(COMPILER_IS_GCC true)
message(STATUS "Compiling with gcc") message(STATUS "Compiling with gcc")
endif() endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
# Using Intel C++ # Using Intel C++
set(COMPILER_IS_ICC true) set(COMPILER_IS_ICC true)
message(STATUS "Compiling with ICC") message(STATUS "Compiling with ICC")

View file

@ -6,30 +6,6 @@ endif()
project(bin2h LANGUAGES C) project(bin2h LANGUAGES C)
# Has to be placed after "project()"
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# Using Clang (this is a match so that we also get "AppleClang" which is the Apple-provided Clang
set(COMPILER_IS_CLANG true)
message(STATUS "Compiling with clang")
endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# Using GCC
set(COMPILER_IS_GCC true)
message(STATUS "Compiling with gcc")
endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
# Using Intel C++
set(COMPILER_IS_ICC true)
message(STATUS "Compiling with ICC")
endif()
if (COMPILER_IS_CLANG OR COMPILER_IS_GCC OR COMPILER_IS_ICC)
set(COMPILER_IS_GCC_COMPATIBLE true)
message(STATUS "Compiling with a GCC-compatible compiler")
endif()
add_executable(bin2h "bin2h.c") add_executable(bin2h "bin2h.c")
set_target_properties(bin2h PROPERTIES set_target_properties(bin2h PROPERTIES
@ -38,6 +14,29 @@ set_target_properties(bin2h PROPERTIES
C_EXTENSIONS OFF C_EXTENSIONS OFF
) )
# Has to be placed after "project()"
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# Using Clang (this is a match so that we also get "AppleClang" which is the Apple-provided Clang
set(COMPILER_IS_CLANG true)
message(STATUS "Compiling with clang")
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# Using GCC
set(COMPILER_IS_GCC true)
message(STATUS "Compiling with gcc")
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
# Using Intel C++
set(COMPILER_IS_ICC true)
message(STATUS "Compiling with ICC")
endif()
if (COMPILER_IS_CLANG OR COMPILER_IS_GCC OR COMPILER_IS_ICC)
set(COMPILER_IS_GCC_COMPATIBLE true)
message(STATUS "Compiling with a GCC-compatible compiler")
endif()
if (WARNINGS) if (WARNINGS)
# HACK : Replace this with CMake provided stuff when possible (when CMake makes avoiding this possible (it isn't currently)) # HACK : Replace this with CMake provided stuff when possible (when CMake makes avoiding this possible (it isn't currently))