From 71b303d883f6cea37d256caadeea1c46a0045df2 Mon Sep 17 00:00:00 2001 From: Davis King Date: Sat, 27 Jun 2020 20:08:39 -0400 Subject: [PATCH] Improve the error a user gets when trying to build the pyhton extention on windows but they didn't install visual C++. --- tools/python/CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/python/CMakeLists.txt b/tools/python/CMakeLists.txt index 7b31f98f2..0b68f53e4 100644 --- a/tools/python/CMakeLists.txt +++ b/tools/python/CMakeLists.txt @@ -1,5 +1,16 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12) + +if (WIN32 AND NOT "${CMAKE_GENERATOR}" MATCHES "Visual Studio") + message(FATAL_ERROR "\n" + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" + "You must use Visual Studio to build a python extension on windows. If you " + "are getting this error it means you have not installed Visual C++. Note that " + "there are many flavors of Visual Studio, like Visual Studio for C\# development. " + "You need to install Visual Studio for C++. \n" + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n") +endif() + project(dlib_python_bindings) # Pybind11's cmake scripts enable link time optimization by default. However,