4d4f10beb8
- Add the following compilation flags for clang -fpie -fstack-protector-all -fstack-check (non-release) - Add the following compilation flags for gcc -fpie -fstack-protector-all - Fix -Wunused-result errors from above compilation flag updates - Add _FORTIFY_SOURCE=2 to GCC DEFINES Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com>
70 lines
1.6 KiB
CMake
70 lines
1.6 KiB
CMake
#
|
|
# Copyright (c) Contributors to the Open 3D Engine Project.
|
|
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
#
|
|
#
|
|
|
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
|
|
|
include(cmake/Platform/Common/Clang/Configurations_clang.cmake)
|
|
|
|
ly_append_configurations_options(
|
|
DEFINES
|
|
LINUX
|
|
__linux__
|
|
LINUX64
|
|
COMPILATION
|
|
-fPIC
|
|
-msse4.1
|
|
LINK_NON_STATIC
|
|
-Wl,-undefined,error
|
|
-fpie
|
|
-Wl,-z,relro,-z,now
|
|
-Wl,-z,noexecstack
|
|
LINK_EXE
|
|
-pie
|
|
-fpie
|
|
-Wl,-z,relro,-z,now
|
|
-Wl,-z,noexecstack
|
|
)
|
|
|
|
ly_set(CMAKE_CXX_EXTENSIONS OFF)
|
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
|
|
include(cmake/Platform/Common/GCC/Configurations_gcc.cmake)
|
|
|
|
if(LY_GCC_BUILD_FOR_GCOV)
|
|
set(LY_GCC_GCOV_LFLAGS "-lgcov")
|
|
endif()
|
|
if(LY_GCC_BUILD_FOR_GPROF)
|
|
set(LY_GCC_GPROF_LFLAGS "-pg")
|
|
endif()
|
|
|
|
ly_append_configurations_options(
|
|
DEFINES
|
|
LINUX
|
|
__linux__
|
|
LINUX64
|
|
COMPILATION
|
|
-fPIC
|
|
-msse4.1
|
|
LINK_NON_STATIC
|
|
${LY_GCC_GCOV_LFLAGS}
|
|
${LY_GCC_GPROF_LFLAGS}
|
|
-Wl,--no-undefined
|
|
-lpthread
|
|
)
|
|
ly_set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Compiler ${CMAKE_CXX_COMPILER_ID} not supported in ${PAL_PLATFORM_NAME}")
|
|
|
|
endif()
|
|
|
|
ly_set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
|
ly_set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
|
|
ly_set(CMAKE_INSTALL_RPATH "$ORIGIN")
|