Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CMake的替代品:位置<;配置>;_Cmake - Fatal编程技术网

CMake的替代品:位置<;配置>;

CMake的替代品:位置<;配置>;,cmake,Cmake,我是位置目标属性的快乐用户。我已经用了一段时间了: 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

我是
位置
目标属性的快乐用户。我已经用了一段时间了:

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()
见:

这是从bug追踪器中记录的:

但是,外部项目希望使用:

if(POLICY CMP0026)
  cmake_policy(SET CMP0026 NEW)
endif()
这意味着我必须找到一个替代我以前的
位置
目标属性解决方案的替代方案

在当前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)
CMake/InstallMacros中的CMake错误。CMake:65(获取目标属性): 无法从目标“gdcmCommon”读取LOCATION属性。使用 使用add_custom_命令直接指定目标名称,或使用生成器 表达式$,视情况而定。 调用堆栈(最新调用优先): Source/Common/CMakeLists.txt:219(安装pdb)
您可以将@Tsyvarev评论的-

if(BUILD_SHARED_LIBS)
  install (
      FILES           "$<TARGET_PDB_FILE:${library}>"
      DESTINATION     "${GDCM_INSTALL_BIN_DIR}"
      COMPONENT       DebugDevel
      CONFIGURATIONS  Debug RelWithDebInfo
  )
endif()
if(构建共享库)
安装(
文件“$”
目标“${GDCM\u INSTALL\u BIN\u DIR}”
组件调试程序
配置调试与DebInfo相关
)
endif()
通过使用.

根据,生成器表达式
$
包含目标的
.pdb
文件的完整路径。这是你想要的吗?