title: How to set CMAKE_TOOLCHAIN_FILE for when the project is created on windows only
body: <p>I am trying to use vcpkg for Windows build when the CMake is also used for Linux build. The Linux build doesn't use vcpkg.</p>
  
  <p>This is part of CMake that works on windows:</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.5)
  file(TO_CMAKE_PATH $ENV{LOCAL_ROOT} LOCAL_ROOT)
  set(VCPKG_ROOT "${LOCAL_ROOT}/vcpkg-master")
  set(CMAKE_TOOLCHAIN_FILE "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "")
  set(VCPKG_TARGET_TRIPLET "x64-windows-static" CACHE STRING "")
  OPTION(USE_BOOST "use BOOST library" ON)
  OPTION(CREATE_DLL "Create DLL or .so library" OFF)
  OPTION(READ_GIT_HASH "read git sha1 hash for versioning" OFF)
  project(ExtractOnctData)
  if(MSVC)
     add_definitions (-D_USE_MATH_DEFINES)
     add_definitions (-DNOMINMAX)
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP ")
      set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}  /MTd" )
      set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Ot /openmp /MT" )
  else(MSVC)
      #Use C++11
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
      #Find and use standard libraries
      find_package(Threads REQUIRED)
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
  endif(MSVC)
  </code></pre>
  
  <p>but it breaks Linux build as the three vcpkg settings which not used in Linux build added to CMake.</p>
  
  <p>If I do this:</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.5)
  if(MSVC)
      file(TO_CMAKE_PATH $ENV{LOCAL_ROOT} LOCAL_ROOT)
      set(VCPKG_ROOT "${LOCAL_ROOT}/vcpkg-master")
      set(CMAKE_TOOLCHAIN_FILE "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "")
      set(VCPKG_TARGET_TRIPLET "x64-windows-static" CACHE STRING "")
  endif(MSVC)
  OPTION(USE_BOOST "use BOOST library" ON)
  OPTION(CREATE_DLL "Create DLL or .so library" OFF)
  OPTION(READ_GIT_HASH "read git sha1 hash for versioning" OFF)
  project(ExtractOnctData)
  if(MSVC)
     add_definitions (-D_USE_MATH_DEFINES)
     add_definitions (-DNOMINMAX)
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP ")
      set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}  /MTd" )
      set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Ot /openmp /MT" )
  else(MSVC)
      #Use C++11
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
      #Find and use standard libraries
      find_package(Threads REQUIRED)
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
  endif(MSVC)
  </code></pre>
  
  <p>Then it doesn't work in Windows.</p>
  
  <p>If I do this:</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.5)
  OPTION(USE_BOOST "use BOOST library" ON)
  OPTION(CREATE_DLL "Create DLL or .so library" OFF)
  OPTION(READ_GIT_HASH "read git sha1 hash for versioning" OFF)
  project(ExtractOnctData)
  if(MSVC)
      file(TO_CMAKE_PATH $ENV{LOCAL_ROOT} LOCAL_ROOT)
      set(VCPKG_ROOT "${LOCAL_ROOT}/vcpkg-master")
      set(CMAKE_TOOLCHAIN_FILE "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "")
      set(VCPKG_TARGET_TRIPLET "x64-windows-static" CACHE STRING "")
  endif(MSVC)
  if(MSVC)
     add_definitions (-D_USE_MATH_DEFINES)
     add_definitions (-DNOMINMAX)
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP ")
      set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}  /MTd" )
      set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Ot /openmp /MT" )
  else(MSVC)
      #Use C++11
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
      #Find and use standard libraries
      find_package(Threads REQUIRED)
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
  endif(MSVC)
  </code></pre>
  
  <p>It doesn't work in windows. </p>
  
  <p>How Can I fix this problem?</p>