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 @@ ...@@ -9,57 +9,79 @@
# OPENSTRUCTURE_LIBRARIES is set to the library and linker flags used to # OPENSTRUCTURE_LIBRARIES is set to the library and linker flags used to
# link against python # link against python
# OPENSTRUCTURE_VERSION is set to the version of OpenStructure # 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) macro(find_OPENSTRUCTURE OPENSTRUCTURE_ROOT NAMES HEADER_NAMES)
if(OPENSTRUCTURE_ROOT) if (NOT OPENSTRUCTURE_FIND_COMPONENTS)
find_library(OPENSTRUCTURE_LIBRARIES message(FATAL_ERROR "Please specify which modules of OpenStructure you "
NAMES "${NAMES}" "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}" HINTS "${PYTHON_ROOT}"
PATH_SUFFIXES lib PATH ${OPENSTRUCTURE_ROOT}
PATH_SUFFIXES lib lib64
NO_SYSTEM_ENVIRONMENT_PATH NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_DEFAULT_PATH
) )
find_path(OPENSTRUCTURE_INCLUDE_PATH if (NOT FOUND_LIB)
NAMES "${HEADER_NAMES}" if (OPENSTRUCTURE_FIND_REQUIRED)
HINTS "${OPENSTRUCTURE_ROOT}/include" message(FATAL_ERROR "Could not find library ost_${LIB}. Please specify"
NO_SYSTEM_ENVIRONMENT_PATH NO_DEFAULT_PATH " the location of your OpenStructure installation with"
) " OPENSTRUCTURE_ROOT")
else() endif()
find_library(OPENSTRUCTURE_LIBRARIES else()
NAMES "${NAMES}" set(OPENSTRUCTURE_LIBRARIES ${OPENSTRUCTURE_LIBRARIES} ${FOUND_LIB})
PATH_SUFFIXES lib endif()
)
find_path(OPENSTRUCTURE_INCLUDE_PATH endforeach()
NAMES "${HEADER_NAMES}"
PATH_SUFFIXES include find_path(OPENSTRUCTURE_INCLUDE_DIR
) NAMES "${HEADER_NAMES}"
endif() HINTS "${OPENSTRUCTURE_ROOT}/include"
if (OPENSTRUCTURE_INCLUDE_PATH) NO_SYSTEM_ENVIRONMENT_PATH NO_DEFAULT_PATH
file(STRINGS ${OPENSTRUCTURE_INCLUDE_PATH}/boOPENSTRUCTURE/version.hh OPENSTRUCTURE_VERSIONSTR )
REGEX "#define[ ]+OPENSTRUCTURE_VERSION_STRING+[ ]+[0-9]\.[0-9]\.[0-9]") set(OPENSTRUCTURE_FOUND 1)
string(REGEX MATCH "[0-9].[0-9].[0-9]" OPENSTRUCTURE_VERSION ${OPENSTRUCTURE_VERSIONSTR})
endif()
endmacro() 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( mark_as_advanced(
OPENSTRUCTURE_LIBRARIES OPENSTRUCTURE_LIBRARIES
OPENSTRUCTURE_INCLUDE_PATH OPENSTRUCTURE_INCLUDE_DIR
OPENSTRUCTURE_VERSION OPENSTRUCTURE_VERSION
) )
if (OPENSTRUCTURE_FOUND) if (OPENSTRUCTURE_FOUND)
if (NOT OPENSTRUCTURE_FIND_QUIETLY) if (NOT OPENSTRUCTURE_FIND_QUIETLY)
message(STATUS "Found Openstructure: ${OPENSTRUCTURE_LIBRARY}")
endif () endif ()
else (FOO_FOUND) else (OPENSTRUCTURE_FOUND)
if (OPENSTRUCTURE_FIND_REQUIRED) if (OPENSTRUCTURE_FIND_REQUIRED)
message(FATAL_ERROR "Could not find OpenStructure") message(FATAL_ERROR "Could not find OpenStructure")
endif () 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.
Please register or to comment