c++ - Debug vs Release in CMAKE -
in gcc compiled project,
- how run
cmake
each target type (debug/release)? - how specify debug , release c/c++ flags using
cmake
? - how express main executable compiled
g++
, 1 nested librarygcc
?
it's best "out of source" build. create cmakelists.txt
in root of project. root of project:
mkdir release cd release cmake -dcmake_build_type=release .. make
and debug (again root of project):
mkdir debug cd debug cmake -dcmake_build_type=debug .. make
debug
add debug flags appropriate compiler. see this faq more details.
you can modify/add flags in cmakelists.txt
via cmake_c_flags_debug
, cmake_c_flags_release
variables, e.g.:
set(cmake_cxx_flags_debug "${cmake_cxx_flags_debug} -wall") set(cmake_cxx_flags_release "${cmake_cxx_flags_release} -wall")
see this link under cmake_build_type
more details.
as 3rd question, i'm not sure asking exactly. cmake should automatically detect , use compiler appropriate different source files.
Comments
Post a Comment