From da11220762b9ad05d15c505f0877230d75e27a18 Mon Sep 17 00:00:00 2001 From: Raymonf Date: Thu, 20 Aug 2020 18:44:30 -0400 Subject: [PATCH] Allow opening CMakeLists as a CMake project in VS Added another check just in case someone wants to do this for some reason. It's bad. You shouldn't do it. --- .gitignore | 5 +++-- CMakeLists.txt | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index ad152dc..9e87793 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -.vscode +.vscode/ bin/* notes.txt config.ini @@ -7,4 +7,5 @@ tags *~ CMakeFiles/ CMakeCache.txt -build/ \ No newline at end of file +build/ +.vs/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index b6a8c69..fc5fcda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,9 @@ add_executable(openfusion ${SOURCES}) set_target_properties(openfusion PROPERTIES OUTPUT_NAME ${BIN_NAME}) # Use pthreads if not generating a VS solution or MinGW makefile (because MinGW will prefer Win32 threads) -if (NOT CMAKE_GENERATOR MATCHES "Visual Studio" AND NOT CMAKE_GENERATOR MATCHES "MinGW Makefiles") +# Checking if the compiler ID is MSVC will allow us to open the project as a CMake project in VS. +# It's not something you should do, but it's there if you need it... +if (NOT CMAKE_GENERATOR MATCHES "Visual Studio" AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND NOT CMAKE_GENERATOR MATCHES "MinGW Makefiles") find_package(Threads REQUIRED) target_link_libraries(openfusion pthread) endif() \ No newline at end of file