You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

OvAddSingleProject.cmake 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #
  2. # This function is used to add a project to the build in the case where the current directory only contains
  3. # 'branches', 'tags' and 'trunk' directories of a single project. The project will be added using the
  4. # branch specified (if any) in the root CMakeList.txt or trunk otherwise.
  5. #
  6. # The branch variable name that is checked is made up from ${CURRENT_BRANCH_PREFIX}_${DIRNAMEUPPER}.
  7. #
  8. # The script also adds the directory to the global list of projects.
  9. #
  10. FUNCTION(OV_ADD_SINGLE_PROJECT CURRENT_BRANCH_PREFIX)
  11. SET(BRANCH_VARIABLE_NAME "${CURRENT_BRANCH_PREFIX}")
  12. # MESSAGE(STATUS "Parts ${CURRENT_BRANCH_PREFIX} Now ${BRANCH_VARIABLE_NAME}")
  13. # MESSAGE(STATUS "Value ${${BRANCH_VARIABLE_NAME}}")
  14. SET(SUBDIR "SUBDIR-NOTFOUND")
  15. # MESSAGE(STATUS "Checking branch for ${BRANCH_VARIABLE_NAME}")
  16. IF(${BRANCH_VARIABLE_NAME})
  17. SET(BRANCH ${${BRANCH_VARIABLE_NAME}})
  18. IF("${BRANCH}" STREQUAL "__SKIPME")
  19. MESSAGE(STATUS "Note: ${BRANCH_VARIABLE_NAME} has been disabled by setting it to __SKIPME")
  20. ELSE("${BRANCH}" STREQUAL "__SKIPME")
  21. SET(SUBDIR "${BRANCH}")
  22. ENDIF("${BRANCH}" STREQUAL "__SKIPME")
  23. ELSE(${BRANCH_VARIABLE_NAME})
  24. # MESSAGE(STATUS "Going for trunk...")
  25. SET(SUBDIR "${OV_TRUNK}")
  26. ENDIF(${BRANCH_VARIABLE_NAME})
  27. IF(SUBDIR)
  28. # MESSAGE(STATUS "Inserting folder ${SUBDIR}")
  29. # 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.
  30. GET_PROPERTY(OV_TMP GLOBAL PROPERTY OV_PROP_CURRENT_PROJECTS)
  31. SET(OV_TMP "${OV_TMP};${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}")
  32. SET_PROPERTY(GLOBAL PROPERTY OV_PROP_CURRENT_PROJECTS ${OV_TMP})
  33. # MESSAGE(STATUS "BDIR ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIR}")
  34. GET_PROPERTY(OV_TMP GLOBAL PROPERTY OV_PROP_CURRENT_PROJECTS_BUILD_DIR)
  35. SET(OV_TMP "${OV_TMP};${CMAKE_CURRENT_BINARY_DIR}/${SUBDIR}")
  36. SET_PROPERTY(GLOBAL PROPERTY OV_PROP_CURRENT_PROJECTS_BUILD_DIR ${OV_TMP})
  37. ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR})
  38. ENDIF(SUBDIR)
  39. ENDFUNCTION(OV_ADD_SINGLE_PROJECT)