Skip to content
Snippets Groups Projects
Commit df0b47d0 authored by marco's avatar marco
Browse files

updated FindOPENSTRUCTURE script

the script now allows to specify components, say mol.
OPENSTRUCTURE_LIBRARIES will then only contain libraries of
modules specified.

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2139 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent 5a8301f9
No related branches found
No related tags found
No related merge requests found
......@@ -9,57 +9,79 @@
# OPENSTRUCTURE_LIBRARIES is set to the library and linker flags used to
# link against python
# OPENSTRUCTURE_VERSION is set to the version of OpenStructure
# OPENSTRUCTURE_INCLUDE_PATH is set to the path that contains base.hh
# OPENSTRUCTURE_INCLUDE_DIR is set to the path that contains base.hh
#
# Author: Valerio Mariani,Marco Biasini
# Author: Valerio Mariani, Marco Biasini
#-------------------------------------------------------------------------------
macro(find_OPENSTRUCTURE OPENSTRUCTURE_ROOT NAMES HEADER_NAMES)
if(OPENSTRUCTURE_ROOT)
find_library(OPENSTRUCTURE_LIBRARIES
NAMES "${NAMES}"
if (NOT OPENSTRUCTURE_FIND_COMPONENTS)
message(FATAL_ERROR "Please specify which modules of OpenStructure you "
"would like to use after the COMPONENTS keyword.")
endif()
list(APPEND OPENSTRUCTURE_FIND_COMPONENTS base geom)
list(REMOVE_DUPLICATES OPENSTRUCTURE_FIND_COMPONENTS)
foreach (LIB ${OPENSTRUCTURE_FIND_COMPONENTS})
set(FOUND_LIB FOUND_LIB-NOTFOUND)
find_library(FOUND_LIB
NAMES ost_${LIB}
HINTS "${PYTHON_ROOT}"
PATH_SUFFIXES lib
PATH ${OPENSTRUCTURE_ROOT}
PATH_SUFFIXES lib lib64
NO_SYSTEM_ENVIRONMENT_PATH NO_DEFAULT_PATH
)
find_path(OPENSTRUCTURE_INCLUDE_PATH
NAMES "${HEADER_NAMES}"
HINTS "${OPENSTRUCTURE_ROOT}/include"
NO_SYSTEM_ENVIRONMENT_PATH NO_DEFAULT_PATH
)
else()
find_library(OPENSTRUCTURE_LIBRARIES
NAMES "${NAMES}"
PATH_SUFFIXES lib
)
find_path(OPENSTRUCTURE_INCLUDE_PATH
NAMES "${HEADER_NAMES}"
PATH_SUFFIXES include
)
endif()
if (OPENSTRUCTURE_INCLUDE_PATH)
file(STRINGS ${OPENSTRUCTURE_INCLUDE_PATH}/boOPENSTRUCTURE/version.hh OPENSTRUCTURE_VERSIONSTR
REGEX "#define[ ]+OPENSTRUCTURE_VERSION_STRING+[ ]+[0-9]\.[0-9]\.[0-9]")
string(REGEX MATCH "[0-9].[0-9].[0-9]" OPENSTRUCTURE_VERSION ${OPENSTRUCTURE_VERSIONSTR})
endif()
if (NOT FOUND_LIB)
if (OPENSTRUCTURE_FIND_REQUIRED)
message(FATAL_ERROR "Could not find library ost_${LIB}. Please specify"
" the location of your OpenStructure installation with"
" OPENSTRUCTURE_ROOT")
endif()
else()
set(OPENSTRUCTURE_LIBRARIES ${OPENSTRUCTURE_LIBRARIES} ${FOUND_LIB})
endif()
endforeach()
find_path(OPENSTRUCTURE_INCLUDE_DIR
NAMES "${HEADER_NAMES}"
HINTS "${OPENSTRUCTURE_ROOT}/include"
NO_SYSTEM_ENVIRONMENT_PATH NO_DEFAULT_PATH
)
set(OPENSTRUCTURE_FOUND 1)
endmacro()
#-------------------------------------------------------------------------------
SET(LIBNAMES
ost_base
ost_gfx
ost_info
ost_qa
ost_conop
ost_gui
ost_io
ost_seq
ost_db
ost_img
ost_mol
ost_seq_alg
ost_geom
ost_img_alg
ost_mol_alg
)
find_OPENSTRUCTURE(OPENSTRUCTURE_ROOT "base" "OPENSTRUCTURE/config.hh")
find_OPENSTRUCTURE("${OPENSTRUCTURE_ROOT}" "${LIBNAMES}" "ost/config.hh")
mark_as_advanced(
OPENSTRUCTURE_LIBRARIES
OPENSTRUCTURE_INCLUDE_PATH
OPENSTRUCTURE_INCLUDE_DIR
OPENSTRUCTURE_VERSION
)
if (OPENSTRUCTURE_FOUND)
if (NOT OPENSTRUCTURE_FIND_QUIETLY)
message(STATUS "Found Openstructure: ${OPENSTRUCTURE_LIBRARY}")
endif ()
else (FOO_FOUND)
else (OPENSTRUCTURE_FOUND)
if (OPENSTRUCTURE_FIND_REQUIRED)
message(FATAL_ERROR "Could not find OpenStructure")
endif ()
endif ()
endif ()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment