Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9087347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:40:48+00:00 2026-06-16T21:40:48+00:00

vcproj files for Visual Studio contain various settings or properties which affect the build.

  • 0

vcproj files for Visual Studio contain various settings or properties which affect the build. For instance, a few of the ones that a project that I’m trying to convert to cmake uses are

StringPooling="true"
RuntimeLibrary="2"
TreatWChar_tAsBuiltInType="true"
WarningLevel="3"
Detect64BitPortabilityProblems="false"

There are of course plenty of others that could be set. The question is how to set them when the project is generated using cmake. Does anyone have any idea how to set these sort of properties when using cmake other than editing the vcproj file after the fact? I can’t find anything explaining how these sort of properties might be set via cmake. The only ones that I know how to set are ones that cmake specifically has cross-platform stuff for (e.g. PreprocessorDefinitions or AdditionalIncludeDirectories). But I need to be able to set ones that are specific to Visual Studio.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T21:40:49+00:00Added an answer on June 16, 2026 at 9:40 pm

    For the flags you’ve listed, you’d add the following to your CMakeLists.txt:

    if(MSVC)
      # StringPooling: true == /GF  false == /GF-
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GF")
    
      # RuntimeLibrary
      # 0 (MultiThreaded) == /MT
      # 1 (MultiThreadedDebug) == /MTd
      # 2 (MultiThreadedDLL) == /MD
      # 3 (MultiThreadedDebugDLL) == /MDd
      set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD")
      set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd")
    
      # TreatWChar_tAsBuiltInType: true == /Zc:wchar_t  false == /Zc:wchar_t-
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:wchar_t")
    
      # WarningLevel: /W<level 0 to 4> or /Wall
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3")
    
      # Detect64BitPortabilityProblems: /Wp64 - Deprecated since VC++ 2010 
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Wp64")
    endif()
    

    You can group these in one call if you want:

    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GF /Zc:wchar_t /W3 /Wp64")
    

    If you only need to add a flag to a single target (say, MyTestExe), you can do:

    set_target_properties(MyTestExe PROPERTIES COMPILE_FLAGS "/GF- /W2")
    

    Options set via this target-specific method will override any conflicting ones in the general CMAKE_CXX_FLAGS variable.

    For further info on these commands do:

    cmake --help-variable "CMAKE_<LANG>_FLAGS_DEBUG"
    cmake --help-command set_target_properties
    cmake --help-property COMPILE_FLAGS

    The Visual Studio compiler options are listed here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a script that generates Visual Studio 2005 C++ project files (.vcproj).
A found an article ( Extend the Visual Studio Build Process ) that explained
I was given some files that were built in Visual Studio 2005 version. When
I have a script that generates a .sln file and a few .vcproj files
Microsoft Visual Studio uses XML to save its .vcproj project files. So diffing XML
Using Visual Studio 2005. Is there anything in the .sln or .vcproj files (or
I am using Visual studio 2008. I have a Visual C project new.vcproj. There
I've developed a tool which I use to build other solution files, and if
From Visual Studio 2008 Command Prompt I run this command to generate .vcproj file:
I have 3 versions of Visual Studio installed, and 3 projects that require a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.