summaryrefslogtreecommitdiff
path: root/indra/cmake
diff options
context:
space:
mode:
authorNicky Dasmijn <nicky.dasmijn@posteo.nl>2024-04-12 14:15:01 +0200
committerGitHub <noreply@github.com>2024-04-12 15:15:01 +0300
commit33c7b9701de1589e8e3875656a6bab4f8710e7a8 (patch)
tree0c28697329fd7aefe1bc3c45b11f2205010016d4 /indra/cmake
parenta0f282643f26789ef7e1b624398581cceafc257c (diff)
Chore/cmake pretty up (#1205)
* - Add an option to with ASAN - Fix GCC -Werror option. * - find_program should not set REQUIRED if per logic a fallback to ld.bfd is fine - cmake idiomatic is to test Variables without dereferencing them * Add -Wno-unknown-warning-option for clang or it will complain about some GCC only options ``` /home/runner/work/viewer/viewer/indra/llcommon/llsdutil.cpp:39:32: error: unknown warning group '-Wstringop-truncation', ignored [-Werror,-Wunknown-warning-option] #pragma GCC diagnostic ignored "-Wstringop-truncation" // It's actually okay what happens here ```
Diffstat (limited to 'indra/cmake')
-rw-r--r--indra/cmake/00-Common.cmake14
-rw-r--r--indra/cmake/Linker.cmake4
2 files changed, 14 insertions, 4 deletions
diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index 21242a32be..d90a34bb6b 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -124,11 +124,20 @@ if (LINUX)
add_compile_definitions(
_REENTRANT
- _FORTIFY_SOURCE=2
APPID=secondlife
LL_IGNORE_SIGCHLD
)
+ if( ENABLE_ASAN )
+ add_compile_options(-U_FORTIFY_SOURCE
+ -fsanitize=address
+ --param asan-stack=0
+ )
+ add_link_options(-fsanitize=address)
+ else()
+ add_compile_definitions( _FORTIFY_SOURCE=2 )
+ endif()
+
add_compile_options(
-fexceptions
-fno-math-errno
@@ -150,6 +159,7 @@ if (LINUX)
set(CLANG_WARNINGS
${GCC_CLANG_COMPATIBLE_WARNINGS}
# Put clang specific warning configuration here
+ -Wno-unknown-warning-option
)
set(GCC_WARNINGS
@@ -165,7 +175,7 @@ if (LINUX)
-Wl,--no-undefined
)
if (NOT GCC_DISABLE_FATAL_WARNINGS)
- list(APPEND GCC_WARNINGS -Werror)
+ add_compile_options( -Werror )
endif (NOT GCC_DISABLE_FATAL_WARNINGS)
# this stops us requiring a really recent glibc at runtime
diff --git a/indra/cmake/Linker.cmake b/indra/cmake/Linker.cmake
index 292aa25c57..8016842192 100644
--- a/indra/cmake/Linker.cmake
+++ b/indra/cmake/Linker.cmake
@@ -1,7 +1,7 @@
include_guard(GLOBAL)
-if (${LINK_WITH_MOLD})
- find_program(MOLD_BIN mold REQUIRED)
+if( LINK_WITH_MOLD )
+ find_program(MOLD_BIN mold)
if(MOLD_BIN)
message(STATUS "Mold linker found: ${MOLD_BIN}. Enabling mold as active linker.")
add_link_options("-fuse-ld=${MOLD_BIN}")