From ab8b2f5263a572a3354fb7f8e194e1c9c4a87434 Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco-Claraco Date: Sun, 2 Jun 2019 11:32:38 +0200 Subject: [PATCH] -march=native is not for MSVC --- cmake/GtsamBuildTypes.cmake | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmake/GtsamBuildTypes.cmake b/cmake/GtsamBuildTypes.cmake index b80765298..0c9a34da1 100644 --- a/cmake/GtsamBuildTypes.cmake +++ b/cmake/GtsamBuildTypes.cmake @@ -90,10 +90,12 @@ if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") endif() endif() -option(GTSAM_BUILD_WITH_MARCH_NATIVE "Enable/Disable building with all instructions supported by native architecture (binary may not be portable!)" ON) -if(GTSAM_BUILD_WITH_MARCH_NATIVE) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") +if (NOT MSVC) + option(GTSAM_BUILD_WITH_MARCH_NATIVE "Enable/Disable building with all instructions supported by native architecture (binary may not be portable!)" ON) + if(GTSAM_BUILD_WITH_MARCH_NATIVE) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") + endif() endif() # Set up build type library postfixes