Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: build hardened dll game with sub cmake to use different compilation flags #1484

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ option(USE_STATIC_LIBS "Tries to use static libs where possible. Only works for

# Game VM modules are built with a recursive invocation of CMake, by which all the configuration
# options are lost, except ones we explicitly choose to pass.
set(DEFAULT_NACL_VM_INHERITED_OPTIONS
set(DEFAULT_VMS_INHERITED_OPTIONS
BE_VERBOSE
BUILD_CGAME
BUILD_SGAME
Expand All @@ -160,15 +160,16 @@ set(DEFAULT_NACL_VM_INHERITED_OPTIONS
USE_COMPILER_INTRINSICS
USE_DEBUG_OPTIMIZE
USE_HARDENING
USE_LTO
USE_PEDANTIC
USE_PRECOMPILED_HEADER
USE_RECOMMENDED_C_STANDARD
USE_RECOMMENDED_CXX_STANDARD
USE_WERROR
)
set(NACL_VM_INHERITED_OPTIONS "${DEFAULT_NACL_VM_INHERITED_OPTIONS}" CACHE STRING
"Semicolon-separated list of options for which NaCl game VMs should use the same value as the other binaries")
mark_as_advanced(NACL_VM_INHERITED_OPTIONS)
set(VMS_INHERITED_OPTIONS "${DEFAULT_VMS_INHERITED_OPTIONS}" CACHE STRING
"Semicolon-separated list of options for which game VMs should use the same value as the other binaries")
mark_as_advanced(VMS_INHERITED_OPTIONS)

################################################################################
# Directories
Expand Down
12 changes: 9 additions & 3 deletions cmake/DaemonFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,15 @@ else()
try_c_cxx_flag(WSTACK_PROTECTOR "-Wstack-protector")

if (NOT NACL OR (NACL AND GAME_PIE))
try_c_cxx_flag(FPIE "-fPIE")
if (NOT APPLE)
try_linker_flag(LINKER_PIE "-pie")
if (FORK EQUAL 2 AND BUILD_GAME_NATIVE_DLL)
try_c_cxx_flag(FPIC "-fPIC")
try_linker_flag(LINKER_PIC "-pic")
else()
try_c_cxx_flag(FPIE "-fPIE")

if (NOT APPLE)
try_linker_flag(LINKER_PIE "-pie")
endif()
endif()
endif()

Expand Down
Loading
Loading