From f53f547dc3b5b7474fd6bb11d8d3d8e572279b52 Mon Sep 17 00:00:00 2001 From: Hleb Valoshka <375gnu@gmail.com> Date: Tue, 13 Aug 2019 09:45:08 +0300 Subject: [PATCH] Refactor compiler options definition --- CMakeLists.txt | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ab1de0b8..a43d6630 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,13 +39,21 @@ endif() set(CMAKE_INCLUDE_CURRENT_DIR ON) -if(NOT MSVC) +if(NOT WIN32) # Qt requires -fPIC, so build all code with it + # It's always set on windows add_compile_options(-fPIC) - if(FAST_MATH) +endif() + +if(FAST_MATH) + if(NOT MSVC) add_compile_options("-ffast-math") + else() + add_compile_options("/fp:fast") endif() -else() +endif() + +if(MSVC) # Disabled warnings # C4244, C4267, C4503: implicit type conversion to a smaller type # C4786: long names in templates @@ -53,9 +61,6 @@ else() # Additional options # bigobj: generate more object sections than allowed by default add_compile_options("/wd4244" "/wd4267" "/wd4503" "/wd4800" "/bigobj") - if(FAST_MATH) - add_compile_options("/fp:fast") - endif() endif() if(UNIX AND (NOT APPLE) AND (NOT CYGWIN))