红联Linux门户
Linux帮助

CMake默认编译、链接选项

发布时间:2016-08-28 10:03:51来源:linux网站作者:icbm
CMakeLists.txt 文件内容:
cmake_minimum_required(VERSION 3.4)
message(STATUS "CMAKE_C_FLAGS = " ${CMAKE_C_FLAGS})
message(STATUS "CMAKE_C_FLAGS_DEBUG = " ${CMAKE_C_FLAGS_DEBUG})
message(STATUS "CMAKE_C_FLAGS_MINSIZEREL = " ${CMAKE_C_FLAGS_MINSIZEREL})
message(STATUS "CMAKE_C_FLAGS_RELEASE = " ${CMAKE_C_FLAGS_RELEASE})
message(STATUS "CMAKE_C_FLAGS_RELWITHDEBINFO = " ${CMAKE_C_FLAGS_RELWITHDEBINFO})
message(STATUS "CMAKE_CXX_FLAGS = " ${CMAKE_CXX_FLAGS})
message(STATUS "CMAKE_CXX_FLAGS_DEBUG = " ${CMAKE_CXX_FLAGS_DEBUG})
message(STATUS "CMAKE_CXX_FLAGS_MINSIZEREL = " ${CMAKE_CXX_FLAGS_MINSIZEREL})
message(STATUS "CMAKE_CXX_FLAGS_RELEASE = " ${CMAKE_CXX_FLAGS_RELEASE})
message(STATUS "CMAKE_CXX_FLAGS_RELWITHDEBINFO = " ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
message(STATUS "CMAKE_EXE_LINKER_FLAGS = " ${CMAKE_EXE_LINKER_FLAGS})
message(STATUS "CMAKE_EXE_LINKER_FLAGS_DEBUG = " ${CMAKE_EXE_LINKER_FLAGS_DEBUG})
message(STATUS "CMAKE_EXE_LINKER_FLAGS_MINSIZEREL = " ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL})
message(STATUS "CMAKE_EXE_LINKER_FLAGS_RELEASE = " ${CMAKE_EXE_LINKER_FLAGS_RELEASE})
message(STATUS "CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO = " ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO})
message(STATUS "CMAKE_MODULE_LINKER_FLAGS = " ${CMAKE_MODULE_LINKER_FLAGS})
message(STATUS "CMAKE_MODULE_LINKER_FLAGS_DEBUG = " ${CMAKE_MODULE_LINKER_FLAGS_DEBUG})
message(STATUS "CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL = " ${CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL})
message(STATUS "CMAKE_MODULE_LINKER_FLAGS_RELEASE = " ${CMAKE_MODULE_LINKER_FLAGS_RELEASE})
message(STATUS "CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO = " ${CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO})
message(STATUS "CMAKE_SHARED_LINKER_FLAGS = " ${CMAKE_SHARED_LINKER_FLAGS})
message(STATUS "CMAKE_SHARED_LINKER_FLAGS_DEBUG = " ${CMAKE_SHARED_LINKER_FLAGS_DEBUG})
message(STATUS "CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL = " ${CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL})
message(STATUS "CMAKE_SHARED_LINKER_FLAGS_RELEASE = " ${CMAKE_SHARED_LINKER_FLAGS_RELEASE})
message(STATUS "CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO = " ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO})
message(STATUS "CMAKE_STATIC_LINKER_FLAGS = " ${CMAKE_STATIC_LINKER_FLAGS})
message(STATUS "CMAKE_STATIC_LINKER_FLAGS_DEBUG = " ${CMAKE_STATIC_LINKER_FLAGS_DEBUG})
message(STATUS "CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL = " ${CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL})
message(STATUS "CMAKE_STATIC_LINKER_FLAGS_RELEASE = " ${CMAKE_STATIC_LINKER_FLAGS_RELEASE})
message(STATUS "CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO = " ${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO})
 
