[CMake] Passing custom CXX_FLAGS

Daniel Stender daniel at danielstender.com
Mon Jun 17 04:59:44 EDT 2013


Hi,

when passing custom build flags on the command line with:

<cut>
cmake scantailor-0.9.11.1 -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo
"-DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2"
"-DCMAKE_EXE_LINKER_FLAGS:STRING=-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed"
</cut>

the CXX are only to be found in CMakeCache.txt, if these command line is given twice, first run:

<cut>
//No help, variable specified on the command line.
CMAKE_BUILD_TYPE:STRING=RelWithDebInfo
//No help, variable specified on the command line.
CMAKE_EXE_LINKER_FLAGS:STRING=-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed
//C++ flags for RelWithDebInfo builds.
CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-DNDEBUG -g -O2 -fvisibility=hidden
</cut>

second execution:

<cut>
//No help, variable specified on the command line.
CMAKE_BUILD_TYPE:STRING=RelWithDebInfo
//No help, variable specified on the command line.
CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2
//No help, variable specified on the command line.
CMAKE_EXE_LINKER_FLAGS:STRING=-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed
</cut>

The Cmake is 2.8.7-0ubuntu5 (12.04 LTS), the project tarball is:
http://sourceforge.net/projects/scantailor/?source=dlp

What's wrong, here? Thanks for any pointers in advance!

Greetings,
Daniel Stender

-- 
http://www.danielstender.com/blog/
GPG key ID: 1654BD9C



More information about the CMake mailing list