Skip to content

Commit d58a7b6

Browse files
committed
fix: do not activate the MSVC Windows toolchain by default
1 parent 9cde8af commit d58a7b6

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

src/Index.cmake

-8
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,6 @@ include("${ProjectOptions_SRC_DIR}/DetectCompiler.cmake")
4343
include("${ProjectOptions_SRC_DIR}/CrossCompiler.cmake")
4444
include("${ProjectOptions_SRC_DIR}/DynamicProjectOptions.cmake")
4545
include("${ProjectOptions_SRC_DIR}/Hardening.cmake")
46-
47-
# Include msvc toolchain on windows if the generator is not visual studio. Should be called before run_vcpkg and run_conan to be effective
48-
if("${CMAKE_TOOLCHAIN_FILE}" STREQUAL "")
49-
msvc_toolchain()
50-
else()
51-
message(STATUS "project_options: skipping msvc_toolchain as CMAKE_TOOLCHAIN_FILE is set")
52-
endif()
53-
5446
include("${ProjectOptions_SRC_DIR}/Conan.cmake")
5547
include("${ProjectOptions_SRC_DIR}/Vcpkg.cmake")
5648

src/VCEnvironment.cmake

+15-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,21 @@ function(is_msvc value)
4646
set(${value} OFF PARENT_SCOPE)
4747
endfunction()
4848

49-
# Include msvc toolchain on windows if the generator is not visual studio. Should be called before run_vcpkg and run_conan to be effective
49+
#[[.rst:
50+
51+
``msvc_toolchain``
52+
===============
53+
54+
Include msvc toolchain on windows if the generator is not visual studio. Should be called before run_vcpkg and run_conan to be effective
55+
56+
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
57+
58+
.. code:: cmake
59+
60+
msvc_toolchain()
61+
# should be included before run_vcpkg/run_conan to be effective
62+
63+
]]
5064
macro(msvc_toolchain)
5165
if(# if on windows and the generator is not Visual Studio
5266
WIN32 AND NOT CMAKE_GENERATOR MATCHES "Visual Studio*"

0 commit comments

Comments
 (0)