CFLAGS
CMAKE_<LANG>_FLAGS
This is initialized for each language from environment variables:
-
CMAKE_C_FLAGS
: Initialized by theCFLAGS
environment variable. -
CMAKE_CXX_FLAGS
: Initialized by theCXXFLAGS
environment variable. -
CMAKE_CUDA_FLAGS
: Initialized by theCUDAFLAGS
environment variable. -
CMAKE_Fortran_FLAGS
: Initialized by theFFLAGS
environment variable.
CMAKE_<LANG>FLAGS<CONFIG>
Flags for language <LANG> when building for the <CONFIG> configuration.
设置编译选项
SET(CMAKE_C_FLAGS_DEBUG "-g -D_DEBUG -O0")
SET(CMAKE_C_FLAGS_RELEASE "-g -DNDEBUG -O3")
SET(CMAKE_CXX_FLAGS_DEBUG "-g -D_DEBUG -O0")
SET(CMAKE_CXX_FLAGS_RELEASE "-g -DNDEBUG -O3")