cmake - Install required system libraries for debug configuration only - Stack Overflow

I try to install the required system libraries (msvcp140d.dll, ucrtbasedd.dll...) for debug configurati

I try to install the required system libraries (msvcp140d.dll, ucrtbasedd.dll...) for debug configuration only. In release configuration I want to install none of these, neither the normal version nor the debug version.

I tried the following and figured out that it doesn't work because the if is evaluated at generation time and the generator expression is evaluated at build time

if($<CONFIG:Debug>)
  set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
  set(CMAKE_INSTALL_OPENMP_LIBRARIES TRUE)
  set(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE)
  set(CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY TRUE)
  include (InstallRequiredSystemLibraries)
endif()

Furthermore I tried to modify the value of the set function with the generator expression but it didn't work. I couldn't find information about when the value is evaluated

set(CMAKE_INSTALL_UCRT_LIBRARIES $<IF$<CONFIG:Debug>:,TRUE,FALSE>)
set(CMAKE_INSTALL_OPENMP_LIBRARIES $<IF$<CONFIG:Debug>:,TRUE,FALSE>)
set(CMAKE_INSTALL_DEBUG_LIBRARIES $<IF$<CONFIG:Debug>:,TRUE,FALSE>)
set(CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY $<IF$<CONFIG:Debug>:,TRUE,FALSE>)
include (InstallRequiredSystemLibraries)

I expected that the required system libraries would not be installed in the release configuration

I try to install the required system libraries (msvcp140d.dll, ucrtbasedd.dll...) for debug configuration only. In release configuration I want to install none of these, neither the normal version nor the debug version.

I tried the following and figured out that it doesn't work because the if is evaluated at generation time and the generator expression is evaluated at build time

if($<CONFIG:Debug>)
  set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
  set(CMAKE_INSTALL_OPENMP_LIBRARIES TRUE)
  set(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE)
  set(CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY TRUE)
  include (InstallRequiredSystemLibraries)
endif()

Furthermore I tried to modify the value of the set function with the generator expression but it didn't work. I couldn't find information about when the value is evaluated

set(CMAKE_INSTALL_UCRT_LIBRARIES $<IF$<CONFIG:Debug>:,TRUE,FALSE>)
set(CMAKE_INSTALL_OPENMP_LIBRARIES $<IF$<CONFIG:Debug>:,TRUE,FALSE>)
set(CMAKE_INSTALL_DEBUG_LIBRARIES $<IF$<CONFIG:Debug>:,TRUE,FALSE>)
set(CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY $<IF$<CONFIG:Debug>:,TRUE,FALSE>)
include (InstallRequiredSystemLibraries)

I expected that the required system libraries would not be installed in the release configuration

Share Improve this question asked Mar 13 at 7:10 Kevin HaybachKevin Haybach 331 silver badge3 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

What works is to add set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE) and use install with configurations.

set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION ${sensor_modules_tps_rxg_installation_dir})
set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
set(CMAKE_INSTALL_OPENMP_LIBRARIES TRUE)
set(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE)
set(CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY TRUE)
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
include (InstallRequiredSystemLibraries)
install (
    FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
    DESTINATION ${sensor_modules_tps_rxg_installation_dir}
    CONFIGURATIONS Debug
)

I'm not fully happy with this solution as I would prefer to manage the sets independently e.g. (CMAKE_INSTALL_OPENMP_LIBRARIES, CMAKE_INSTALL_UCRT_LIBRARIES) based on the configuration

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744715923a4589616.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信