我是LOCATION_<CONFIG>
目标媒体资源的快乐用户。我已经使用了一段时间了:
foreach(cfg ${CMAKE_CONFIGURATION_TYPES})
get_target_property(library_dll ${library} LOCATION_${cfg})
string(REPLACE .dll .pdb library_pdb ${library_dll})
string(TOLOWER ${cfg} lcfg)
if(lcfg STREQUAL "debug" OR lcfg STREQUAL "relwithdebinfo")
install (FILES ${library_pdb}
DESTINATION ${GDCM_INSTALL_BIN_DIR}
COMPONENT DebugDevel
CONFIGURATIONS ${cfg}
)
endif()
endforeach()
请参阅:
这是从错误跟踪器中记录的:
但是外部项目想要使用:
if(POLICY CMP0026)
cmake_policy(SET CMP0026 NEW)
endif()
这意味着我不得不找到旧的LOCATION_<CONFIG>
目标属性解决方案的替代方案。
在当前CMake(其中CMP0026 NEW
)中重写此宏以避免以下错误的正确方法是什么?
CMake Error at CMake/InstallMacros.cmake:65 (get_target_property):
The LOCATION property may not be read from target "gdcmCommon". Use the
target name directly with add_custom_command, or use the generator
expression $<TARGET_FILE>, as appropriate.
Call Stack (most recent call first):
Source/Common/CMakeLists.txt:219 (install_pdb)
答案 0 :(得分:2)
您可以将@Tsyvarev评论的内容减少到
const char* delim = "";
for (auto const& pair : pairs) {
std::cout << delim << pair; // now, our point of definition does include
// our operator<<() declaration, we don't need ADL
delim = ", ";
}