12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- # Adds the current project to the global properties
- FUNCTION(OV_ADD_THIS_TO_PROJECT_LIST)
- #MESSAGE(STATUS "ADDING: ${CMAKE_CURRENT_SOURCE_DIR}")
-
- # Add the dir to be parsed for documentation later. We need to do this before adding subdir, in case the subdir is the actual docs dir
- GET_PROPERTY(OV_TMP GLOBAL PROPERTY OV_PROP_CURRENT_PROJECTS)
- SET(OV_TMP "${OV_TMP};${CMAKE_CURRENT_SOURCE_DIR}")
- SET_PROPERTY(GLOBAL PROPERTY OV_PROP_CURRENT_PROJECTS ${OV_TMP})
-
- ENDFUNCTION(OV_ADD_THIS_TO_PROJECT_LIST)
-
- FUNCTION(SOURCE_DIRECTORIES CURRENT_DIR RETURN_LIST)
- FILE(GLOB_RECURSE NEW_LIST ${CURRENT_DIR}/*.cpp ${CURRENT_DIR}/*.h ${CURRENT_DIR}/*.hpp ${CURRENT_DIR}/*.inl)
- SET(DIR_LIST "")
- FOREACH(FILE_PATH ${NEW_LIST})
- GET_FILENAME_COMPONENT(DIR_PATH ${FILE_PATH} PATH)
- SET(DIR_LIST ${DIR_LIST} "${DIR_PATH}/..")
- ENDFOREACH()
- LIST(REMOVE_DUPLICATES DIR_LIST)
- SET(${RETURN_LIST} ${DIR_LIST} PARENT_SCOPE)
- ENDFUNCTION(SOURCE_DIRECTORIES)
-
- # Adds the given directory to the CMake build
- FUNCTION(OV_ADD_SOURCE_DIR CURRENT_SOURCE_DIR)
- # Add the given current directory
- GET_PROPERTY(OV_TMP GLOBAL PROPERTY OV_PROP_CURRENT_PROJECTS)
- SET(OV_TMP "${OV_TMP};${CURRENT_SOURCE_DIR}")
- SET_PROPERTY(GLOBAL PROPERTY OV_PROP_CURRENT_PROJECTS ${OV_TMP})
- # Add source code directories
- SOURCE_DIRECTORIES(${CURRENT_SOURCE_DIR} LIST_DIR)
- FOREACH(SUBDIR ${LIST_DIR})
- GET_PROPERTY(OV_TMP GLOBAL PROPERTY OV_PROP_CURRENT_PROJECTS)
- SET(OV_TMP "${OV_TMP};${SUBDIR}")
- SET_PROPERTY(GLOBAL PROPERTY OV_PROP_CURRENT_PROJECTS ${OV_TMP})
- ENDFOREACH()
- ENDFUNCTION(OV_ADD_SOURCE_DIR)
-
- #
- # Adds all directories as subdirectories to the CMake build, using the branch specified (if any) in the root CMakeList.txt or
- # trunk otherwise.
- #
- # The branch variable name that is checked is made up from ${CURRENT_BRANCH_PREFIX}_${DIRNAMEUPPER}.
- #
- # The script also adds the directory to the global list of projects.
- #
-
- FUNCTION(OV_ADD_PROJECTS CURRENT_FOLDER_PREFIX)
-
- FILE(GLOB FILENAMES "*")
-
- FOREACH(FULLPATH ${FILENAMES})
- IF(IS_DIRECTORY ${FULLPATH} AND EXISTS "${FULLPATH}/CMakeLists.txt" AND NOT ${FULLPATH} MATCHES ".*\\.svn")
- GET_FILENAME_COMPONENT(DIRNAME ${FULLPATH} NAME)
-
- STRING(TOUPPER ${DIRNAME} DIRNAMEUPPER)
- SET(SKIP_THIS_FOLDER "SKIP_${CURRENT_FOLDER_PREFIX}_${DIRNAMEUPPER}")
-
- #MESSAGE(STATUS "Checking SKIP_${CURRENT_FOLDER_PREFIX}_${DIRNAMEUPPER} as branch var ${SKIP_THIS_FOLDER}")
-
- IF(${SKIP_THIS_FOLDER})
- MESSAGE(STATUS "Note: ${FULLPATH} has been skipped by setting SKIP_${CURRENT_FOLDER_PREFIX}_${DIRNAMEUPPER}")
- ELSE(${SKIP_THIS_FOLDER})
- # MESSAGE(STATUS "Inserting folder ${FULLPATH}")
-
- # Add the dir to be parsed for documentation later. We need to do this before adding subdir, in case the subdir is the actual docs dir
- GET_PROPERTY(OV_TMP GLOBAL PROPERTY OV_PROP_CURRENT_PROJECTS)
- SET(OV_TMP "${OV_TMP};${FULLPATH}")
- SET_PROPERTY(GLOBAL PROPERTY OV_PROP_CURRENT_PROJECTS ${OV_TMP})
-
- SET(OV_CURRENT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/${DIRNAME}")
- GET_PROPERTY(OV_TMP GLOBAL PROPERTY OV_PROP_CURRENT_PROJECTS_BUILD_DIR)
- SET(OV_TMP "${OV_TMP};${OV_CURRENT_BINARY_DIR}")
- SET_PROPERTY(GLOBAL PROPERTY OV_PROP_CURRENT_PROJECTS_BUILD_DIR ${OV_TMP})
-
- add_subdirectory(${FULLPATH})
-
- ENDIF(${SKIP_THIS_FOLDER})
- ENDIF(IS_DIRECTORY ${FULLPATH} AND EXISTS "${FULLPATH}/CMakeLists.txt" AND NOT ${FULLPATH} MATCHES ".*\\.svn")
- ENDFOREACH(FULLPATH ${FILENAMES})
-
- ENDFUNCTION(OV_ADD_PROJECTS)
|