美文网首页
CMake--find_path()

CMake--find_path()

作者: MEMBA | 来源:发表于2016-05-07 18:01 被阅读0次

    测试用例的目录结构
    ./cmake
      |
      +--- find_path/
            |
            +--- CMakeLists.txt
            |
            +--- test.h
    本例中的实际目录为 D:\cmake\find_path


    • short-hand signature
      find_path( name1 [path1 path2 …])
    1. 用法1
      find_path(TEST_PATH find_path/test.h d:/cmake)
      message(${TEST_PATH})
      查看CMakeCache.txt中保存的结果为:
      //Path to a file.
      TEST_PATH:PATH=D:/cmake
    2. 用法2
      find_path(TEST_PATH test.h d:/cmake/find_path)
      message(${TEST_PATH})
      查看CMakeCache.txt中保存的结果为:
      //Path to a file.
      TEST_PATH:PATH=D:/cmake/find_path
    • full-hand signature
      find_path(
      <VAR>
      name | NAMES name1 [name2 ...]
      [HINTS path1 [path2 ... ENV var]]
      [PATHS path1 [path2 ... ENV var]]
      [PATH_SUFFIXES suffix1 [suffix2 ...]]
      [DOC "cache documentation string"]
      [NO_DEFAULT_PATH]
      [NO_CMAKE_ENVIRONMENT_PATH]
      [NO_CMAKE_PATH]
      [NO_SYSTEM_ENVIRONMENT_PATH]
      [NO_CMAKE_SYSTEM_PATH]
      [CMAKE_FIND_ROOT_PATH_BOTH |
      ONLY_CMAKE_FIND_ROOT_PATH |
      NO_CMAKE_FIND_ROOT_PATH]
      )
    1. 用法1
      find_path(TEST_PATH NAMES test.h PATHS d:/cmake/find_path DOC "this is a test for find_path")
      message(${TEST_PATH})
      查看CMakeCache.txt中保存的结果为:
      //this is a test for find_path
      TEST_PATH:PATH=D:/cmake/find_path
    2. 用法2
      //this is a test for find_path
      TEST_PATH:PATH=D:/cmake/find_path
      其它参数的用法参见CMake文档

    相关文章

      网友评论

          本文标题:CMake--find_path()

          本文链接:https://www.haomeiwen.com/subject/ffqsrttx.html