猿代码 — 科研/AI模型/高性能计算
0

CMake几个基本概念

摘要: 1)ifif(condition) commandselseif(condition) # optional block, can be repeated commandselse() # optional block commandsendif()if(PPLCV_DEP_HPCC_PKG) FetchContent_Declare(hpcc URL ${PPLCV_DEP ...
1)if
if(<condition>)
  <commands>
elseif(<condition>) # optional block, can be repeated
  <commands>
else()              # optional block
  <commands>
endif()


if(PPLCV_DEP_HPCC_PKG)
    FetchContent_Declare(hpcc
        URL ${PPLCV_DEP_HPCC_PKG}
        SOURCE_DIR ${HPCC_DEPS_DIR}/hpcc
        BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/hpcc-build
        SUBBUILD_DIR ${HPCC_DEPS_DIR}/hpcc-subbuild)
else()
    if(NOT PPLCV_DEP_HPCC_GIT)
        set(PPLCV_DEP_HPCC_GIT "https://github.com/openppl-public/hpcc.git")
    endif()
    FetchContent_Declare(hpcc
        GIT_REPOSITORY ${PPLCV_DEP_HPCC_GIT}
        GIT_TAG ${__HPCC_COMMIT__}
        SOURCE_DIR ${HPCC_DEPS_DIR}/hpcc
        BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/hpcc-build
        SUBBUILD_DIR ${HPCC_DEPS_DIR}/hpcc-subbuild)
endif()

2)
option(TEST_DEBUG "option for debug" OFF)   
if (TEST_DEBUG)                    # 这个TEST_DEBUG 是CMake中的变量
add_definitions(-DTEST_DEBUG)  # 这个TEST_DEBUG 是CMake中的变量
endif(TEST_DEBUG)

#ifdef TEST_DEBUG
...
...
#else 
...
#endif

3)









说点什么...

已有0条评论

最新评论...

本文作者
2023-11-23 23:23
  • 0
    粉丝
  • 584
    阅读
  • 0
    回复
资讯幻灯片
热门评论
热门专题
排行榜
Copyright   ©2015-2023   猿代码-超算人才智造局 高性能计算|并行计算|人工智能      ( 京ICP备2021026424号-2 )