Improve CMake style consistency
This commit is contained in:
parent
d2a514161b
commit
c45e888b74
2 changed files with 18 additions and 18 deletions
|
@ -31,25 +31,25 @@ project(CSE2 LANGUAGES C CXX)
|
||||||
message(STATUS "Compiler ID : ${CMAKE_CXX_COMPILER_ID}")
|
message(STATUS "Compiler ID : ${CMAKE_CXX_COMPILER_ID}")
|
||||||
|
|
||||||
# Has to be placed after "project()"
|
# 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
|
# Using Clang (this is a match so that we also get "AppleClang" which is the Apple-provided Clang
|
||||||
set(COMPILER_IS_CLANG true)
|
set(COMPILER_IS_CLANG true)
|
||||||
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")
|
||||||
endif()
|
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)
|
set(COMPILER_IS_GCC_COMPATIBLE true)
|
||||||
message(STATUS "Compiling with a GCC-compatible compiler")
|
message(STATUS "Compiling with a GCC-compatible compiler")
|
||||||
endif()
|
endif()
|
||||||
|
@ -289,10 +289,10 @@ if(DEBUG_SAVE)
|
||||||
target_compile_definitions(CSE2 PRIVATE DEBUG_SAVE)
|
target_compile_definitions(CSE2 PRIVATE DEBUG_SAVE)
|
||||||
endif()
|
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))
|
||||||
|
|
||||||
if (MSVC)
|
if(MSVC)
|
||||||
# Force to always compile with /W4 on MSVC
|
# Force to always compile with /W4 on MSVC
|
||||||
|
|
||||||
# Can't do this with target_compile_options
|
# Can't do this with target_compile_options
|
||||||
|
@ -331,10 +331,10 @@ if (WARNINGS_ALL)
|
||||||
endif()
|
endif()
|
||||||
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))
|
# 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)
|
target_compile_options(CSE2 PRIVATE /WX)
|
||||||
elseif(COMPILER_IS_GCC_COMPATIBLE)
|
elseif(COMPILER_IS_GCC_COMPATIBLE)
|
||||||
target_compile_options(CSE2 PRIVATE -Werror)
|
target_compile_options(CSE2 PRIVATE -Werror)
|
||||||
|
|
|
@ -18,35 +18,35 @@ project(DoConfig LANGUAGES CXX)
|
||||||
message(STATUS "Compiler ID : ${CMAKE_CXX_COMPILER_ID}")
|
message(STATUS "Compiler ID : ${CMAKE_CXX_COMPILER_ID}")
|
||||||
|
|
||||||
# Has to be placed after "project()"
|
# 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
|
# Using Clang (this is a match so that we also get "AppleClang" which is the Apple-provided Clang
|
||||||
set(COMPILER_IS_CLANG true)
|
set(COMPILER_IS_CLANG true)
|
||||||
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")
|
||||||
endif()
|
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)
|
set(COMPILER_IS_GCC_COMPATIBLE true)
|
||||||
message(STATUS "Compiling with a GCC-compatible compiler")
|
message(STATUS "Compiling with a GCC-compatible compiler")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(DoConfig "DoConfig.cpp" "icon.rc")
|
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))
|
# 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
|
# Force to always compile with /W4 on MSVC
|
||||||
|
|
||||||
# Can't do this with target_compile_options
|
# Can't do this with target_compile_options
|
||||||
|
@ -64,10 +64,10 @@ if (WARNINGS)
|
||||||
endif()
|
endif()
|
||||||
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))
|
# 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
|
# Force to always compile with /Wall on MSVC
|
||||||
|
|
||||||
# Can't do this with target_compile_options
|
# Can't do this with target_compile_options
|
||||||
|
@ -85,10 +85,10 @@ if (WARNINGS_ALL)
|
||||||
endif()
|
endif()
|
||||||
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))
|
# 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)
|
target_compile_options(DoConfig PRIVATE /WX)
|
||||||
elseif(COMPILER_IS_GCC_COMPATIBLE)
|
elseif(COMPILER_IS_GCC_COMPATIBLE)
|
||||||
target_compile_options(DoConfig PRIVATE -Werror)
|
target_compile_options(DoConfig PRIVATE -Werror)
|
||||||
|
|
Loading…
Add table
Reference in a new issue