CMAKE命令和VS属性对照表

 

下文中表来自:https://blog.csdn.net/xum2008/article/details/7268761?source=1,仅做记载。

Visual Studio     Cmake
Project Reference     add_dependencies()
General/Output Directory      
       
       
Debugging/Working Directory     CMAKE can’t set this value, because the info not stored in project file but some intermedia file generated by visual studio
       
c/c++ General Additional Include Directories include_directories()
    Resolve #using References Don’t know
    Debug Information Format CMAKE FAQ 
set(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi/Ob0 /Od /RTC1") 
set(CMAKE_C_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") 
set(CMAKE_C_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") 
set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG") 
Change the default flags for specific config.
    Common language runtime support set_target_properties( target PROPERTIES COMPILE_FLAGS “/clr”) 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/clr:pure”) 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/clr:safe”) 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/clr:oldSynax”)
    Suppress Startup Banner set_target_properties( target PROPERTIES COMPILE_FLAGS “/nologo” )
    Warning Level set_target_properties( target PROPERTIES COMPILE_FLAGS “/W0” ) 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/W1” ) 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/W2” ) 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/W3” ) 
set_target_properties( target PROPERTIES COMPILE_FLAGS "/W4" ) 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/Wall” )
    Treat Warnings As Errors set_target_properties( target PROPERTIES COMPILE_FLAGS “/WX-" ) #No 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/WX" )  #Yes
    Multi-processor Compilation set_target_properties( target PROPERTIES COMPILE_FLAGS “/MP" )  #Yes 
#Don’t set means No
    Use Unicode For Assembler Listing set_target_properties( target PROPERTIES COMPILE_FLAGS “/FAu" ) #yes 
#Don’t set means no
  Optimization Optimization set(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi/Ob0 /Od /RTC1") 
set(CMAKE_C_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") 
set(CMAKE_C_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") 
set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2/Ob1 /D NDEBUG") 
Change the default flags for specific config.
    Inline Function Expansion set(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi/Ob0 /Od /RTC1") 
set(CMAKE_C_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") 
set(CMAKE_C_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") 
set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG") 
Change the default flags for specific config.
    Enable Intrinsic Functions set_target_properties( target PROPERTIES COMPILE_FLAGS “/Oi" ) #yes 
#Don’t set means no
    Favor Size or Speed set_target_properties( target PROPERTIES COMPILE_FLAGS “/Os" ) #size 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/Ot" ) #speed 
#Don’t set means neither
    Omit Frame Pointers set_target_properties( target PROPERTIES COMPILE_FLAGS “/Oy-" ) #no 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/Oy" ) #yes
    Enable Fiber-safe Optimizations set_target_properties( target PROPERTIES COMPILE_FLAGS “/GT" ) #yes 
#not setting means no
    Whole Program Optimization set_target_properties( target PROPERTIES COMPILE_FLAGS “/GL" ) #yes 
#not setting means no
  Preprocessor Preprocessor Definitions set_target_properties( target PROPERTIES COMPILE_DEFINITIONS DEFNAME=DEFVAL ) 
set_source_files_properties( filename.cpp PROPERTIES COMPILE_DEFINITIONS DEFNAME=DEFVAL )
    Undefine Preprocessor Definitions set_target_properties( target PROPERTIES COMPILE_FLAGS “/UDEFNAME" )
    Undefine All Preprocessor Definitions set_target_properties( target PROPERTIES COMPILE_FLAGS “/u" )
    Ignore Standard Include Path set_target_properties( target PROPERTIES COMPILE_FLAGS “/X" )
    Preprocess to a File set_target_properties( target PROPERTIES COMPILE_FLAGS “/P" )
    Preprocess Suppress Line Numbers set_target_properties( target PROPERTIES COMPILE_FLAGS “/EP" )
    Keep Comments set_target_properties( target PROPERTIES COMPILE_FLAGS “/C" )
  Code Generation Enable String Pooling set_target_properties( target PROPERTIES COMPILE_FLAGS “/GF" ) #yes 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/GF-" ) #no
    Enable Minimum Rebuild set_target_properties( target PROPERTIES COMPILE_FLAGS “/Gm" ) #yes 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/Gm-" )#no
    Enable C++ Exceptions set_target_properties( target PROPERTIES COMPILE_FLAGS “/EHsc" ) #yes 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/EHa" ) #yes, with SEH exceptions 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/EHs" ) #yes, with extern C functions 
#not setting means no
    Smaller Type Check set_target_properties( target PROPERTIES COMPILE_FLAGS “/RTCc" ) #yes 
#not setting means no
    Basic Runtime Checks set_target_properties( target PROPERTIES COMPILE_FLAGS “/RTCs" ) #Stack frame check 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/RTCu" ) #Uninitialized Variable 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/TRC1" ) #Both 
#not setting means no
    Runtime Library CMAKE FAQ 
set(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1") 
set(CMAKE_C_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") 
set(CMAKE_C_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") 
set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG") 
Change the default flags for specific config.
    Struct Member Alignment set_target_properties( target PROPERTIES COMPILE_FLAGS “/Zp1" ) 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/Zp2" ) 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/Zp4" ) 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/Zp8" )set_target_properties( target PROPERTIES COMPILE_FLAGS “/Zp16" )
    Buffer Security Check set_target_properties( target PROPERTIES COMPILE_FLAGS “/GS" ) #yes 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/GS-" ) #no
    Enable Function-Level Linking set_target_properties( target PROPERTIES COMPILE_FLAGS “/Gy" ) #yes 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/Gy-" ) #no
    Enable Enhaunced Instruction Set set_target_properties( target PROPERTIES COMPILE_FLAGS “/arch:SSE" ) 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/arch:SSE2" )
    Floating Point Model set_target_properties( target PROPERTIES COMPILE_FLAGS “/fp:precise" ) 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/fp:strict" ) 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/fp:fast" )
    Enable Floating Point Exceptions set_target_properties( target PROPERTIES COMPILE_FLAGS “/fp:except" )
    Create Hotpatchable Image set_target_properties( target PROPERTIES COMPILE_FLAGS “/hotpatch" )
  Language Disable Language Extensions set_target_properties( target PROPERTIES COMPILE_FLAGS “/Za" )
    Treat Wchar_t As Built in Type set_target_properties( target PROPERTIES COMPILE_FLAGS “/Zc:wchar_t" )#yes 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/Zc:wchar_t-" ) #no
    Force Conformance in For Loop Scope  
    Enable Run-Time Type Information set_target_properties( target PROPERTIES COMPILE_FLAGS “/GR" ) #yes 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/GR-" ) #no
    Open MP Support set_target_properties( target PROPERTIES COMPILE_FLAGS “/openmp" )#yes 
set_target_properties( target PROPERTIES COMPILE_FLAGS “/openmp-" )#no
  PreCompiled Header PreCompiled Header set_target_properties( target PROPERTIES COMPILE_FLAGS "/Yc" ) #create 
set_target_properties( target PROPERTIES COMPILE_FLAGS "/Yu" ) #use 
#not setting means no
    PreCompiled Header File set_target_properties( target PROPERTIES COMPILE_FLAGS "/Ycstdafx.h" ) 
set_target_properties( target PROPERTIES COMPILE_FLAGS "/Yustdafx.h" )
    Precompiled Header output File set_target_properties( target PROPERTIES COMPILE_FLAGS "/FpPathAndName.pch" )
  Output Files Expand Attributed Source set_target_properties( target PROPERTIES COMPILE_FLAGS "/Fx" )
    Assembler Output set_target_properties( target PROPERTIES COMPILE_FLAGS "/FA" ) 
set_target_properties( target PROPERTIES COMPILE_FLAGS "/FAc" ) 
set_target_properties( target PROPERTIES COMPILE_FLAGS "/FAs" ) 
set_target_properties( target PROPERTIES COMPILE_FLAGS "/FAcs" ) 
#not setting means no list
    ASM List Location set_target_properties( target PROPERTIES COMPILE_FLAGS "/FaDebug" )
    Object File name set_target_properties( target PROPERTIES COMPILE_FLAGS "/FoName.obj" )
    Program DataBase File Name set_target_properties( target PROPERTIES COMPILE_FLAGS "/FdC:/Debug/good.pdb" )
    Generate XML Documentation Files set_target_properties( target PROPERTIES COMPILE_FLAGS "/doc" )
    XML Documentation Filename set_target_properties( target PROPERTIES COMPILE_FLAGS "/docDocument.xml" )
  Browse Information Enable Browse Information set_target_properties( target PROPERTIES COMPILE_FLAGS "/FR" )
    Browse Information File set_target_properties( target PROPERTIES COMPILE_FLAGS "/FRfilename" )
  Advanced Calling Convention set_target_properties( target PROPERTIES COMPILE_FLAGS "/Gd" ) #_cdecl 
set_target_properties( target PROPERTIES COMPILE_FLAGS "/Gr" )  #_fastcall 
set_target_properties( target PROPERTIES COMPILE_FLAGS "/Gz" ) #_stdcall
    Compile As set_target_properties( target PROPERTIES LINKER_LANGUAGE "CXX" ) #C++ 
set_target_properties( target PROPERTIES LINKER_LANGUAGE "C" ) #C 
or 
set_target_properties( target PROPERTIES COMPILE_FLAGS "/TP" ) #CXX 
set_target_properties( target PROPERTIES COMPILE_FLAGS "/TC" ) #C
    Disable Specific Warnings set_target_properties( target PROPERTIES COMPILE_FLAGS "/wd4710" )
    Forced Include File set_target_properties( target PROPERTIES COMPILE_FLAGS "/FIinclude.h" )
    Forced #using File set_target_properties( target PROPERTIES COMPILE_FLAGS "/FUname" )
    Show Includes set_target_properties( target PROPERTIES COMPILE_FLAGS "/showIncludes" )
    Use full Paths set_target_properties( target PROPERTIES COMPILE_FLAGS "/FC" )
    Omit Default Library name set_target_properties( target PROPERTIES COMPILE_FLAGS "/ZI" )
    Internal Compiler Error Reporting set_target_properties( target PROPERTIES COMPILE_FLAGS "/errorReport:queue" ) 
set_target_properties( target PROPERTIES COMPILE_FLAGS "/errorReport:none" ) 
set_target_properties( target PROPERTIES COMPILE_FLAGS "/errorReport:prompt" ) 
set_target_properties( target PROPERTIES COMPILE_FLAGS "/errorReport:send" )
    Treat Specific Warnings as Errors Don't know
Linker General Output File #normal case 
set_target_properties( target PROPERTIES OUTPUT_NAME "Helloworld" ) 
set_target_properties( target PROPERTIES PREFIX "lib" ) 
set_target_properties( target PROPERTIES SUFFIX "lib" ) 

#for debug version 
set_target_properties( target PROPERTIES DEBUG_OUTPUT_NAME "Helloworld" ) 
set_target_properties( target PROPERTIES DEBUG_PREFIX "lib" ) 
set_target_properties( target PROPERTIES DEBUG_SUFFIX "lib" ) 

#For dlls 
set_target_properties( target PROPERTIES OUTPUT_NAME "Helloworld" ) 
set_target_properties( target PROPERTIES IMPORT_PREFIX "lib" ) 
set_target_properties( target PROPERTIES IMPORT_SUFFIX "lib" ) 
set_target_properties( target PROPERTIES PREFIX "bin" ) 
set_target_properties( target PROPERTIES SUFFIX "dll" ) 

#output path
    Show Progress set_target_properties( target PROPERTIES LINK_FLAGS "/VERBOSE" ) 
set_target_properties( target PROPERTIES LINK_FLAGS "/VERBOSE:Lib" ) 
set_target_properties( target PROPERTIES LINK_FLAGS "/VERBOSE:ICF" ) 
set_target_properties( target PROPERTIES LINK_FLAGS "/VERBOSE:REF" ) 
set_target_properties( target PROPERTIES LINK_FLAGS "/VERBOSE:SAFESEH" ) 
set_target_properties( target PROPERTIES LINK_FLAGS "/VERBOSE:CLR" ) 
#not setting means no
    Version set_target_properties( target PROPERTIES VERSION 0.1.2.3)
    Enable Incremental Linking set_target_properties( target PROPERTIES LINK_FLAGS "/INCREMENTAL" ) 
set_target_properties( target PROPERTIES LINK_FLAGS "/INCREMENTAL:NO" ) 

set( CMAKE_EXE_LINKER_FLAGS_DEBUG "/INCREMENTAL" ) 
set( CMAKE_EXE_LINKER_FLAGS_DEBUG "/INCREMENTAL:NO" )
    Suppress Startup Banner set_target_properties( target PROPERTIES LINK_FLAGS "/NOLOGO" )
    Ignore Import Library Don't know
    Register Output Don't know
    Per-user Redirection Don't know
    Additional Library Directories link_directories( dir1 dir2 ) 

set_target_properties( target PROPERTIES LINK_FLAGS "/LIBPATH:dir1 /LIBPATH:dir2" )
    Link Library Dependencies Don't know
    Use Library Dependency Inputs Don't know
    Link Status set_target_properties( target PROPERTIES LINK_FLAGS "/LTCG:STATUS" ) 
set_target_properties( target PROPERTIES LINK_FLAGS "/LTCG:NOSTATUS" )
    Prevent DLL Binding set_target_properties( target PROPERTIES LINK_FLAGS "/ALLOWBIND:NO" ) 
set_target_properties( target PROPERTIES LINK_FLAGS "/ALLOWBIND:YES" )
    Treat Linker Warnings As Errors set_target_properties( target PROPERTIES LINK_FLAGS "/WX" )
    Force File Output set_target_properties( target PROPERTIES LINK_FLAGS "/FORCE" )
    Create Hot Patchable Image set_target_properties( target PROPERTIES LINK_FLAGS "/FUNCTIONPADMIN" ) 
set_target_properties( target PROPERTIES LINK_FLAGS "/FUNCTIONPADMIN:16" ) #Itanium only 
set_target_properties( target PROPERTIES LINK_FLAGS "/FUNCTIONPADMIN:6" ) #x64 only 
set_target_properties( target PROPERTIES LINK_FLAGS "/FUNCTIONPADMIN:5" ) #x86 only
    Specify Section Attributes Don't know
  Input Additional Dependancies target_link_libraries( target item1 item2 )
    Ignore All Default Libraries set_target_properties( target PROPERTIES LINK_FLAGS "/NODEFAULTLIB" )
       
       
       
Put files into folders     source_group( header FILES includeme.h )
       
       
       

 

你可能感兴趣的:(CMAKE命令和VS属性对照表)