官方文档https://cmake.org/cmake/help/v3.7/
CMake是一个跨平台的安装(编译)工具,可以用简单的语句来描述所有平台的安装(编译过程),输出各种各样的makefile或者project文件。CMake”这个名字是“cross platform make”的缩写。
$> cmake ../sdk -Ddebug=ON
$> make
$> make install
# 定义变量 e.g. 定义SLNDIR变量,变量值为../../。变量的使用方法为${variable name}
set(SLNDIR ../../)
# 从文件加载CMake命令 e.g. 加载../../prj.mak/sp.cmake文件的所有命令
include(${SLNDIR}prj.mak/sp.cmake)
# 添加包含路径,编译器能这些路径中寻找头文件 e.g. 添加两个路径
include_directories (${SLNDIR}src/include ${SLNDIR}src/3rd/include )
# 添加可执行文件。从源文件source1, source2...生成可执行文件name
add_executable(# 添加库。 从源文件source1, source2...生成库name(静态库,动态库)[WIN32] [MACOSX_BUNDLE] [EXCLUDE_FROM_ALL] source1 [source2 ...])
add_library(# 显示信息[STATIC | SHARED | MODULE] [EXCLUDE_FROM_ALL] source1 [source2 ...])
message([] "message to display" ...)
# 添加build子文件夹。告诉CMake执行source_dir下的 CMakeLists.txt文件,编译source_dir中的源代码
add_subdirectory(source_dir [binary_dir] [EXCLUDE_FROM_ALL])# 收集所有的源文件。将dir路径下的所有源文件都存储在variable中
aux_source_directory()
# 设置链接库的搜索路径。相当于gcc中的-L(大写L)
Specify directories in which the linker will look for libraries.
link_directories(directory1 directory2 ...)
# 设置链接库。该命令之后的所有target都要链接该命令中设置的库
Link libraries to all targets added later.
link_libraries([item1 [item2 [...]]] [[debug|optimized|general] - ] ...)
# 设置预编译宏。e.g. Debug模式下add_definitions(-g -D_DEBUG); Release模式下add_definitions(-DNDEBUG -O2)
add_definitions(-DFOO -DBAR ...)
# 用户可选择的选项。option(debug "is debug mode?" OFF).可以通过-D选择不同的选项。如cmake ../source -Ddebug=ON;cmake ../source -Ddebug=OFF
option(option_variable可以通过${option_variable}进行访问,其值为ON或者OFF"help string describing option" [initial value])
# 设置变量,取消变量
set (CMAKE_DEBUG_POSTFIX "d") #设置debug模式时,输出产物名加后缀d
unset (CMAKE_DEBUG_POSTFIX) # 取消CMAKE_DEBUG_POSTFIX变量的设置
# 逻辑判断
if(
if(NOT
if(
if(
if(DEFINED
if((expression) AND (expression OR (expression)))
if(
cmake操作系统平台的判断
宿主机host是执行编译、链接嵌入式软件的计算机;目标机target是运行嵌入式软件的硬件平台。通常我们用的PC机(window系统或者liunx系统)就是宿主机,而客户使用的车机(QNX系统)、手机(Andorid系统)则是目标机。
在宿主机host上要生成目标机target的程序就是交叉编译。交叉编译时需要修改以下内容:
Ø 修改编译器;
Ø 修改依赖库;
Ø 修改头文件;
使用CMake进行交叉编译就是要告诉CMake目标机target是什么平台、使用什么编译器、到哪里寻找依赖库、到哪里寻到头文件。CMake使用一些内建变量定义上述内容。
Ø CMAKE_SYSTEM_NAME: 即你目标机target所在的操作系统名称,比如ARM或者Linux你就需要写"Linux",如果Windows平台你就写"Windows",如果你的嵌入式平台没有相关OS你即需要写成"Generic",只有当CMAKE_SYSTEM_NAME这个变量被设置了,CMake才认为此时正在交叉编译,它会额外设置一个变量CMAKE_CROSSCOMPILING为TRUE.
Ø CMAKE_C_COMPILER: 顾名思义,即C语言编译器,这里可以将变量设置成完整路径或者文件名,设置成完整路径有一个好处就是CMake会去这个路径下去寻找编译相关的其他工具比如linker,binutils等,如果你写的文件名带有arm-elf等等前缀,CMake会识别到并且去寻找相关的交叉编译器。
Ø CMAKE_CXX_COMPILER: 同上,此时代表的是C++编译器
Ø CMAKE_FIND_ROOT_PATH: 代表了一系列的相关文件夹路径的根路径的变更
Ø CMAKE_FIND_ROOT_PATH_MODE_PROGRAM: 对FIND_PROGRAM()起作用,有三种取值,NEVER,ONLY,BOTH,第一个表示不在你CMAKE_FIND_ROOT_PATH下进行查找,第二个表示只在这个路径下查找,第三个表示先查找这个路径,再查找全局路径,对于这个变量来说,一般都是调用宿主机的程序,所以一般都设置成NEVER
Ø CMAKE_FIND_ROOT_PATH_MODE_LIBRARY: 对FIND_LIBRARY()起作用,表示在链接的时候的库的相关选项,因此这里需要设置成ONLY来保证我们的库是在交叉环境中找的.
Ø CMAKE_FIND_ROOT_PATH_MODE_INCLUDE: 对FIND_PATH()和FIND_FILE()起作用,一般来说也是ONLY
与交叉编译相关的这些变量如何传递给CMake了?最为方便的一个方法就是将相关的变量设置都放进一个文件(cmake脚本)中去,然后将该文件通过CMAKE_TOOLCHIAIN_FILE传递给CMake, 例如:
cmake-DCMAKE_TOOLCHIAIN_FILE="/path/to/toolchain-file" ..
# this one is important
SET(CMAKE_SYSTEM_NAMELinux)
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)
# specify the crosscompiler
SET(CMAKE_C_COMPILER /opt/eldk-2007-01-19/usr/bin/ppc_74xx-gcc)
SET(CMAKE_CXX_COMPILER/opt/eldk-2007-01-19/usr/bin/ppc_74xx-g++)
# where is the targetenvironment
SET(CMAKE_FIND_ROOT_PATH /opt/eldk-2007-01-19/ppc_74xx/home/alex/eldk-ppc74xx-inst)
# search for programs inthe build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAMNEVER)
# for libraries and headersin the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARYONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
使用CMake交叉编译Android平台上的程序,就需要:
Ø 指明目标平台为Android
Ø 指明目标硬件是ARM还是X86
Ø 指明ndk level version
Ø 用ndk提供的编译器
Ø 从ndk安装目录搜寻依赖库和头文件
我们可以自己动手编写toolchain-file,设置相应的变量。这也比较麻烦。
幸运的是,我们有Android-cmake项目可以帮忙。该项目生成了一个名为android.toolchain.cmake的toolchain-file文件,该文件帮我们设置了大部分的变量。我们需要做的就是指定cmake的toolchain file为这个项目里面的android.toolchain.cmake文件,然后设置好Android NDK路径即可。
# Usage Linux:
export ANDROID_NDK=/absolute/path/to/the/android-ndk
mkdir build && cdbuild
cmake-DCMAKE_TOOLCHAIN_FILE=path/to/the/android.toolchain.cmake ..
make -j8
make install
# Usage Windows:
SETANDROID_NDK=C:\absolute\path\to\the\android-ndk
mkdir build && cdbuild
cmake.exe -G"MinGWMakefiles" ^
-DCMAKE_TOOLCHAIN_FILE=path\to\the\android.toolchain.cmake ^
-DCMAKE_MAKE_PROGRAM="%ANDROID_NDK%\prebuilt\windows\bin\make.exe"^
..
cmake.exe --build . --target install--clean-first
注意:此附录仅为beta版本,有些条目是推导出来的。
http://blog.csdn.net/xum2008/article/details/7268761
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 | |||
Object File name | set_target_properties( target PROPERTIES COMPILE_FLAGS "/FoName.obj" ) | ||
Program DataBase File Name | |||
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在Mac中的安装:
安装cmake command line tool 的方法:
sudo "/Applications/CMake.app/Contents/bin/cmake-gui" --install