From d5fa482cf0c8fda663df32e016da32d7745e4eb0 Mon Sep 17 00:00:00 2001 From: Pascal Palenda <pascal.palenda@akustik.rwth-aachen.de> Date: Tue, 17 Sep 2024 15:50:50 +0200 Subject: [PATCH] Feat: setup vc environment during configuration This would allow us to build using ninja from the command line. This is currently not possible as CMake cannot find `cl` when building from a "normal" shell. The vcvarsall script would have to be called before. This is very inconvenient. With this change the vc environment would be setup during configuration. However, as discussed [here](https://github.com/MarkSchofield/WindowsToolchain/issues/58) this does not work correctly yet. --- src/Index.cmake | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Index.cmake b/src/Index.cmake index 4397d2c..c82bf0f 100644 --- a/src/Index.cmake +++ b/src/Index.cmake @@ -48,3 +48,18 @@ macro (find_package) # message (FATAL_ERROR "Package ${ARGV0} found as a Target; skip find_package") # endif () endmacro () + +CPMAddPackage ( + NAME project_options + GITHUB_REPOSITORY aminya/project_options + VERSION 0.36.4 + DOWNLOAD_ONLY YES +) + +include (${project_options_SOURCE_DIR}/src/VCEnvironment.cmake) + +if ("${CMAKE_TOOLCHAIN_FILE}" STREQUAL "") + msvc_toolchain () +else () + message (STATUS "project_options: skipping msvc_toolchain as CMAKE_TOOLCHAIN_FILE is set") +endif () -- GitLab