mirror of
https://github.com/reactos/reactos.git
synced 2025-04-21 12:40:33 +00:00
[CMAKE/MSVC] Enable function level linking and comdat folding independent from build type. This reduces freeldr size and allows to build with /RTC1 again. Since GCC doesn't support function level linking, cmlib should be refactored by moving some functions into different source files to avoid linking unused code into freeldr.
svn path=/trunk/; revision=71066
This commit is contained in:
parent
920ada6ae0
commit
92100df1fc
1 changed files with 5 additions and 1 deletions
|
@ -6,7 +6,6 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|||
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
add_compile_flags("/Ox /Ob2 /Ot /Oy /GT /GF")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /OPT:REF /OPT:ICF")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:REF /OPT:ICF")
|
||||
elseif(OPTIMIZE STREQUAL "1")
|
||||
add_definitions(/O1)
|
||||
elseif(OPTIMIZE STREQUAL "2")
|
||||
|
@ -19,6 +18,11 @@ elseif(OPTIMIZE STREQUAL "5")
|
|||
add_definitions(/GF /Gy /Ob2 /Os /Ox /GS-)
|
||||
endif()
|
||||
|
||||
# Enable function level linking and comdat folding
|
||||
add_compile_flags("/Gy")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:REF /OPT:ICF")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /OPT:REF /OPT:ICF")
|
||||
|
||||
if(ARCH STREQUAL "i386")
|
||||
add_definitions(/DWIN32 /D_WINDOWS)
|
||||
endif()
|
||||
|
|
Loading…
Reference in a new issue