English 中文(简体)
在CMake,我如何围绕Debug和释放视觉目录开展工作,试图增加2010年演播室。
原标题:In CMake, how do I work around the Debug and Release directories Visual Studio 2010 tries to add?

我试图从几年前与“2010年视觉演播室”一起建设我的一个基于CMake的项目,而I m则会遇到与项目产出目录有关的问题。 视觉演播室总是非常热衷于在制作双筒时添加“灯塔”和释放/子指示,并出于各种原因,我一直非常热衷于去除这些指示——现在,我使用新的CMake版本和新的视觉演播室版本,老的CMake工作似乎不再奏效,我期待着找到“新的”方法。

此前版本的CMake(2.6)和前版的视觉演播室(2008年),我使用了以下文字:

IF(MSVC_IDE)
    # A hack to get around the "Debug" and "Release" directories Visual Studio tries to add
    SET_TARGET_PROPERTIES(${targetname} PROPERTIES PREFIX "../")
    SET_TARGET_PROPERTIES(${targetname} PROPERTIES IMPORT_PREFIX "../")
ENDIF(MSVC_IDE)

这种做法是罚款的,但似乎不再如此。 是否有任何人知道与CMake 2.8.6和《2010年视觉演播室》一道开展类似但更最新的工作?

最佳回答
问题回答

在目前版本的CMake中,你可以使用以下文字的生成器:LIBRaut_OUTPUT_DIRECYTOR,以避免组合上的具体缺陷。

我只添加了<代码>$<$< CONFIG:Debug>>,后者总是扩大到无所作为。 这看起来是一片ir,但确实是工作,因此,你不能用简要评论来解释:

# Use a generator expression so that the specified folder is used directly, without any
# configuration-dependent suffix.
#
# See https://cmake.org/cmake/help/v3.8/prop_tgt/LIBRARY_OUTPUT_DIRECTORY.html
set_target_properties(library PROPERTIES
                      LIBRARY_OUTPUT_DIRECTORY my/folder/$<$<CONFIG:Debug>:>)

a. 由于Erik s使用提款;0:>

如果你们有多重目标,你们就希望找到解决办法,你们可以做这样的事情。

# Get Targets in ${CMAKE_CURRENT_SOURCE_DIR}
get_property(current_targets DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY BUILDSYSTEM_TARGETS)
foreach(TARGET ${current_targets})
    set_target_properties(${TARGET} PROPERTIES
                        RUNTIME_OUTPUT_DIRECTORY  ${CMAKE_BINARY_DIR}/$<0:> 
                        LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$<0:>
                        ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$<0:>)
endforeach()

a) 为每个可执行/单独执行的目标执行。





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签