Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not activate the MSVC Windows toolchain by default #286

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/Index.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,6 @@ include("${ProjectOptions_SRC_DIR}/DetectCompiler.cmake")
include("${ProjectOptions_SRC_DIR}/CrossCompiler.cmake")
include("${ProjectOptions_SRC_DIR}/DynamicProjectOptions.cmake")
include("${ProjectOptions_SRC_DIR}/Hardening.cmake")

# Include msvc toolchain on windows if the generator is not visual studio. Should be called before run_vcpkg and run_conan to be effective
if("${CMAKE_TOOLCHAIN_FILE}" STREQUAL "")
msvc_toolchain()
else()
message(STATUS "project_options: skipping msvc_toolchain as CMAKE_TOOLCHAIN_FILE is set")
endif()

include("${ProjectOptions_SRC_DIR}/Conan.cmake")
include("${ProjectOptions_SRC_DIR}/Vcpkg.cmake")

Expand Down
16 changes: 15 additions & 1 deletion src/VCEnvironment.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,21 @@ function(is_msvc value)
set(${value} OFF PARENT_SCOPE)
endfunction()

# Include msvc toolchain on windows if the generator is not visual studio. Should be called before run_vcpkg and run_conan to be effective
#[[.rst:

``msvc_toolchain``
===============

Include msvc toolchain on windows if the generator is not visual studio. Should be called before run_vcpkg and run_conan to be effective

Notes: if running in a cross-compilation situation, the toolchain might not work as expected. So add proper if-checks if you have such a configuration

.. code:: cmake

msvc_toolchain()
# should be included before run_vcpkg/run_conan to be effective

]]
macro(msvc_toolchain)
if(# if on windows and the generator is not Visual Studio
WIN32 AND NOT CMAKE_GENERATOR MATCHES "Visual Studio*"
Expand Down
Loading