[CMake] cmake Debug builds with icc
Lucas Wilcox
lucasw at ices.utexas.edu
Wed Apr 23 12:49:03 EDT 2008
Hi,
I am trying to setup Debug and Release builds using icc
(intel's c compiler) on Linux. It seems as though
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
are not being set. Although
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELEASE_INIT
CMAKE_CXX_FLAGS_RELWITHDEBINFO
are being set correctly. I tried both
cmake version 2.6-patch 0 RC-8
cmake version 2.4-patch 6
with the same results.
Please find below a description of what I tried.
Here is the simple CMakelists.txt that I am using
cmake_minimum_required(VERSION 2.4)
project(hello)
set(HELLOSRC
hello.c
)
add_executable(hello ${HELLOSRC})
where I invoked cmake (version 2.4-patch 6) from the
command line with
% CXX=icpc CC=icc cmake -DCMAKE_BUILD_TYPE:STRING=Debug
I have the following lines in my CMakeCache.txt
########################
# EXTERNAL cache entries
########################
//Path to a program.
CMAKE_AR:FILEPATH=/usr/bin/ar
//For backwards compatibility, what version of CMake commands and
// syntax should this version of CMake allow.
CMAKE_BACKWARDS_COMPATIBILITY:STRING=2.4
//No help, variable specified on the command line.
CMAKE_BUILD_TYPE:STRING=Debug
//Enable/Disable color output during build.
CMAKE_COLOR_MAKEFILE:BOOL=ON
//CXX compiler.
CMAKE_CXX_COMPILER:FILEPATH=/opt/intel/cce/10.0.023/bin/icpc
//Flags used by the compiler during all build types.
CMAKE_CXX_FLAGS:STRING=' '
//Flags used by the compiler during debug builds.
CMAKE_CXX_FLAGS_DEBUG:STRING=-g
//Flags used by the compiler during release minsize builds.
CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
//Flags used by the compiler during release builds (/MD /Ob1 /Oi
// /Ot /Oy /Gs will produce slightly less optimized but smaller
// files).
CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
//Flags used by the compiler during Release with Debug Info builds.
//
CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g
//C compiler.
CMAKE_C_COMPILER:FILEPATH=/opt/intel/cce/10.0.023/bin/icc
//Flags for C compiler.
CMAKE_C_FLAGS:STRING=' '
//Flags used by the compiler during debug builds.
CMAKE_C_FLAGS_DEBUG:STRING=
//Flags used by the compiler during release minsize builds.
CMAKE_C_FLAGS_MINSIZEREL:STRING=
//Flags used by the compiler during release builds (/MD /Ob1 /Oi
// /Ot /Oy /Gs will produce slightly less optimized but smaller
// files).
CMAKE_C_FLAGS_RELEASE:STRING=
//Flags used by the compiler during Release with Debug Info builds.
//
CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=
So it seems CMAKE_C_FLAGS_DEBUG, CMAKE_C_FLAGS_MINSIZEREL,
CMAKE_C_FLAGS_RELEASE, and CMAKE_C_FLAGS_RELWITHDEBINFO
are not being set correctly. Although it looks like
right platform file is being included, as
% grep Linux-icpc **/*
CMakeFiles/Makefile.cmake: "/usr/share/cmake/Modules/Platform/Linux-icpc.cmake"
And Linux-icpc.cmake contains
SET (CMAKE_C_FLAGS_INIT "")
SET (CMAKE_C_FLAGS_DEBUG_INIT "-g")
SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
SET (CMAKE_C_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
SET (CMAKE_CXX_FLAGS_INIT "")
SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
This could definitely be my fault as I am new to CMake.
Is there something I am doing wrong? I would appreciate
any comments or suggestions on what I can try to figure
out where the problem is.
Thanks,
Lucas
More information about the CMake
mailing list