Windows 平台 64 位编译输出:
C:\chenchang\VMs\share\test\bld_win32>cmake -G "Visual Studio 14 2015 Win64" ..
-- CMAKE_C_FLAGS =  /DWIN32 /D_WINDOWS /W3
-- CMAKE_C_FLAGS_DEBUG = /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1
-- CMAKE_C_FLAGS_MINSIZEREL = /MD /O1 /Ob1 /D NDEBUG
-- CMAKE_C_FLAGS_RELEASE = /MD /O2 /Ob2 /D NDEBUG
-- CMAKE_C_FLAGS_RELWITHDEBINFO = /MD /Zi /O2 /Ob1 /D NDEBUG
-- CMAKE_CXX_FLAGS =  /DWIN32 /D_WINDOWS /W3 /GR /EHsc
-- CMAKE_CXX_FLAGS_DEBUG = /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1
-- CMAKE_CXX_FLAGS_MINSIZEREL = /MD /O1 /Ob1 /D NDEBUG
-- CMAKE_CXX_FLAGS_RELEASE = /MD /O2 /Ob2 /D NDEBUG
-- CMAKE_CXX_FLAGS_RELWITHDEBINFO = /MD /Zi /O2 /Ob1 /D NDEBUG
-- CMAKE_EXE_LINKER_FLAGS =  /machine:x64
-- CMAKE_EXE_LINKER_FLAGS_DEBUG = /debug /INCREMENTAL
-- CMAKE_EXE_LINKER_FLAGS_MINSIZEREL = /INCREMENTAL:NO
-- CMAKE_EXE_LINKER_FLAGS_RELEASE = /INCREMENTAL:NO
-- CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO = /debug /INCREMENTAL
-- CMAKE_MODULE_LINKER_FLAGS =  /machine:x64
-- CMAKE_MODULE_LINKER_FLAGS_DEBUG = /debug /INCREMENTAL
-- CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL = /INCREMENTAL:NO
-- CMAKE_MODULE_LINKER_FLAGS_RELEASE = /INCREMENTAL:NO
-- CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO = /debug /INCREMENTAL
-- CMAKE_SHARED_LINKER_FLAGS =  /machine:x64
-- CMAKE_SHARED_LINKER_FLAGS_DEBUG = /debug /INCREMENTAL
-- CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL = /INCREMENTAL:NO
-- CMAKE_SHARED_LINKER_FLAGS_RELEASE = /INCREMENTAL:NO
-- CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO = /debug /INCREMENTAL
-- CMAKE_STATIC_LINKER_FLAGS =  /machine:x64
-- CMAKE_STATIC_LINKER_FLAGS_DEBUG =
-- CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL =
-- CMAKE_STATIC_LINKER_FLAGS_RELEASE =
-- CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO =
-- Configuring done
-- Generating done
-- Build files have been written to: C:/chenchang/VMs/share/test/bld_win32
 
Ubuntu Linux 16.04 64 位编译输出:
root@chanchen-VirtualBox:/mnt/share/test/bld_lnx# cmake ..
-- CMAKE_C_FLAGS = 
-- CMAKE_C_FLAGS_DEBUG = -g
-- CMAKE_C_FLAGS_MINSIZEREL = -Os -DNDEBUG
-- CMAKE_C_FLAGS_RELEASE = -O3 -DNDEBUG
-- CMAKE_C_FLAGS_RELWITHDEBINFO = -O2 -g -DNDEBUG
-- CMAKE_CXX_FLAGS = 
-- CMAKE_CXX_FLAGS_DEBUG = -g
-- CMAKE_CXX_FLAGS_MINSIZEREL = -Os -DNDEBUG
-- CMAKE_CXX_FLAGS_RELEASE = -O3 -DNDEBUG
-- CMAKE_CXX_FLAGS_RELWITHDEBINFO = -O2 -g -DNDEBUG
-- CMAKE_EXE_LINKER_FLAGS = 
-- CMAKE_EXE_LINKER_FLAGS_DEBUG = 
-- CMAKE_EXE_LINKER_FLAGS_MINSIZEREL = 
-- CMAKE_EXE_LINKER_FLAGS_RELEASE = 
-- CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO = 
-- CMAKE_MODULE_LINKER_FLAGS = 
-- CMAKE_MODULE_LINKER_FLAGS_DEBUG = 
-- CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL = 
-- CMAKE_MODULE_LINKER_FLAGS_RELEASE = 
-- CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO = 
-- CMAKE_SHARED_LINKER_FLAGS = 
-- CMAKE_SHARED_LINKER_FLAGS_DEBUG = 
-- CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL = 
-- CMAKE_SHARED_LINKER_FLAGS_RELEASE = 
-- CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO = 
-- CMAKE_STATIC_LINKER_FLAGS = 
-- CMAKE_STATIC_LINKER_FLAGS_DEBUG = 
-- CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL = 
-- CMAKE_STATIC_LINKER_FLAGS_RELEASE = 
-- CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO = 
-- Configuring done
-- Generating done
-- Build files have been written to: /mnt/share/test/bld_lnx
 
本文永久更新地址:http://www.linuxdiyf.com/linux/23689.html