开发者

CMake : Include subdirectories

I have currently, in my CMake lists :

FIND_PATH(BOINC_INCLUDE_DIR NAMES boinc_api.h
      PATH_SUFFIXES boinc
      DOC "The Boinc include directory (where boinc_api.h is)")

This command find 开发者_C百科the directory /usr/include/boinc. But I want to add all the subdirectories in the boinc directory. How to do that ?

Thank you very much.


Try the following code. It iterates through all files and directories in BOINC_INCLUDE_DIR and appends directories to include directories list:

FILE(GLOB _ALL_FILES ${BOINC_INCLUDE_DIR} ${BOINC_INCLUDE_DIR}/*)
FOREACH(_FILE ${_ALL_FILES})
  IF(IS_DIRECTORY ${_FILE})
    INCLUDE_DIRECTORIES(${_FILE})
  ENDIF()
ENDFOREACH()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