Commit 266c5c55 authored by mat's avatar mat
Browse files

FIXED install root in FindCamiTK.cmake

git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@247 ec899d31-69d1-42ba-9299-647d76f65fb3
parent 01ae6505
......@@ -34,7 +34,11 @@ find_path(CAMITK_ROOT_DIR_GUESS
)
if (CAMITK_ROOT_DIR_GUESS)
set(CAMITK_IS_INSTALLED FALSE)
set(CAMITK_INSTALL_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/..) # default install dir
# if this directory was checkouted inside camitk-timc, CAMITK_INSTALL_ROOT could be already defined by CMake when camitk-timc/camitk was parsed/configured
# in this case, DO NOT reset CAMITK_INSTALL_ROOT
if (NOT CAMITK_INSTALL_ROOT)
set(CAMITK_INSTALL_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/..) # default install dir
endif()
# camitk is not installed yet, use build dir for include and libs
set(CAMITK_BUILD_ROOT ${CMAKE_CURRENT_BINARY_DIR}/..)
else()
......@@ -49,7 +53,7 @@ if (NOT CAMITK_INSTALL_ROOT)
set(CAMITK_INCLUDE_DIR_SUFFIX_TEMP "include/${CAMITK_SHORT_VERSION_STRING}/${CAMITK_CORE_LIB_TEMP}")
# find the caracteristic header using a (reasonably) long good list for the guess
find_path(CAMITK_ROOT_DIR_GUESS_INSTALLED
find_path(CAMITK_ROOT_DIR_GUESS
NAMES CamiTKAPI.h
PATHS "/usr"
"/usr/local"
......@@ -65,13 +69,13 @@ if (NOT CAMITK_INSTALL_ROOT)
PATH_SUFFIXES "${CAMITK_INCLUDE_DIR_SUFFIX_TEMP}"
)
mark_as_advanced(CAMITK_ROOT_DIR_GUESS_INSTALLED)
mark_as_advanced(CAMITK_ROOT_DIR_GUESS)
set(CAMITK_VERSION "${CAMITK_VER_MAJ}.${CAMITK_VER_MIN}" CACHE STRING "The CamiTK version to find")
# if guess is alright
if (CAMITK_ROOT_DIR_GUESS_INSTALLED)
string(REGEX REPLACE "${CAMITK_INCLUDE_DIR_SUFFIX_TEMP}" "" CAMITK_INSTALL_ROOT_TEMP ${CAMITK_ROOT_DIR_GUESS_INSTALLED})
if (CAMITK_ROOT_DIR_GUESS)
string(REGEX REPLACE "${CAMITK_INCLUDE_DIR_SUFFIX_TEMP}" "" CAMITK_INSTALL_ROOT_TEMP ${CAMITK_ROOT_DIR_GUESS})
set(CAMITK_INSTALL_ROOT ${CAMITK_INSTALL_ROOT_TEMP} CACHE PATH "${CAMITK_SHORT_VERSION_STRING} install root" FORCE)
else()
set(CAMITK_INSTALL_ROOT "" CACHE PATH "${CAMITK_SHORT_VERSION_STRING} install root")
......@@ -98,23 +102,21 @@ if(NOT ${CAMITK_INSTALL_ROOT} EQUAL "")
set (CAMITK_BIN_DIR ${CAMITK_INSTALL_ROOT}/bin CACHE PATH "CamiTK bin dir." FORCE)
set (CAMITK_LIB_DIR ${CAMITK_INSTALL_ROOT}/lib/${CAMITK_SHORT_VERSION_STRING} CACHE PATH "CamiTK lib dir." FORCE)
set (CAMITK_INCLUDE_DIR ${CAMITK_INSTALL_ROOT}/include/${CAMITK_SHORT_VERSION_STRING} CACHE PATH "CamiTK include dir." FORCE)
set (CAMITK_SHARE_DIR ${CAMITK_INSTALL_ROOT}/share/${CAMITK_SHORT_VERSION_STRING} CACHE PATH "CamiTK share dir." FORCE)
set (CAMITK_TESTDATA_DIR ${CAMITK_INSTALL_ROOT}/share/${CAMITK_SHORT_VERSION_STRING}/testdata CACHE PATH "CamiTK share dir. for test data" FORCE)
else()
# use build directory to get includes and lib
set (CAMITK_BIN_DIR ${CAMITK_BUILD_ROOT}/bin CACHE PATH "CamiTK bin dir." FORCE)
set (CAMITK_LIB_DIR ${CAMITK_BUILD_ROOT}/lib CACHE PATH "CamiTK lib dir." FORCE)
set (CAMITK_INCLUDE_DIR ${CAMITK_BUILD_ROOT}/include CACHE PATH "CamiTK include dir." FORCE)
set (CAMITK_SHARE_DIR ${CAMITK_INSTALL_ROOT}/share CACHE PATH "CamiTK share dir." FORCE)
set (CAMITK_TESTDATA_DIR ${CAMITK_BUILD_ROOT}/share/testdata CACHE PATH "CamiTK share dir. for test data" FORCE)
endif()
set (CAMITK_TESTDATA_DIR ${CAMITK_SHARE_DIR}/testdata CACHE PATH "CamiTK share dir. for test data" FORCE)
mark_as_advanced(CAMITK_BIN_DIR CAMITK_LIB_DIR CAMITK_INCLUDE_DIR CAMITK_SHARE_DIR CAMITK_TESTDATA_DIR)
mark_as_advanced(CAMITK_BIN_DIR CAMITK_LIB_DIR CAMITK_INCLUDE_DIR CAMITK_TESTDATA_DIR)
# Needed due to installation reason
link_directories(${CAMITK_LIB_DIR} ${CAMITK_INSTALL_ROOT}/lib)
link_directories(${CAMITK_INSTALL_ROOT}/lib)
# update module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CAMITK_SHARE_DIR}/cmake ${CAMITK_INSTALL_ROOT}/camitk/cmake/modules)
message(STATUS "module path=${CMAKE_MODULE_PATH}")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CAMITK_LIB_DIR}/cmake ${CAMITK_INSTALL_ROOT}/camitk/cmake/modules ${CMAKE_CURRENT_SOURCE_DIR}/../camitk/cmake/modules)
# include useful modules
include(CamiTKVariables)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment