forked from FreeRDP/FreeRDP
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move settings to cmake/CompilerFlags.cmake and cmake/CXXCompilerFlags.cmake
- Loading branch information
1 parent
2953c78
commit ad2ae90
Showing
15 changed files
with
172 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
include(CheckCCompilerFlag) | ||
include(CheckCXXCompilerFlag) | ||
|
||
macro (CheckAndSetFlag FLAG) | ||
if (FLAG) | ||
get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES) | ||
|
||
unset(C_FLAG) | ||
unset(CXX_FLAG) | ||
if ("C" IN_LIST languages) | ||
CHECK_C_COMPILER_FLAG("${FLAG}" C_FLAG) | ||
if (C_FLAG) | ||
string(APPEND CMAKE_C_FLAGS " ${FLAG}") | ||
endif() | ||
endif() | ||
|
||
if ("CXX" IN_LIST languages) | ||
CHECK_CXX_COMPILER_FLAG("${FLAG}" CXX_FLAG) | ||
if (CXX_FLAG) | ||
string(APPEND CMAKE_CXX_FLAGS " ${FLAG}") | ||
endif() | ||
endif() | ||
|
||
if(NOT C_FLAG AND NOT CXX_FLAG) | ||
message(WARNING "compiler does not support ${FLAG}") | ||
endif() | ||
endif() | ||
endmacro() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
include(CheckAndSetFlag) | ||
|
||
option(ENABLE_WARNING_VERBOSE "enable -Weveryting (and some exceptions) for compile" OFF) | ||
option(ENABLE_WARNING_ERROR "enable -Werror for compile" OFF) | ||
|
||
set(COMMON_COMPILER_FLAGS) | ||
if (ENABLE_WARNING_VERBOSE) | ||
if (MSVC) | ||
list(APPEND COMMON_COMPILER_FLAGS | ||
/W4 | ||
/wo4324 | ||
) | ||
else() | ||
list(APPEND COMMON_COMPILER_FLAGS | ||
-Weverything | ||
-Wall | ||
-Wpedantic | ||
-Wno-padded | ||
-Wno-switch-enum | ||
-Wno-cast-align | ||
-Wno-unsafe-buffer-usage | ||
-Wno-reserved-identifier | ||
-Wno-covered-switch-default | ||
-Wno-disabled-macro-expansion | ||
) | ||
endif() | ||
endif() | ||
|
||
if (ENABLE_WARNING_ERROR) | ||
list(APPEND COMMON_COMPILER_FLAGS -Werror) | ||
endif() | ||
|
||
list(APPEND COMMON_COMPILER_FLAGS | ||
-fno-omit-frame-pointer | ||
-Wredundant-decls | ||
) | ||
|
||
include(ExportAllSymbols) | ||
include(CompilerSanitizerOptions) | ||
|
||
if (CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID MATCHES "GNU") | ||
add_compile_options($<$<NOT:$<CONFIG:Debug>>:-fdebug-prefix-map=${CMAKE_SOURCE_DIR}=.>) | ||
add_compile_options($<$<NOT:$<CONFIG:Debug>>:-fmacro-prefix-map=${CMAKE_SOURCE_DIR}=.>) | ||
add_compile_options($<$<NOT:$<CONFIG:Debug>>:-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.>) | ||
add_compile_options($<$<NOT:$<CONFIG:Debug>>:-fdebug-prefix-map=${CMAKE_BINARY_DIR}=./build>) | ||
add_compile_options($<$<NOT:$<CONFIG:Debug>>:-fmacro-prefix-map=${CMAKE_BINARY_DIR}=./build>) | ||
add_compile_options($<$<NOT:$<CONFIG:Debug>>:-ffile-prefix-map=${CMAKE_BINARY_DIR}=./build>) | ||
endif() | ||
|
||
|
Oops, something went wrong.