1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

INSTALL_DIR is synced with CMAKE_INSTALL_PREFIX . Change of any of these vars resets the structure of the install folder

This commit is contained in:
ibs 2015-12-24 18:22:35 +03:00 committed by abv
parent 096ef695e1
commit d573adcf38

View File

@ -72,10 +72,35 @@ if (NOT DEFINED INSTALL_DIR)
set (INSTALL_DIR "${CMAKE_INSTALL_PREFIX}" CACHE PATH "${INSTALL_DIR_DESCR}")
endif()
if ("${INSTALL_DIR}" STREQUAL "")
get_filename_component (CMAKE_BINARY_DIR_PARENT ${CMAKE_BINARY_DIR} DIRECTORY)
set (INSTALL_DIR "${CMAKE_BINARY_DIR_PARENT}/install" CACHE PATH "${INSTALL_DIR_DESCR}" FORCE)
message (STATUS "Info: INSTALL_DIR has been set as ${INSTALL_DIR}")
if (NOT DEFINED CMAKE_INSTALL_PREFIX_PREV)
set (CMAKE_INSTALL_PREFIX_PREV "${CMAKE_INSTALL_PREFIX}" CACHE INTERNAL "" FORCE)
elseif (NOT "${CMAKE_INSTALL_PREFIX_PREV}" STREQUAL "${CMAKE_INSTALL_PREFIX}")
# CMAKE_INSTALL_PREFIX has been changed at previous step
set (CMAKE_INSTALL_PREFIX_PREV "${CMAKE_INSTALL_PREFIX}" CACHE INTERNAL "" FORCE)
# INSTALL_DIR is required to be updated
set (INSTALL_DIR "${CMAKE_INSTALL_PREFIX}" CACHE PATH "${INSTALL_DIR_DESCR}" FORCE)
endif()
if (NOT DEFINED INSTALL_DIR_PREV)
set (INSTALL_DIR_PREV "${INSTALL_DIR}" CACHE INTERNAL "" FORCE)
elseif (NOT "${INSTALL_DIR_PREV}" STREQUAL "${INSTALL_DIR}")
# INSTALL_DIR has been changed at previous step
set (INSTALL_DIR_PREV "${INSTALL_DIR}" CACHE INTERNAL "" FORCE)
# sync CMAKE_INSTALL_PREFIX with INSTALL_DIR
set (CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE)
# set CMAKE_INSTALL_PREFIX_PREV to avoid the reset of structure of the install folder
set (CMAKE_INSTALL_PREFIX_PREV "${INSTALL_DIR}" CACHE INTERNAL "" FORCE)
# The structure of install folder should be reset
OCCT_CHECK_AND_UNSET (INSTALL_BIN_DIR)
OCCT_CHECK_AND_UNSET (INSTALL_SCRIPT_DIR)
OCCT_CHECK_AND_UNSET (INSTALL_LIB_DIR)
OCCT_CHECK_AND_UNSET (INSTALL_INCLUDE_DIR)
OCCT_CHECK_AND_UNSET (INSTALL_OCCT_RESOURCE_DIR)
OCCT_CHECK_AND_UNSET (INSTALL_SHARE_DIR)
endif()
# hide CMAKE_INSTALL_PREFIX from a user