# \#gen:vs

**URL:** https://discourse.cmake.org/tag/gen-vs/9.md?match_all_tags=true&page=1&tags%5B%5D=gen%3Avs

[Latest](https://discourse.cmake.org/latest.md) · [Categories](https://discourse.cmake.org/categories.md) · [Tags](https://discourse.cmake.org/tags.md)

**Page:** 2

---

## [set\_tests\_properties ENVIRONMENT ignored](https://discourse.cmake.org/t/set-tests-properties-environment-ignored/13425)

<div class="topic-metadata">

**Author:** [@RobStewart](https://discourse.cmake.org/u/RobStewart)\
**Replies:** 1\
**Last updated:** [January 21, 2025, 12:53pm UTC](https://discourse.cmake.org/t/set-tests-properties-environment-ignored/13425 "2025-01-21T12:53:47Z")

</div>

In my CMakeLists.txt, I define a Python unit test like this: ADD\_TEST(NAME foo COMMAND "${python}" -B -m unittest discover -v WORKING\_DIRECTORY ${CMAKE\_CURRENT\_SOURCE\_DIR} ) For that to work, a related .pyd must …

---

## [Cannot set toolset when configuring with the Visual Studio 2022 generator.](https://discourse.cmake.org/t/cannot-set-toolset-when-configuring-with-the-visual-studio-2022-generator/10160)

<div class="topic-metadata">

**Author:** [@teo-tsirpanis](https://discourse.cmake.org/u/teo-tsirpanis)\
**Replies:** 15\
**Last updated:** [January 15, 2025, 1:45pm UTC](https://discourse.cmake.org/t/cannot-set-toolset-when-configuring-with-the-visual-studio-2022-generator/10160 "2025-01-15T13:45:52Z")

</div>

I have installed on my machine Visual Studio 2022 17.9 with the MSVC toolsets 14.36, 14.38 and 14.39. I created with Visual Studio a new “CMake project” and after configuring it with cmake -S . -B build -G "Visual Studio…

---

## [Is there a way to disable the INSTALL target in Visual Studio while still generating the cmake\_install.cmake for CPack? (Feature request?)](https://discourse.cmake.org/t/is-there-a-way-to-disable-the-install-target-in-visual-studio-while-still-generating-the-cmake-install-cmake-for-cpack-feature-request/13383)

<div class="topic-metadata">

**Author:** [@sasha2048](https://discourse.cmake.org/u/sasha2048)\
**Replies:** 0\
**Last updated:** [January 13, 2025, 9:05am UTC](https://discourse.cmake.org/t/is-there-a-way-to-disable-the-install-target-in-visual-studio-while-still-generating-the-cmake-install-cmake-for-cpack-feature-request/13383 "2025-01-13T09:05:42Z")

</div>

Hello. I think it’s a relatively popular case on Windows when the install(…) command in a project is used only in conjunction with CPack – to create an installer. In such cases the INSTALL predefined target by itself is…

---

## [How to use custom Clang build with VS generator](https://discourse.cmake.org/t/how-to-use-custom-clang-build-with-vs-generator/13158)

<div class="topic-metadata">

**Author:** [@Angew](https://discourse.cmake.org/u/Angew)\
**Replies:** 0\
**Last updated:** [December 9, 2024, 10:49am UTC](https://discourse.cmake.org/t/how-to-use-custom-clang-build-with-vs-generator/13158 "2024-12-09T10:49:07Z")

</div>

Is there a way to fully use a custom installation of Clang with the VS generator (2022 in my case) in CMake? I have a custom build & installation of Clang. Based on MS information on using custom Clang in VS, I was able…

---

## [Problems with interactions between $\<TARGET\_OBJECTS:lib\> and $\<$\<CONFIG:Debug\>:src.c\>](https://discourse.cmake.org/t/problems-with-interactions-between-target-objects-lib-and-config-debug-src-c/13058)

<div class="topic-metadata">

**Author:** [@Glidos](https://discourse.cmake.org/u/Glidos)\
**Replies:** 3\
**Last updated:** [December 1, 2024, 8:04pm UTC](https://discourse.cmake.org/t/problems-with-interactions-between-target-objects-lib-and-config-debug-src-c/13058 "2024-12-01T20:04:38Z")

</div>

I’m combining libraries in a cmake-based project using: add\_library(combined) target\_sources(combined PRIVATE $\<TARGET\_OBJECTS:lib1\> $\<TARGET\_OBJECTS:lib2\>) This in most cases works fine, but some of the source…

---

## [Can I use different generator in same project?](https://discourse.cmake.org/t/can-i-use-different-generator-in-same-project/11766)

<div class="topic-metadata">

**Author:** [@fox](https://discourse.cmake.org/u/fox)\
**Replies:** 4\
**Last updated:** [November 29, 2024, 12:22pm UTC](https://discourse.cmake.org/t/can-i-use-different-generator-in-same-project/11766 "2024-11-29T12:22:33Z")

</div>

I want compile a project, use VS 2022. And it contain a library, I want use VS 2017 ,toolset v141 compile it, Can I do this in CMAKE?

---

## [Selecting the vc++ compiler when using the "NMake Makefiles" generator](https://discourse.cmake.org/t/selecting-the-vc-compiler-when-using-the-nmake-makefiles-generator/13059)

<div class="topic-metadata">

**Author:** [@Glidos](https://discourse.cmake.org/u/Glidos)\
**Replies:** 2\
**Last updated:** [November 26, 2024, 10:33am UTC](https://discourse.cmake.org/t/selecting-the-vc-compiler-when-using-the-nmake-makefiles-generator/13059 "2024-11-26T10:33:23Z")

</div>

If I use one of the visual studio generators, the compiler is selected automatically, but if I use “NMake Makefiles” it seems I need to set CMAKE\_C\_COMPILER and CMAKE\_CXX\_COMPILER explicitly. Some posts suggest I don’t n…

---

## [Inject "/EHa" MSVC option via CXXFLAGS for Visual Studio generator - not possible?](https://discourse.cmake.org/t/inject-eha-msvc-option-via-cxxflags-for-visual-studio-generator-not-possible/13014)

<div class="topic-metadata">

**Author:** [@YN\_Slb](https://discourse.cmake.org/u/YN_Slb)\
**Replies:** 0\
**Last updated:** [November 21, 2024, 3:01pm UTC](https://discourse.cmake.org/t/inject-eha-msvc-option-via-cxxflags-for-visual-studio-generator-not-possible/13014 "2024-11-21T15:01:17Z")

</div>

Per Microsoft documentation (/EH (Exception handling model) | Microsoft Learn), /EHa overrides both /EHs and /EHc arguments But, when these options are not provided by CMake to compiler directly - because of using Vi…

---

## [\[BUG\] CMake uses extra hidden flags](https://discourse.cmake.org/t/bug-cmake-uses-extra-hidden-flags/12983)

<div class="topic-metadata">

**Author:** [@Paradox84](https://discourse.cmake.org/u/Paradox84)\
**Replies:** 6\
**Last updated:** [November 18, 2024, 2:18pm UTC](https://discourse.cmake.org/t/bug-cmake-uses-extra-hidden-flags/12983 "2024-11-18T14:18:55Z")

</div>

In Debug configuration CMake uses \\Zi flag, but when you try to create a custom configuration which is just a clone of Debug, that config won’t have \\Zi flag In my opinion this is a bug and CMake only should use flags w…

---

## [Error trying to compile HLSL "FXC : error X3506: unrecognized compiler target 'vs'"](https://discourse.cmake.org/t/error-trying-to-compile-hlsl-fxc-error-x3506-unrecognized-compiler-target-vs/12805)

<div class="topic-metadata">

**Author:** [@Wallby](https://discourse.cmake.org/u/Wallby)\
**Replies:** 2\
**Last updated:** [October 20, 2024, 1:07pm UTC](https://discourse.cmake.org/t/error-trying-to-compile-hlsl-fxc-error-x3506-unrecognized-compiler-target-vs/12805 "2024-10-20T13:07:09Z")

</div>

I added the following in my CMakeLists.txt… set(PATH\_PER\_VERTEXSHADER ${VERTEXSHADERS}) set(PATH\_PER\_PIXELSHADER ${PIXELSHADERS}) list(TRANSFORM PATH\_PER\_PIXELSHADER PREPEND Source/) list(TRANSFORM PATH\_PER\_VERTEXSHADER…

---

## [FOLDER target property not working in Visual Studio 2022](https://discourse.cmake.org/t/folder-target-property-not-working-in-visual-studio-2022/12759)

<div class="topic-metadata">

**Author:** [@Wallby](https://discourse.cmake.org/u/Wallby)\
**Replies:** 1\
**Last updated:** [October 11, 2024, 12:12pm UTC](https://discourse.cmake.org/t/folder-target-property-not-working-in-visual-studio-2022/12759 "2024-10-11T12:12:27Z")

</div>

I tried both the FOLDER property as well as the CMAKE\_FOLDER variable, neither worked. I have set USE\_FOLDERS to ON. set(USE\_FOLDERS ON) set(CMAKE\_FOLDER "Temporary") add\_library(Example STATIC Example.c) set\_target\_pro…

---

## [DEBUG\_POSTFIX (VS\_DOTNET\_TARGET\_FRAMEWORK\_VERSION vs DOTNET\_SDK)](https://discourse.cmake.org/t/debug-postfix-vs-dotnet-target-framework-version-vs-dotnet-sdk/11759)

<div class="topic-metadata">

**Author:** [@AlamoGrito](https://discourse.cmake.org/u/AlamoGrito)\
**Replies:** 1\
**Last updated:** [September 24, 2024, 10:40am UTC](https://discourse.cmake.org/t/debug-postfix-vs-dotnet-target-framework-version-vs-dotnet-sdk/11759 "2024-09-24T10:40:55Z")

</div>

I had the need to have C# code compiled to target the Microsoft .Net Framework, .Net6 or .Net8 depending on the CMake option selected. For the MS .Net Framework I’m setting the target property VS\_DOTNET\_TARGET\_FRAMEWOR…

---

## [Visual Studio Multi-config solution](https://discourse.cmake.org/t/visual-studio-multi-config-solution/11633)

<div class="topic-metadata">

**Author:** [@Joerg](https://discourse.cmake.org/u/Joerg)\
**Replies:** 1\
**Last updated:** [September 17, 2024, 8:10am UTC](https://discourse.cmake.org/t/visual-studio-multi-config-solution/11633 "2024-09-17T08:10:29Z")

</div>

Hello, we are currently investigating switching from MPC (GitHub - DOCGroup/MPC: MPC (The Makefile, Project, and Workspace Creator)) to CMake. As a test, I am trying to convert a slightly larger C++ project to CMake. No…

---

## [Handling of IMPORTED targets and MSVC\_RUNTIME\_LIBRARY](https://discourse.cmake.org/t/handling-of-imported-targets-and-msvc-runtime-library/11618)

<div class="topic-metadata">

**Author:** [@nappl](https://discourse.cmake.org/u/nappl)\
**Replies:** 0\
**Last updated:** [September 9, 2024, 4:54am UTC](https://discourse.cmake.org/t/handling-of-imported-targets-and-msvc-runtime-library/11618 "2024-09-09T04:54:03Z")

</div>

I have a set of header files for a static library along with multiple implementations for different operating systems and build configurations - these include the 4 MSVC runtime library configurations for Windows (md, md…

---

## [vs test explorer and gtest\_discover\_test working directory](https://discourse.cmake.org/t/vs-test-explorer-and-gtest-discover-test-working-directory/11296)

<div class="topic-metadata">

**Author:** [@gbug](https://discourse.cmake.org/u/gbug)\
**Replies:** 10\
**Last updated:** [August 9, 2024, 12:16am UTC](https://discourse.cmake.org/t/vs-test-explorer-and-gtest-discover-test-working-directory/11296 "2024-08-09T00:16:02Z")

</div>

Hi! I have a strange issue with gtest\_discovery\_tests and custom working directory with VS Test Explorer – on some machines the working directory is set as expected and on some it doesn’t. In my project I have a tests d…

---

## ["note" messages from MSVC are filtered out from cmake output](https://discourse.cmake.org/t/note-messages-from-msvc-are-filtered-out-from-cmake-output/10892)

<div class="topic-metadata">

**Author:** [@jeanga](https://discourse.cmake.org/u/jeanga)\
**Replies:** 2\
**Last updated:** [July 19, 2024, 2:10pm UTC](https://discourse.cmake.org/t/note-messages-from-msvc-are-filtered-out-from-cmake-output/10892 "2024-07-19T14:10:13Z")

</div>

recently (VS 2022 17.10&17.11), MSVC has been using “note” messages to detail the context of an error message: Blockquote C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.39.33519\\include\\memo…

---

## [CMake Error at CMakeLists.txt:108 (message): Could not find sqlite3.lib. Check SQLITE\_LIB\_DIR. Call Stack (most recent call first): CMakeLists.txt:239 (findLib)](https://discourse.cmake.org/t/cmake-error-at-cmakelists-txt-108-message-could-not-find-sqlite3-lib-check-sqlite-lib-dir-call-stack-most-recent-call-first-cmakelists-txt-239-findlib/11256)

<div class="topic-metadata">

**Author:** [@dollPrincess](https://discourse.cmake.org/u/dollPrincess)\
**Replies:** 0\
**Last updated:** [July 16, 2024, 2:28am UTC](https://discourse.cmake.org/t/cmake-error-at-cmakelists-txt-108-message-could-not-find-sqlite3-lib-check-sqlite-lib-dir-call-stack-most-recent-call-first-cmakelists-txt-239-findlib/11256 "2024-07-16T02:28:20Z")

</div>

I have downloaded a project called Febio Studio, for which I can have no help of those who I downloaded it from, and am running into a wall that I cannot comprehend. I hope someone here can shed some light to help this a…

---

## [How to skip conversion of /permissive into \<ConformanceMode\>](https://discourse.cmake.org/t/how-to-skip-conversion-of-permissive-into-conformancemode/11193)

<div class="topic-metadata">

**Author:** [@Nekto](https://discourse.cmake.org/u/Nekto)\
**Replies:** 1\
**Last updated:** [July 8, 2024, 3:54pm UTC](https://discourse.cmake.org/t/how-to-skip-conversion-of-permissive-into-conformancemode/11193 "2024-07-08T15:54:52Z")

</div>

Hi, C++20 in MSVC enables standard conformance. I would like to disable it for now. CMake properly converts /permissive flag into false in .vcxproj. And MSBuild adds /permissive flag to compilation. The problem is that …

---

## [netcoreapp3.1 project with CMake](https://discourse.cmake.org/t/netcoreapp3-1-project-with-cmake/2917)

<div class="topic-metadata">

**Author:** [@pifopi](https://discourse.cmake.org/u/pifopi)\
**Replies:** 2\
**Last updated:** [June 18, 2024, 5:17pm UTC](https://discourse.cmake.org/t/netcoreapp3-1-project-with-cmake/2917 "2024-06-18T17:17:27Z")

</div>

Hello everyone ! I’m creating this post today because I’m wondering how to generate a netcoreapp3.1 project with CMake. I have seen some examples online (for net framework 4.7.2) mentionning this set(CMAKE\_DOTNET\_TARG…

---

## [CMake for C# project with nuget package references](https://discourse.cmake.org/t/cmake-for-c-project-with-nuget-package-references/11028)

<div class="topic-metadata">

**Author:** [@Sameer\_Joshi](https://discourse.cmake.org/u/Sameer_Joshi)\
**Replies:** 2\
**Last updated:** [June 17, 2024, 4:32am UTC](https://discourse.cmake.org/t/cmake-for-c-project-with-nuget-package-references/11028 "2024-06-17T04:32:25Z")

</div>

Hi All, I am looking for generating a CMakeLists.txt file for my C# csproj project which is .netstandard 2.0 based. It has project references and nuget package references. How can I add those package references in the…

---

## [MSVS gtest\_discover\_tests environment](https://discourse.cmake.org/t/msvs-gtest-discover-tests-environment/9225)

<div class="topic-metadata">

**Author:** [@ivanschou](https://discourse.cmake.org/u/ivanschou)\
**Replies:** 6\
**Last updated:** [June 2, 2024, 11:56am UTC](https://discourse.cmake.org/t/msvs-gtest-discover-tests-environment/9225 "2024-06-02T11:56:15Z")

</div>

I have a project that uses a third-party library and I’ve written unit tests and added them to my test suite via gtest\_discover\_tests, but in order to successfully build the test target in VS I need to add the path to th…

---

## [failed to link the ".a" library into the project](https://discourse.cmake.org/t/failed-to-link-the-a-library-into-the-project/10812)

<div class="topic-metadata">

**Author:** [@Vinay\_hs](https://discourse.cmake.org/u/Vinay_hs)\
**Replies:** 4\
**Last updated:** [May 8, 2024, 7:02am UTC](https://discourse.cmake.org/t/failed-to-link-the-a-library-into-the-project/10812 "2024-05-08T07:02:19Z")

</div>

HI, I created a static library named “libadd.a” using e2 Studio IDE. Later, I initiated a Renesas microcontroller project in Visual Studio Code utilizing the Renesas Build Utilities extension. Unfortunately, I faced cha…

---

## [CMAKE\_GENERATOR\_TOOLSET's toolset and version keys gives unexpected results with vs2022/vs2019?](https://discourse.cmake.org/t/cmake-generator-toolsets-toolset-and-version-keys-gives-unexpected-results-with-vs2022-vs2019/10800)

<div class="topic-metadata">

**Author:** [@StewMcC](https://discourse.cmake.org/u/StewMcC)\
**Replies:** 2\
**Last updated:** [May 4, 2024, 7:03pm UTC](https://discourse.cmake.org/t/cmake-generator-toolsets-toolset-and-version-keys-gives-unexpected-results-with-vs2022-vs2019/10800 "2024-05-04T19:03:19Z")

</div>

CMake Version: 3.27.8 no policy overrides VS/MSVC installs: VS2019/14.29.30133, VS2022/14.34.31933 I am trying to customize a windows toolchain file to specify the toolset requirements for visual studio when using a Vi…

---

## [VS: CMP0147 always triggers custom steps rebuild for CMake 3.27+](https://discourse.cmake.org/t/vs-cmp0147-always-triggers-custom-steps-rebuild-for-cmake-3-27/10548)

<div class="topic-metadata">

**Author:** [@AJIOB](https://discourse.cmake.org/u/AJIOB)\
**Replies:** 4\
**Last updated:** [April 27, 2024, 3:31pm UTC](https://discourse.cmake.org/t/vs-cmp0147-always-triggers-custom-steps-rebuild-for-cmake-3-27/10548 "2024-04-27T15:31:24Z")

</div>

Hello I have a big closed-source project, that uses CMake as a main build system. After upgrading from CMake 3.26 to CMake 3.27 I see, that my custom generators are always rebuild. I just run 5 sequential builds and a…

---

## [Windows resources file and manifest dpi awareness](https://discourse.cmake.org/t/windows-resources-file-and-manifest-dpi-awareness/10247)

<div class="topic-metadata">

**Author:** [@StillWaters77](https://discourse.cmake.org/u/StillWaters77)\
**Replies:** 2\
**Last updated:** [April 17, 2024, 6:10am UTC](https://discourse.cmake.org/t/windows-resources-file-and-manifest-dpi-awareness/10247 "2024-04-17T06:10:50Z")

</div>

I have trouble linking both resources (\*.rc for a windows icon) as well as a manifest into my application. First i only had a manifest in which i set the DPI awareness to PerMonitor. This worked as expected: moving the …

---

## [Clarify how interface library is installed](https://discourse.cmake.org/t/clarify-how-interface-library-is-installed/10572)

<div class="topic-metadata">

**Author:** [@gaz0](https://discourse.cmake.org/u/gaz0)\
**Replies:** 1\
**Last updated:** [April 11, 2024, 4:45pm UTC](https://discourse.cmake.org/t/clarify-how-interface-library-is-installed/10572 "2024-04-11T16:45:26Z")

</div>

My question is a much simpler version of a question from 2020: INTERFACE library not getting installed and no error reported. In Step 5 of the tutorial, the interface library tutorial\_compiler\_flags is a member of the l…

---

## [Tutorial Step 8 Visual Studio build steps in wrong order?](https://discourse.cmake.org/t/tutorial-step-8-visual-studio-build-steps-in-wrong-order/10443)

<div class="topic-metadata">

**Author:** [@gaz0](https://discourse.cmake.org/u/gaz0)\
**Replies:** 4\
**Last updated:** [April 11, 2024, 12:20pm UTC](https://discourse.cmake.org/t/tutorial-step-8-visual-studio-build-steps-in-wrong-order/10443 "2024-04-11T12:20:18Z")

</div>

I built and ran Step 8 of the tutorial OK. But if I rebuild SqrtLibrary in Visual Studio I get Rebuild started at 9:08 AM... 1\>------ Rebuild All started: Project: ZERO\_CHECK, Configuration: Debug x64 ------ 1\>1\>Checkin…

---

## [CXX compiler identification is different version](https://discourse.cmake.org/t/cxx-compiler-identification-is-different-version/10268)

<div class="topic-metadata">

**Author:** [@KBOPYM](https://discourse.cmake.org/u/KBOPYM)\
**Replies:** 1\
**Last updated:** [March 2, 2024, 9:54pm UTC](https://discourse.cmake.org/t/cxx-compiler-identification-is-different-version/10268 "2024-03-02T21:54:07Z")

</div>

I had VS2022, but project was incompatible with it, so I uninstalled it and got VS2019. I assume cmake kept info of the old compilers and now fails to work -- The CXX compiler identification is MSVC 19.29.30154.0 -- Th…

---

## [Proper CTest integration with Visual Studio?](https://discourse.cmake.org/t/proper-ctest-integration-with-visual-studio/10042)

<div class="topic-metadata">

**Author:** [@malaterre](https://discourse.cmake.org/u/malaterre)\
**Replies:** 1\
**Last updated:** [February 17, 2024, 5:57am UTC](https://discourse.cmake.org/t/proper-ctest-integration-with-visual-studio/10042 "2024-02-17T05:57:25Z")

</div>

I’d like to tightly integrate my test suite with Visual Studio 2019. If I understand correctly, the correct way is to reference one project to another: Write unit tests for C++ DLLs - Visual Studio (Windows) | Microsof…

---

## [Modules have different types of libraries in different configurations.](https://discourse.cmake.org/t/modules-have-different-types-of-libraries-in-different-configurations/9940)

<div class="topic-metadata">

**Author:** [@aidexie](https://discourse.cmake.org/u/aidexie)\
**Replies:** 1\
**Last updated:** [January 26, 2024, 2:15pm UTC](https://discourse.cmake.org/t/modules-have-different-types-of-libraries-in-different-configurations/9940 "2024-01-26T14:15:52Z")

</div>

I have a vs project that was generated using cmake, now I have a requirement that some modules have different types of libraries under different configs. For example, we have 4 types of config:Debug,Release,DebugEditor,R…

[Previous page](https://discourse.cmake.org/tag/gen-vs/9.md?match_all_tags=true&tags%5B%5D=gen%3Avs)

[Next page](https://discourse.cmake.org/tag/gen-vs/9.md?match_all_tags=true&page=2&tags%5B%5D=gen%3Avs)
