Remove Twitter links.
[SquirrelJME.git] / nanocoat / cmake / hardening.cmake
blob584c2e34615d92f7e9ab14934b93f0932e8c414a
1 # ---------------------------------------------------------------------------
2 # SquirrelJME
3 #     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
4 # ---------------------------------------------------------------------------
5 # SquirrelJME is under the Mozilla Public License Version 2.0.
6 # See license.mkd for licensing and copyright information.
7 # ---------------------------------------------------------------------------
8 # DESCRIPTION: Various hardening options.
10 # For RetroArch disable specific features so they cannot be used
11 if(SQUIRRELJME_IS_LIBRETRO)
12         # Disable dynamic library support, we do not want to allow loading
13         # native libraries of any kind
14         add_compile_definitions(SJME_CONFIG_HAS_NO_DYLIB_SUPPORT=1)
16         # Disable ScritchUI dynamic libraries
17         add_compile_definitions(SJME_CONFIG_SCRITCHUI_NO_DYLIB=1)
18         set(SQUIRRELJME_SCRITCHUI_NO_DYLIB ON)
19 endif()
21 # Strip output executable
22 if(SQUIRRELJME_IS_RELEASE)
23         if(CMAKE_COMPILER_IS_GNUCC OR
24                 CMAKE_COMPILER_IS_GNUCXX OR
25                 CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
26                 CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
27                 macro(squirreljme_executable_strip target)
28                         add_custom_command(TARGET ${target} POST_BUILD
29                                 DEPENDS ${target}
30                                 COMMAND "${CMAKE_STRIP}"
31                                 ARGS --strip-unneeded $<TARGET_FILE:${target}>)
32                 endmacro()
33         elseif(MSVC OR
34                 CMAKE_C_COMPILER_ID STREQUAL "MSVC" OR
35                 CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
36                 macro(squirreljme_executable_strip target)
37                         target_link_options(${target}
38                                 "/PDBSTRIPPED"
39                                 "/DEBUG:NONE")
40                 endmacro()
41         else()
42                 macro(squirreljme_executable_strip target)
43                 endmacro()
44         endif()
45 else()
46         macro(squirreljme_executable_strip target)
47         endmacro()
48 endif()