- SALOME_BUILD_DOC, SALOME_BUILD_TESTS and SALOME_BUILD_GUI should be independent in each module

- Add definitions and include directories of dependent modules
This commit is contained in:
mpa 2013-10-22 07:24:09 +00:00
parent 804c651f09
commit dea655c657
2 changed files with 36 additions and 20 deletions

View File

@ -43,6 +43,8 @@ IF(EXISTS ${KERNEL_ROOT_DIR})
LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files") LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
INCLUDE(SalomeMacros) INCLUDE(SalomeMacros)
FIND_PACKAGE(SalomeKERNEL REQUIRED) FIND_PACKAGE(SalomeKERNEL REQUIRED)
ADD_DEFINITIONS(${KERNEL_DEFINITIONS})
INCLUDE_DIRECTORIES(${KERNEL_INCLUDE_DIRS})
ELSE(EXISTS ${KERNEL_ROOT_DIR}) ELSE(EXISTS ${KERNEL_ROOT_DIR})
MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR") MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
ENDIF(EXISTS ${KERNEL_ROOT_DIR}) ENDIF(EXISTS ${KERNEL_ROOT_DIR})
@ -61,8 +63,8 @@ LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files")
# User options defined in KERNEL # User options defined in KERNEL
# ============ # ============
OPTION(SALOME_BUILD_DOC "Generate SALOME GEOM documentation" ${SALOME_BUILD_DOC}) OPTION(SALOME_BUILD_DOC "Generate SALOME GEOM documentation" ON)
OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ${SALOME_BUILD_TESTS}) OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON)
# Advanced options: # Advanced options:
OPTION(SALOME_BUILD_GUI "Enable GUI" ON) OPTION(SALOME_BUILD_GUI "Enable GUI" ON)
@ -114,6 +116,8 @@ IF(SALOME_BUILD_GUI)
IF(EXISTS ${GUI_ROOT_DIR}) IF(EXISTS ${GUI_ROOT_DIR})
LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files") LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
FIND_PACKAGE(SalomeGUI) FIND_PACKAGE(SalomeGUI)
ADD_DEFINITIONS(${GUI_DEFINITIONS})
INCLUDE_DIRECTORIES(${GUI_INCLUDE_DIRS})
ELSE(EXISTS ${GUI_ROOT_DIR}) ELSE(EXISTS ${GUI_ROOT_DIR})
MESSAGE(STATUS "GUI_ROOT_DIR is not well defined, GEOM will be built without GUI!!!") MESSAGE(STATUS "GUI_ROOT_DIR is not well defined, GEOM will be built without GUI!!!")
ENDIF(EXISTS ${GUI_ROOT_DIR}) ENDIF(EXISTS ${GUI_ROOT_DIR})
@ -145,7 +149,7 @@ FIND_PACKAGE(SalomeVTK 6.0 REQUIRED)
# OpenCV # OpenCV
IF(SALOME_GEOM_USE_OPENCV) IF(SALOME_GEOM_USE_OPENCV)
FIND_PACKAGE(SalomeOpenCV REQUIRED) FIND_PACKAGE(SalomeOpenCV)
SALOME_LOG_OPTIONAL_PACKAGE(OpenCV SALOME_GEOM_USE_OPENCV) SALOME_LOG_OPTIONAL_PACKAGE(OpenCV SALOME_GEOM_USE_OPENCV)
ADD_DEFINITIONS(-DWITH_OPENCV) ADD_DEFINITIONS(-DWITH_OPENCV)
ENDIF(SALOME_GEOM_USE_OPENCV) ENDIF(SALOME_GEOM_USE_OPENCV)
@ -153,7 +157,6 @@ ENDIF(SALOME_GEOM_USE_OPENCV)
# Detection summary: # Detection summary:
SALOME_PACKAGE_REPORT_AND_CHECK() SALOME_PACKAGE_REPORT_AND_CHECK()
# Directories # Directories
# (default values taken from KERNEL) # (default values taken from KERNEL)
# =========== # ===========
@ -245,16 +248,18 @@ EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
# - in the build tree: # - in the build tree:
# Ensure the variables are always defined for the configure: # Ensure the variables are always defined for the configure:
SET(CAS_ROOT_DIR "${CAS_ROOT_DIR}") SET(KERNEL_ROOT_DIR "${KERNEL_ROOT_DIR}")
SET(OPENCV_ROOT_DIR "${OPENCV_ROOT_DIR}")
SET(GUI_ROOT_DIR "${GUI_ROOT_DIR}") SET(GUI_ROOT_DIR "${GUI_ROOT_DIR}")
SET(CAS_ROOT_DIR "${CAS_ROOT_DIR}")
SET(VTK_ROOT_DIR "${VTK_ROOT_DIR}")
SET(OPENCV_ROOT_DIR "${OPENCV_ROOT_DIR}")
SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include") SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}" INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
KERNEL_ROOT_DIR GUI_ROOT_DIR CAS_ROOT_DIR OPENCV_ROOT_DIR) KERNEL_ROOT_DIR GUI_ROOT_DIR CAS_ROOT_DIR VTK_ROOT_DIR OPENCV_ROOT_DIR)
# - in the install tree (VSR 16/08/2013: TEMPORARILY COMMENT THIS - TO REMOVE?): # - in the install tree (VSR 16/08/2013: TEMPORARILY COMMENT THIS - TO REMOVE?):
# Get the relative path of the include directory so # Get the relative path of the include directory so
@ -264,8 +269,7 @@ CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
# ${PROJECT_BINARY_DIR}/to_install/${PROJECT_NAME}Config.cmake # ${PROJECT_BINARY_DIR}/to_install/${PROJECT_NAME}Config.cmake
# INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE}" # INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE}"
# PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE CMAKE_INSTALL_PREFIX # PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE CMAKE_INSTALL_PREFIX
# KERNEL_ROOT_DIR SIP_ROOT_DIR QT4_ROOT_DIR PYQT4_ROOT_DIR CAS_ROOT_DIR # KERNEL_ROOT_DIR GUI_ROOT_DIR CAS_ROOT_DIR VTK_ROOT_DIR OPENCV_ROOT_DIR)
# OPENGL_ROOT_DIR VTK_ROOT_DIR QWT_ROOT_DIR)
WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
VERSION ${${PROJECT_NAME_UC}_VERSION} VERSION ${${PROJECT_NAME_UC}_VERSION}

