Skip to content

Commit 80b92e9

Browse files
CMake: made /GL MSVC compile switch optional (close #620)
It can be disabled by specifying the DILIGENT_MSVC_RELEASE_COMPILE_OPTIONS CMake variable
1 parent fed9573 commit 80b92e9

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,11 +390,13 @@ if(MSVC)
390390

391391
set(DILIGENT_MSVC_DEBUG_COMPILE_OPTIONS "" CACHE STRING "Additional MSVC compile options for debug configuration")
392392

393+
# Enable whole program optimization
394+
set(DEFAULT_DILIGENT_MSVC_RELEASE_COMPILE_OPTIONS /GL)
393395
if("${TARGET_CPU}" STREQUAL "x86_64")
394396
# Enable AVX2
395-
set(DILIGENT_MSVC_RELEASE_COMPILE_OPTIONS "/arch:AVX2")
397+
set(DEFAULT_DILIGENT_MSVC_RELEASE_COMPILE_OPTIONS ${DEFAULT_DILIGENT_MSVC_RELEASE_COMPILE_OPTIONS} /arch:AVX2)
396398
endif()
397-
set(DILIGENT_MSVC_RELEASE_COMPILE_OPTIONS ${DILIGENT_MSVC_RELEASE_COMPILE_OPTIONS} CACHE STRING "Additional MSVC compile options for release configurations")
399+
set(DILIGENT_MSVC_RELEASE_COMPILE_OPTIONS ${DEFAULT_DILIGENT_MSVC_RELEASE_COMPILE_OPTIONS} CACHE STRING "Additional MSVC compile options for release configurations")
398400

399401
# Enable level 4 warnings, but disable
400402
# - w4100 - unreferenced formal parameter
@@ -412,9 +414,8 @@ if(MSVC)
412414
# In all release modes also:
413415
# - disable w4189 - local variable is initialized but not referenced
414416
# - Disable RTTI (/GR-)
415-
# - Enable whole program optimization (/GL)
416417
# - Enable string pooling (/GF)
417-
set(MSVC_ALL_RELEASE_COMPILE_OPTIONS /wd4189 /GR- /GL /GF)
418+
set(MSVC_ALL_RELEASE_COMPILE_OPTIONS /wd4189 /GR- /GF)
418419
#target_compile_options(Diligent-BuildSettings INTERFACE "$<$<CONFIG:RELEASE>:/wd4189 /Ot")
419420
# In RELEASE mode:
420421
# - Set favor fast code option (/Ot)

0 commit comments

Comments
 (0)