summaryrefslogtreecommitdiff
path: root/indra/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'indra/cmake')
-rw-r--r--indra/cmake/00-Common.cmake54
-rw-r--r--indra/cmake/Linker.cmake11
2 files changed, 45 insertions, 20 deletions
diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index d46ebc4960..21242a32be 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -15,6 +15,7 @@
include_guard()
include(Variables)
+include(Linker)
# We go to some trouble to set LL_BUILD to the set of relevant compiler flags.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} $ENV{LL_BUILD}")
@@ -127,23 +128,37 @@ if (LINUX)
APPID=secondlife
LL_IGNORE_SIGCHLD
)
+
add_compile_options(
- -fexceptions
- -fno-math-errno
- -fno-strict-aliasing
- -fsigned-char
- -msse2
- -mfpmath=sse
- -pthread
- -Wno-parentheses
- -Wno-deprecated
- -Wno-c++20-compat
- -Wno-pessimizing-move
- -Wno-stringop-overflow
- -Wno-stringop-truncation
- -Wno-dangling-pointer
- -fvisibility=hidden
+ -fexceptions
+ -fno-math-errno
+ -fno-strict-aliasing
+ -fsigned-char
+ -msse2
+ -mfpmath=sse
+ -pthread
+ -fvisibility=hidden
+ )
+
+ set(GCC_CLANG_COMPATIBLE_WARNINGS
+ -Wno-parentheses
+ -Wno-deprecated
+ -Wno-c++20-compat
+ -Wno-pessimizing-move
+ )
+
+ set(CLANG_WARNINGS
+ ${GCC_CLANG_COMPATIBLE_WARNINGS}
+ # Put clang specific warning configuration here
)
+
+ set(GCC_WARNINGS
+ ${GCC_CLANG_COMPATIBLE_WARNINGS}
+ -Wno-stringop-overflow
+ -Wno-stringop-truncation
+ -Wno-dangling-pointer
+ )
+
add_link_options(
-Wl,--no-keep-memory
-Wl,--build-id
@@ -156,12 +171,15 @@ if (LINUX)
# this stops us requiring a really recent glibc at runtime
add_compile_options(-fno-stack-protector)
- # ND: clang is a bit more picky than GCC, the latter seems to auto include -lstdc++ and -lm. The former not so and thus fails to link
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ # ND: clang is a bit more picky than GCC, the latter seems to auto include -lstdc++ and -lm. The former not so and thus fails to link
add_link_options(
-lstdc++
-lm
)
+ add_compile_options(${CLANG_WARNINGS})
+ else()
+ add_compile_options(${GCC_WARNINGS})
endif()
endif (LINUX)
@@ -191,10 +209,6 @@ if (DARWIN)
list(APPEND GCC_WARNINGS -Wno-reorder -Wno-non-virtual-dtor )
- if(LINUX)
- list(APPEND GCC_WARNINGS -Wno-maybe-uninitialized -Wno-dangling-pointer )
- endif()
-
add_compile_options(${GCC_WARNINGS})
add_compile_options(-m${ADDRESS_SIZE})
endif ()
diff --git a/indra/cmake/Linker.cmake b/indra/cmake/Linker.cmake
new file mode 100644
index 0000000000..292aa25c57
--- /dev/null
+++ b/indra/cmake/Linker.cmake
@@ -0,0 +1,11 @@
+include_guard(GLOBAL)
+
+if (${LINK_WITH_MOLD})
+ find_program(MOLD_BIN mold REQUIRED)
+ if(MOLD_BIN)
+ message(STATUS "Mold linker found: ${MOLD_BIN}. Enabling mold as active linker.")
+ add_link_options("-fuse-ld=${MOLD_BIN}")
+ else()
+ message(STATUS "Mold linker not found. Using default linker.")
+ endif()
+endif()