如何不添加发布或调试到输出路径? [英] How to not add Release or Debug to output path?

查看:569
本文介绍了如何不添加发布或调试到输出路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我目前的输出设定:

  set(EXECUTABLE_OUTPUT_PATH$ {CMAKE_CURRENT_SOURCE_DIR} / bin)
set(LIBRARY_OUTPUT_PATH$ {CMAKE_CURRENT_SOURCE_DIR} / bin)
设置(RUNTIME_OUTPUT_DIRECTORY$ {CMAKE_CURRENT_SOURCE_DIR} / bin)

但是由于某种原因,我不想(MSVS)将文件放到bin /发布或调试bin文件夹中的文件夹。


解决方案

A 类似问题,几个月前,我建议使用目标属性,并且还引用另一个答案。对于MSVC,您可以根据配置完全指定可执行文件,库,归档等的位置。



例如。使用类似:

  if(MSVC)
set_target_properties($ {targetname} PROPERTIES LIBRARY_OUTPUT_DIRECTORY $ {youroutputdirectory})$其他可用配置类型(MinSizeRel,RelWithDebInfo)的b $ b set_target_properties($ {targetname} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_DEBUG $ {youroutputdirectory})
set_target_properties($ {targetname} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_RELEASE $ {youroutputdirectory})

endif(MSVC)

这将把所有的库放在一个输出目录$ {youroutputdirectory},无论是在Debug或Release配置。


Here is my current settings for output :

set( EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/bin")
set( LIBRARY_OUTPUT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/bin")
set( RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin")

But for some reason I do not want (MSVS) put out files to bin/Release or Debug folders in my bin folder. Can I realize it using CMake somehow?

thank you

解决方案

A similar question was asked a few months ago, where I advised the use of target properties and also referred to another answer. For MSVC you can completely specify the locations of executables, libraries, archives, etc. on a per-configuration basis.

E.g. using something like:

if ( MSVC )
    set_target_properties( ${targetname} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${youroutputdirectory} )
    set_target_properties( ${targetname} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_DEBUG ${youroutputdirectory} )
    set_target_properties( ${targetname} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_RELEASE ${youroutputdirectory} )
    # etc for the other available configuration types (MinSizeRel, RelWithDebInfo)
endif ( MSVC )

which will put all your libraries in a single output-directory ${youroutputdirectory}, whether it is in Debug or Release config.

这篇关于如何不添加发布或调试到输出路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