visual c++ - ADD_DEPENDENCIES to different build type -


good day, question cmake. possible create dependencies msvc project different build types. have next code in cmake file:

set(libraries optimized lib_release debug lib_debug) add_custom_target(lib_release command ${cmake_command} -e copy_if_different "bla bla bla" comment "build dep release library") add_custom_target(lib_debug command ${cmake_command} -e copy_if_different "bla bla bla" comment "build debug library")  add_dependencies(${project_name} lib_release) add_dependencies(${project_name} lib_debug) 

this worked if want create release version excess step build of debug version library not needed release, library not linked target(release), time build spend much. question next: possible specify dependencies use release , debug this:

add_dependencies(${project_name} lib_release optimize) add_dependencies(${project_name} lib_debug debug). 

cmake recognise build type set -dcmake_build_type=debug|release etc command. can use set (cmake_cxx_flags_debug "${cmake_cxx_flags} ") compile time flags , on so:

  set(cmake_cxx_flags_debug "/zi /od /d \"_debug\" /d \"debug\" /rtc1 /mdd")    set(cmake_cxx_flags_minsizerel "/md")    set(cmake_cxx_flags_relwithdebinfo "${cmake_cxx_flags_release} /zi")  

you can set linker flags set(cmake_exe_linker_flags "${cmake_exe_linker_flags} <flags>)

individual targets can addressed in similar manner

  set_target_properties(yourexe properties                       link_flags_release "<flags>"                       link_flags_debug "/debug"                       link_flags_relwithdebinfo "<flags>"                       link_flags_minsizerel "<flags>") 

this file see options different os's.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -