Use native instruction set on build system

CMake files are in general not portable between systems anyway, so we
may as well take full advantage of the native instruction set.

There must be a companion option to switch this off in case anyone
wants to build a package for distribution.
This commit is contained in:
Roland Kaufmann 2012-12-12 10:13:09 +01:00
parent 31fae50628
commit 7976b95983

View File

@ -23,6 +23,15 @@ if (CMAKE_COMPILER_IS_GNUCXX)
list (APPEND _opt_flags "-flto")
endif (HAVE_LINK_OPTS)
# native instruction set tuning
option (WITH_NATIVE "Use native instruction set" ON)
if (WITH_NATIVE)
check_cxx_accepts_flag ("-mtune=native" HAVE_MTUNE)
if (HAVE_MTUNE)
list (APPEND _opt_flags "-mtune=native")
endif (HAVE_MTUNE)
endif (WITH_NATIVE)
# use these options for release builds - full optimization
add_options (
ALL_LANGUAGES