Files
o3de/cmake/Platform/Linux/Configurations_linux.cmake
T
Steve Pham 0f9c369d7c Fix Clang built executables so they can be launched from the file explorer (#7562)
* Remove Position Independent Executable link flags from EXEs

Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com>
2022-02-14 10:30:00 -08:00

69 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
-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")