ref: c45e888b741c00e3c9135354cbc90774528ba0ac
parent: d2a514161b8c43bad1feb2534d9dcdceec4b6c37
author: Clownacy <Clownacy@users.noreply.github.com>
date: Wed Jan 22 19:59:27 EST 2020
Improve CMake style consistency
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,25 +31,25 @@
message(STATUS "Compiler ID : ${CMAKE_CXX_COMPILER_ID}")
# Has to be placed after "project()"
-if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+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")
+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")
endif()
-if (COMPILER_IS_CLANG OR COMPILER_IS_GCC OR COMPILER_IS_ICC)
+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()
@@ -289,10 +289,10 @@
target_compile_definitions(CSE2 PRIVATE DEBUG_SAVE)
endif()
-if (WARNINGS)
+if(WARNINGS)
# HACK : Replace this with CMake provided stuff when possible (when CMake makes avoiding this possible (it isn't currently))
- if (MSVC)
+ if(MSVC)
# Force to always compile with /W4 on MSVC
# Can't do this with target_compile_options
@@ -331,10 +331,10 @@
endif()
endif()
-if (WARNINGS_FATAL)
+if(WARNINGS_FATAL)
# HACK : Replace this with CMake provided stuff when possible (when CMake makes avoiding this possible (it isn't currently))
- if (MSVC)
+ if(MSVC)
target_compile_options(CSE2 PRIVATE /WX)
elseif(COMPILER_IS_GCC_COMPATIBLE)
target_compile_options(CSE2 PRIVATE -Werror)
--- a/DoConfig/CMakeLists.txt
+++ b/DoConfig/CMakeLists.txt
@@ -18,25 +18,25 @@
message(STATUS "Compiler ID : ${CMAKE_CXX_COMPILER_ID}")
# Has to be placed after "project()"
-if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+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")
+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")
endif()
-if (COMPILER_IS_CLANG OR COMPILER_IS_GCC OR COMPILER_IS_ICC)
+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()
@@ -43,10 +43,10 @@
add_executable(DoConfig "DoConfig.cpp" "icon.rc")
-if (WARNINGS)
+if(WARNINGS)
# HACK : Replace this with CMake provided stuff when possible (when CMake makes avoiding this possible (it isn't currently))
- if (MSVC)
+ if(MSVC)
# Force to always compile with /W4 on MSVC
# Can't do this with target_compile_options
@@ -64,10 +64,10 @@
endif()
endif()
-if (WARNINGS_ALL)
+if(WARNINGS_ALL)
# HACK : Replace this with CMake provided stuff when possible (when CMake makes avoiding this possible (it isn't currently))
- if (MSVC)
+ if(MSVC)
# Force to always compile with /Wall on MSVC
# Can't do this with target_compile_options
@@ -85,10 +85,10 @@
endif()
endif()
-if (WARNINGS_FATAL)
+if(WARNINGS_FATAL)
# HACK : Replace this with CMake provided stuff when possible (when CMake makes avoiding this possible (it isn't currently))
- if (MSVC)
+ if(MSVC)
target_compile_options(DoConfig PRIVATE /WX)
elseif(COMPILER_IS_GCC_COMPATIBLE)
target_compile_options(DoConfig PRIVATE -Werror)
--
⑨