diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f1219f0577..a6d8c99a86b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,6 +162,7 @@ option(ENABLE_STRICT_COMPILATION "Sets the strict compilation mode" OFF) option(ENABLE_PEDANTIC_COMPILATION "Sets the pedantic compilation mode" OFF) option(ENABLE_DEBUG_WINDOW_LAYOUT "Add the debug option to allow the generation of debug layout files in dot format" OFF) option(ENABLE_DESIGN_DOCUMENTS "Enables the generation of design documents, and has additional dependencies" OFF) +option(ENABLE_LTO "Sets Link Time Optimization" OFF) #misc options if(NOT MSVC) @@ -529,7 +530,7 @@ if(WIN32 AND NOT ARCH) endif(WIN32 AND NOT ARCH) # if compiling with LTO -if("${ENABLE_LTO}" STREQUAL "yes") +if(ENABLE_LTO) # clang and gcc require different parallelization options and linkers if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") MESSAGE("added -flto=thin to Release build") @@ -538,7 +539,7 @@ if("${ENABLE_LTO}" STREQUAL "yes") MESSAGE("Using Clang LLD linker") set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s -fuse-ld=lld" CACHE STRING "Linker flag for building with LTO and clang" FORCE) - elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if(NOT LTO_JOBS) MESSAGE("LTO_JOBS not set, defaulting to 1") set(LTO_JOBS "1" CACHE STRING "Number of threads to use for LTO with gcc" FORCE) diff --git a/SConstruct b/SConstruct index 3e0da855564..a90de25147f 100755 --- a/SConstruct +++ b/SConstruct @@ -47,7 +47,7 @@ def OptionalPath(key, val, env): opts.AddVariables( ListVariable('default_targets', 'Targets that will be built if no target is specified in command line.', "wesnoth,wesnothd", Split("wesnoth wesnothd campaignd test")), - EnumVariable('build', 'Build variant: debug, release profile or base (no subdirectory)', "release", ["release", "debug", "glibcxx_debug", "profile", "base"]), + EnumVariable('build', 'Build variant: debug, release, profile or base (no subdirectory)', "release", ["release", "debug", "glibcxx_debug", "profile", "base"]), PathVariable('build_dir', 'Build all intermediate files(objects, test programs, etc) under this dir', "build", PathVariable.PathAccept), ('extra_flags_config', "Extra compiler and linker flags to use for configuration and all builds. Whether they're compiler or linker is determined by env.ParseFlags. Unknown flags are compile flags by default. This applies to all extra_flags_* variables", ""), ('extra_flags_base', 'Extra compiler and linker flags to use for release builds', ""),