From c350cec965dd316f8515a8e2b619cb4da12f8825 Mon Sep 17 00:00:00 2001 From: Marcus Asteborg Date: Mon, 27 Apr 2020 08:52:57 -0700 Subject: cmake - move all compiler feature detection to OpusConfig Signed-off-by: Mark Harris --- cmake/OpusConfig.cmake | 10 ++++++++++ cmake/OpusFunctions.cmake | 8 -------- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'cmake') diff --git a/cmake/OpusConfig.cmake b/cmake/OpusConfig.cmake index 1d0dcccd..1b40fbf1 100644 --- a/cmake/OpusConfig.cmake +++ b/cmake/OpusConfig.cmake @@ -66,3 +66,13 @@ elseif(OPUS_CPU_ARM) endif() endif() endif() + +if(MSVC) + check_flag(FAST_MATH /fp:fast) + check_flag(STACK_PROTECTOR /GS) + check_flag(STACK_PROTECTOR_DISABLED /GS-) +else() + check_flag(FAST_MATH -ffast-math) + check_flag(STACK_PROTECTOR -fstack-protector-strong) + check_flag(HIDDEN_VISIBILITY -fvisibility=hidden) +endif() diff --git a/cmake/OpusFunctions.cmake b/cmake/OpusFunctions.cmake index f0da3822..2eb83f4e 100644 --- a/cmake/OpusFunctions.cmake +++ b/cmake/OpusFunctions.cmake @@ -92,14 +92,6 @@ function(get_package_version PACKAGE_VERSION) set(PACKAGE_VERSION 0 PARENT_SCOPE) endfunction() -function(check_and_set_flag NAME FLAG) - include(CheckCCompilerFlag) - check_c_compiler_flag(${FLAG} ${NAME}_SUPPORTED) - if(${NAME}_SUPPORTED) - add_definitions(${FLAG}) - endif() -endfunction() - function(check_flag NAME FLAG) include(CheckCCompilerFlag) check_c_compiler_flag(${FLAG} ${NAME}_SUPPORTED) -- cgit v1.2.3