From d6ec92cba5885dbca1ad11464e08ce5be74e20af Mon Sep 17 00:00:00 2001 From: Gabriel Ravier Date: Sun, 27 Oct 2019 21:02:59 +0100 Subject: [PATCH] Attempt 2 at making warnings work Signed-off-by: Gabriel Ravier --- CMakeLists.txt | 4 ++-- bin2h/CMakeLists.txt | 47 ++++++++++++++++++++++---------------------- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 107e0cef..575926a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,13 +25,13 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") message(STATUS "Compiling with clang") endif() -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") +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") +if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") # Using Intel C++ set(COMPILER_IS_ICC true) message(STATUS "Compiling with ICC") diff --git a/bin2h/CMakeLists.txt b/bin2h/CMakeLists.txt index b8ea86e7..0184f487 100644 --- a/bin2h/CMakeLists.txt +++ b/bin2h/CMakeLists.txt @@ -6,30 +6,6 @@ endif() 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") set_target_properties(bin2h PROPERTIES @@ -38,6 +14,29 @@ set_target_properties(bin2h PROPERTIES 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) # HACK : Replace this with CMake provided stuff when possible (when CMake makes avoiding this possible (it isn't currently))