title: Visual Studio not recognizing __AVX2__ or __AVX__
body: <p>I'm implementing a simple SIMD wrapper in C++.
  To make it cross-platform, I use CMake to set-up the project with Visual Studio</p>
  
  <p>I've added /Arch:AVX2, but Visual Studio does not recognize <code>__AVX2__</code> Macro.</p>
  
  <p>First, my CMake.</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.12.2)
  
  set(INCLUDEDIR "include/Maths")
  set(SOURCEDIR "src")
  
  set(HEADER_FILES
      ${INCLUDEDIR}/export.h 
      ${INCLUDEDIR}/SIMDWrapper/Config/SIMDConfig.h)
  
  set(SOURCE_FILES 
      ${SOURCEDIR}/Application.cpp)
  
  
  add_library(Maths SHARED ${SOURCE_FILES}  ${HEADER_FILES})
  target_link_libraries(Maths PUBLIC Core)
  target_include_directories(Maths PUBLIC "include")
  target_compile_options(Maths PRIVATE $&lt;$&lt;BOOL:${MSVC}&gt;:/arch:AVX2&gt;)
  target_compile_definitions(Maths PRIVATE MATHS_EXPORT)
  </code></pre>
  
  <p>And my Header File (from Agner Fog's VectorClass <a href="https://github.com/darealshinji/vectorclass/blob/master/instrset.h" rel="nofollow noreferrer"><code>instrset.h</code></a>):</p>
  
  <pre><code>#pragma once
  #if (defined(_M_AMD64) || defined(_M_X64) || defined(__amd64)) &amp;&amp; ! 
      defined(__x86_64__)
  #define __x86_64__ 1
  #endif
  
  
  #ifndef SIMD_INSTR_SET
  #if defined (__AVX2__)
      #define SIMD_INSTR_SET 8
  #elif defined ( __AVX__ )
      #define SIMD_INSTR_SET 7
  #elif defined ( __SSE4_2__ )
      #define SIMD_INSTR_SET 6
  #elif defined ( __SSE4_1__ )
      #define SIMD_INSTR_SET 5
  #elif defined ( __SSSE3__ )
      #define SIMD_INSTR_SET 4
  #elif defined ( __SSE3__ )
      #define SIMD_INSTR_SET 3
  #elif defined ( __SSE2__ ) || defined ( __x86_64__ )
      #define SIMD_INSTR_SET 2 //this is where the color has changed
  #elif defined ( __SSE__ )
      #define SIMD_INSTR_SET 1
  #elif defined ( _M_IX86_FP )    
     #define SIMD_INSTR_SET _M_IX86_FP
  #else
     #define SIMD_INSTR_SET 0
  #endif // instruction set defines
  #endif // SIMD_INSTR_SET
  </code></pre>
  
  <p>This is what I did.
  <code>__x86_64__</code> is defined, my CPU is i5 Skylake so it should support AVX2.</p>
  
  <p>I've checked if Advanced Vector Extensions 2 option is enabled from Project Configuration Properties, and it is enabled.</p>
  
  <p>Is there something I need to change/add from CMake or Visual Studio to make the AVX2 Macro recognizable? </p>