View File

@ -43,35 +43,40 @@ SET_AND_CHECK(GEOM_ROOT_DIR_EXP "@PACKAGE_CMAKE_INSTALL_PREFIX@")
# Include directories # Include directories
SET_AND_CHECK(GEOM_INCLUDE_DIRS "${GEOM_ROOT_DIR_EXP}/@SALOME_INSTALL_HEADERS@") SET_AND_CHECK(GEOM_INCLUDE_DIRS "${GEOM_ROOT_DIR_EXP}/@SALOME_INSTALL_HEADERS@")
SET(GEOM_INCLUDE_DIRS "${GEOM_INCLUDE_DIRS};@_SalomeGEOM_EXTRA_HEADERS@")
SET(GEOM_DEFINITIONS "@KERNEL_DEFINITIONS@")
#### Now the specificities #### Now the specificities
# Options exported by the package: # Options exported by the package:
SET(SALOME_BUILD_DOC @SALOME_BUILD_DOC@) SET(SALOME_GEOM_BUILD_DOC @SALOME_BUILD_DOC@)
SET(SALOME_BUILD_TESTS @SALOME_BUILD_TESTS@) SET(SALOME_GEOM_BUILD_TESTS @SALOME_BUILD_TESTS@)
# Advanced options # Advanced options
SET(SALOME_BUILD_GUI @SALOME_BUILD_GUI@) SET(SALOME_GEOM_BUILD_GUI @SALOME_BUILD_GUI@)
SET(SALOME_GEOM_USE_OPENCV @SALOME_GEOM_USE_OPENCV@) SET(SALOME_GEOM_USE_OPENCV @SALOME_GEOM_USE_OPENCV@)
# Level 1 prerequisites: # Level 1 prerequisites:
SET_AND_CHECK(KERNEL_ROOT_DIR_EXP "@PACKAGE_KERNEL_ROOT_DIR@") SET_AND_CHECK(KERNEL_ROOT_DIR_EXP "@PACKAGE_KERNEL_ROOT_DIR@")
SET_AND_CHECK(CAS_ROOT_DIR_EXP "@PACKAGE_CAS_ROOT_DIR@") SET_AND_CHECK(CAS_ROOT_DIR_EXP "@PACKAGE_CAS_ROOT_DIR@")
SET_AND_CHECK(VTK_ROOT_DIR_EXP "@PACKAGE_VTK_ROOT_DIR@")
# Optional level 1 prerequisites: # Optional level 1 prerequisites:
IF(SALOME_BUILD_GUI) IF(SALOME_BUILD_GUI)
SET_AND_CHECK(GUI_ROOT_DIR_EXP "@PACKAGE_GUI_ROOT_DIR@") SET_AND_CHECK(GUI_ROOT_DIR_EXP "@PACKAGE_GUI_ROOT_DIR@")
LIST(APPEND GEOM_DEFINITIONS "@GUI_DEFINITIONS@")
ENDIF() ENDIF()
IF(SALOME_GEOM_USE_OPENCV) IF(SALOME_GEOM_USE_OPENCV)
SET_AND_CHECK(OPENCV_ROOT_DIR_EXP "@PACKAGE_OPENCV_ROOT_DIR@") SET_AND_CHECK(OPENCV_ROOT_DIR_EXP "@PACKAGE_OPENCV_ROOT_DIR@")
ADD_DEFINITIONS(-DWITH_OPENCV) LIST(APPEND GEOM_DEFINITIONS "-DWITH_OPENCV")
ENDIF() ENDIF()
# For all prerequisites, load the corresponding targets if the package was used # For all prerequisites, load the corresponding targets if the package was used
# in CONFIG mode. This ensures dependent projects link correctly # in CONFIG mode. This ensures dependent projects link correctly
# without having to set LD_LIBRARY_PATH: # without having to set LD_LIBRARY_PATH:
SET(_PREREQ CAS SalomeGUI OpenCV)
SET(_PREREQ_CONFIG_DIR "@CAS_DIR@" "@SalomeGUI_DIR@" "@OpenCV_DIR@") SET(_PREREQ OpenCV CAS VTK)
SET(_PREREQ_CONFIG_DIR "@OpenCV_DIR@" "@CAS_DIR@" "@VTK_DIR@")
LIST(LENGTH _PREREQ_CONFIG_DIR _list_len) LIST(LENGTH _PREREQ_CONFIG_DIR _list_len)
# Another CMake stupidity - FOREACH(... RANGE r) generates r+1 numbers ... # Another CMake stupidity - FOREACH(... RANGE r) generates r+1 numbers ...
MATH(EXPR _range "${_list_len}-1") MATH(EXPR _range "${_list_len}-1")
@ -102,10 +107,17 @@ SET(SALOME_INSTALL_RES "@SALOME_INSTALL_RES@")
SET(SALOME_INSTALL_DOC "@SALOME_INSTALL_DOC@") SET(SALOME_INSTALL_DOC "@SALOME_INSTALL_DOC@")
SET(SALOME_INSTALL_AMCONFIG_LOCAL "@SALOME_INSTALL_AMCONFIG_LOCAL@") SET(SALOME_INSTALL_AMCONFIG_LOCAL "@SALOME_INSTALL_AMCONFIG_LOCAL@")
IF(SALOME_BUILD_GUI)
# Include GUI targets if they were not already loaded:
IF(NOT (TARGET Event))
INCLUDE("${GUI_ROOT_DIR_EXP}/${SALOME_INSTALL_CMAKE_LOCAL}/SalomeGUITargets.cmake")
ENDIF()
ELSE(SALOME_BUILD_GUI)
# Include KERNEL targets if they were not already loaded: # Include KERNEL targets if they were not already loaded:
IF(NOT (TARGET SALOMEBasics)) IF(NOT (TARGET SALOMEBasics) AND NOT SALOME_MED_STANDALONE)
INCLUDE("${KERNEL_ROOT_DIR_EXP}/${SALOME_INSTALL_CMAKE}/SalomeKERNELTargets.cmake") INCLUDE("${KERNEL_ROOT_DIR_EXP}/${SALOME_INSTALL_CMAKE}/SalomeKERNELTargets.cmake")
ENDIF() ENDIF()
ENDIF(SALOME_BUILD_GUI)
# Exposed GEOM targets: # Exposed GEOM targets:
SET(GEOM_GEOMArchimede GEOMArchimede) SET(GEOM_GEOMArchimede GEOMArchimede)