From 82f23e556e578d512febec5cd61a74751df79644 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 16 Jun 2018 13:03:23 +0100 Subject: [PATCH] Improve MSVC project generation - set startup project to fgfs - guess a value for PATH based on the build config --- CMakeLists.txt | 4 ++++ src/Main/CMakeLists.txt | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 06e5ed954..8913aafbc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -584,6 +584,10 @@ add_subdirectory(man) add_subdirectory(package) add_subdirectory(scripts) +#---------------------------------------------------------------------------- +### MSVC startup project - ensure you can just hit build & run in MSVC +set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT fgfs) + #----------------------------------------------------------------------------- ### uninstall target #----------------------------------------------------------------------------- diff --git a/src/Main/CMakeLists.txt b/src/Main/CMakeLists.txt index 243468c52..cbd8fe839 100644 --- a/src/Main/CMakeLists.txt +++ b/src/Main/CMakeLists.txt @@ -112,3 +112,18 @@ endif() if (COMMAND flightgear_test) flightgear_test(autosaveMigration test_autosaveMigration.cxx) endif() + +if (MSVC) + if (TARGET Qt5::qmake) + # property is the full path to qmake.exe + get_target_property(_qt5_qmake_path Qt5::qmake LOCATION) + get_filename_component(_qt5_bin_dir ${_qt5_qmake_path} DIRECTORY) + file(TO_NATIVE_PATH "${_qt5_bin_dir}" _qt5_bin_dir_native) + endif() + + file(TO_NATIVE_PATH "${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/bin" _msvc_3rdparty_bin_dir) + file(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}" _install_bin_dir) + + set_property(TARGET fgfs PROPERTY + VS_GLOBAL_LocalDebuggerEnvironment "PATH=${_install_bin_dir};${_msvc_3rdparty_bin_dir};${_qt5_bin_dir_native}") +endif()