Commit ebcaee87 authored by Jan Möbius's avatar Jan Möbius
Browse files

added global cmake files

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5652 383ad7c9-94d9-4d36-a494-682f7c89f535
parent c745519f
# - Find FTGL
# Find the native FTGL headers and libraries.
#
# FTGL_INCLUDE_DIR - where to find FTGL.h, etc.
# FTGL_LIBRARIES - List of libraries when using FTGL.
# FTGL_FOUND - True if FTGL found.
GET_FILENAME_COMPONENT(module_file_path ${CMAKE_CURRENT_LIST_FILE} PATH )
# Look for the header file.
FIND_PATH(FTGL_INCLUDE_DIR NAMES FTGL/FTGL.h
PATHS /usr/include
/usr/local/include
../../External/include
${module_file_path}/../../../External/include)
MARK_AS_ADVANCED(FTGL_INCLUDE_DIR)
# Look for the library.
FIND_LIBRARY(FTGL_LIBRARY NAMES ftgl ftgl_dynamic_MTD
PATHS /usr/lib64
/usr/local/lib64
/usr/lib
/usr/local/lib
../../External/lib
${module_file_path}/../../../External/lib)
MARK_AS_ADVANCED(FTGL_LIBRARY)
IF( WIN32 AND PREFER_STATIC_LIBRARIES )
SET( FTGL_STATIC_LIBRARY_NAME ftgl_static_MTD )
IF( MSVC80 )
SET( FTGL_STATIC_LIBRARY_NAME ftgl_static_MTD_vc8 )
ELSEIF( MSVC90 )
SET( FTGL_STATIC_LIBRARY_NAME ftgl_static_MTD_vc9 )
ENDIF( MSVC80 )
FIND_LIBRARY( FTGL_STATIC_LIBRARY NAMES ${FTGL_STATIC_LIBRARY_NAME}
PATHS /usr/lib64
/usr/local/lib64
/usr/lib
/usr/local/lib
../../External/lib
${module_file_path}/../../../External/lib )
MARK_AS_ADVANCED(FTGL_STATIC_LIBRARY)
FIND_LIBRARY( FTGL_STATIC_DEBUG_LIBRARY NAMES ${FTGL_STATIC_LIBRARY_NAME}_d
PATHS /usr/lib64
/usr/local/lib64
/usr/lib
/usr/local/lib
../../External/lib
${module_file_path}/../../../External/lib )
MARK_AS_ADVANCED(FTGL_STATIC_DEBUG_LIBRARY)
IF( FTGL_STATIC_LIBRARY OR FTGL_STATIC_DEBUG_LIBRARY )
SET( FTGL_STATIC_LIBRARIES_FOUND 1 )
ENDIF( FTGL_STATIC_LIBRARY OR FTGL_STATIC_DEBUG_LIBRARY )
ENDIF( WIN32 AND PREFER_STATIC_LIBRARIES )
IF( FTGL_LIBRARY OR FTGL_STATIC_LIBRARIES_FOUND )
SET( FTGL_LIBRARIES_FOUND 1 )
ENDIF( FTGL_LIBRARY OR FTGL_STATIC_LIBRARIES_FOUND )
# Copy the results to the output variables.
IF(FTGL_INCLUDE_DIR AND FTGL_LIBRARIES_FOUND)
SET(FTGL_FOUND 1)
IF( WIN32 AND PREFER_STATIC_LIBRARIES AND FTGL_STATIC_LIBRARIES_FOUND )
IF(FTGL_STATIC_LIBRARY)
SET(FTGL_LIBRARIES optimized ${FTGL_STATIC_LIBRARY} )
ELSE(FTGL_STATIC_LIBRARY)
SET(FTGL_LIBRARIES optimized ${FTGL_STATIC_LIBRARY_NAME} )
MESSAGE( STATUS, "FTGL static release libraries not found. Release build might not work." )
ENDIF(FTGL_STATIC_LIBRARY)
IF(FTGL_STATIC_DEBUG_LIBRARY)
SET(FTGL_LIBRARIES ${FTGL_LIBRARIES} debug ${FTGL_STATIC_DEBUG_LIBRARY} )
ELSE(FTGL_STATIC_DEBUG_LIBRARY)
SET(FTGL_LIBRARIES ${FTGL_LIBRARIES} debug ${FTGL_STATIC_LIBRARY_NAME}_d )
MESSAGE( STATUS, "FTGL static debug libraries not found. Debug build might not work." )
ENDIF(FTGL_STATIC_DEBUG_LIBRARY)
SET( FTGL_LIBRARY_STATIC 1 )
ELSE( WIN32 AND PREFER_STATIC_LIBRARIES AND FTGL_STATIC_LIBRARIES_FOUND )
SET(FTGL_LIBRARIES ${FTGL_LIBRARY})
ENDIF( WIN32 AND PREFER_STATIC_LIBRARIES AND FTGL_STATIC_LIBRARIES_FOUND )
SET(FTGL_INCLUDE_DIR ${FTGL_INCLUDE_DIR})
ELSE(FTGL_INCLUDE_DIR AND FTGL_LIBRARIES_FOUND)
SET(FTGL_FOUND 0)
SET(FTGL_LIBRARIES)
SET(FTGL_INCLUDE_DIR)
ENDIF(FTGL_INCLUDE_DIR AND FTGL_LIBRARIES_FOUND)
# Report the results.
IF(NOT FTGL_FOUND)
SET(FTGL_DIR_MESSAGE
"FTGL was not found. Make sure FTGL_LIBRARY and FTGL_INCLUDE_DIR are set to the directories containing the include and lib files for FTGL. If you do not have the library you will not be able to use the Text node.")
IF(FTGL_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "${FTGL_DIR_MESSAGE}")
ELSEIF(NOT FTGL_FIND_QUIETLY)
MESSAGE(STATUS "${FTGL_DIR_MESSAGE}")
ELSE(NOT FTGL_FIND_QUIETLY)
ENDIF(FTGL_FIND_REQUIRED)
ENDIF(NOT FTGL_FOUND)
# - Try to find GLEW
# Once done this will define
#
# GLEW_FOUND - system has GLEW
# GLEW_INCLUDE_DIR - the GLEW include directory
# GLEW_LIBRARY_DIR - where the libraries are
# GLEW_LIBRARY - Link these to use GLEW
#
IF (GLEW_INCLUDE_DIR)
# Already in cache, be silent
SET(GLEW_FIND_QUIETLY TRUE)
ENDIF (GLEW_INCLUDE_DIR)
if( WIN32 )
if( MSVC80 )
set( COMPILER_PATH "C:/Program\ Files/Microsoft\ Visual\ Studio\ 8/VC" )
endif( MSVC80 )
if( MSVC71 )
set( COMPILER_PATH "C:/Program\ Files/Microsoft\ Visual\ Studio\ .NET\ 2003/Vc7" )
endif( MSVC71 )
FIND_PATH( GLEW_INCLUDE_DIR gl/glew.h gl/wglew.h
PATHS c:/glew/include ${COMPILER_PATH}/PlatformSDK/Include )
SET( GLEW_NAMES glew32 )
FIND_LIBRARY( GLEW_LIBRARY
NAMES ${GLEW_NAMES}
PATHS c:/glew/lib ${COMPILER_PATH}/PlatformSDK/Lib )
else( WIN32 )
FIND_PATH( GLEW_INCLUDE_DIR glew.h wglew.h
PATHS /usr/local/include /usr/include
PATH_SUFFIXES gl/ GL/ )
SET( GLEW_NAMES glew GLEW )
FIND_LIBRARY( GLEW_LIBRARY
NAMES ${GLEW_NAMES}
PATHS /usr/lib /usr/local/lib )
endif( WIN32 )
GET_FILENAME_COMPONENT( GLEW_LIBRARY_DIR ${GLEW_LIBRARY} PATH )
IF (GLEW_INCLUDE_DIR AND GLEW_LIBRARY)
SET(GLEW_FOUND TRUE)
SET( GLEW_LIBRARY_DIR ${GLEW_LIBRARY} )
ELSE (GLEW_INCLUDE_DIR AND GLEW_LIBRARY)
SET( GLEW_FOUND FALSE )
SET( GLEW_LIBRARY_DIR )
ENDIF (GLEW_INCLUDE_DIR AND GLEW_LIBRARY)
# - Finds OpenMP support
# This module can be used to detect OpenMP support in a compiler.
# If the compiler supports OpenMP, the flags required to compile with
# openmp support are set.
#
# The following variables are set:
# OpenMP_C_FLAGS - flags to add to the C compiler for OpenMP support
# OpenMP_CXX_FLAGS - flags to add to the CXX compiler for OpenMP support
# OPENMP_FOUND - true if openmp is detected
#
# Supported compilers can be found at http://openmp.org/wp/openmp-compilers/
# Copyright 2008, 2009 <André Rigland Brodtkorb> Andre.Brodtkorb@ifi.uio.no
#
# Redistribution AND use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
include(CheckCSourceCompiles)
include(CheckCXXSourceCompiles)
include(FindPackageHandleStandardArgs)
set(OpenMP_C_FLAG_CANDIDATES
#Gnu
"-fopenmp"
#Microsoft Visual Studio
"/openmp"
#Intel windows
"-Qopenmp"
#Intel
"-openmp"
#Empty, if compiler automatically accepts openmp
" "
#Sun
"-xopenmp"
#HP
"+Oopenmp"
#IBM XL C/c++
"-qsmp"
#Portland Group
"-mp"
)
set(OpenMP_CXX_FLAG_CANDIDATES ${OpenMP_C_FLAG_CANDIDATES})
# sample openmp source code to test
set(OpenMP_C_TEST_SOURCE
"
#include <omp.h>
int main() {
#ifdef _OPENMP
return 0;
#else
breaks_on_purpose
#endif
}
")
# use the same source for CXX as C for now
set(OpenMP_CXX_TEST_SOURCE ${OpenMP_C_TEST_SOURCE})
# if these are set then do not try to find them again,
# by avoiding any try_compiles for the flags
if(DEFINED OpenMP_C_FLAGS AND DEFINED OpenMP_CXX_FLAGS)
set(OpenMP_C_FLAG_CANDIDATES)
set(OpenMP_CXX_FLAG_CANDIDATES)
endif(DEFINED OpenMP_C_FLAGS AND DEFINED OpenMP_CXX_FLAGS)
# check c compiler
foreach(FLAG ${OpenMP_C_FLAG_CANDIDATES})
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_FLAGS "${FLAG}")
set(OpenMP_C_FLAG_DETECTED)
message(STATUS "Try OpenMP C flag = [${FLAG}]")
check_c_source_compiles("${OpenMP_CXX_TEST_SOURCE}" OpenMP_C_FLAG_DETECTED)
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
if(OpenMP_C_FLAG_DETECTED)
set(OpenMP_C_FLAGS_INTERNAL "${FLAG}")
break()
endif(OpenMP_C_FLAG_DETECTED)
endforeach(FLAG ${OpenMP_C_FLAG_CANDIDATES})
# check cxx compiler
foreach(FLAG ${OpenMP_CXX_FLAG_CANDIDATES})
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_FLAGS "${FLAG}")
set(OpenMP_CXX_FLAG_DETECTED)
message(STATUS "Try OpenMP CXX flag = [${FLAG}]")
check_cxx_source_compiles("${OpenMP_C_TEST_SOURCE}" OpenMP_CXX_FLAG_DETECTED)
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
if(OpenMP_CXX_FLAG_DETECTED)
set(OpenMP_CXX_FLAGS_INTERNAL "${FLAG}")
break()
endif(OpenMP_CXX_FLAG_DETECTED)
endforeach(FLAG ${OpenMP_CXX_FLAG_CANDIDATES})
set(OpenMP_C_FLAGS "${OpenMP_C_FLAGS_INTERNAL}"
CACHE STRING "C compiler flags for OpenMP parallization")
set(OpenMP_CXX_FLAGS "${OpenMP_CXX_FLAGS_INTERNAL}"
CACHE STRING "C++ compiler flags for OpenMP parallization")
# handle the standard arguments for find_package
find_package_handle_standard_args(OpenMP DEFAULT_MSG
OpenMP_C_FLAGS OpenMP_CXX_FLAGS )
mark_as_advanced(
OpenMP_C_FLAGS
OpenMP_CXX_FLAGS
)
if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
message (SEND_ERROR "Building in the source directory is not supported.")
message (FATAL_ERROR "Please remove the created \"CMakeCache.txt\" file, the \"CMakeFiles\" directory and create a build directory and call \"${CMAKE_COMMAND} <path to the sources>\".")
endif ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
set (CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
mark_as_advanced (CMAKE_CONFIGURATION_TYPES)
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Debug CACHE STRING
"Choose the type of build, options are: Debug, Release."
FORCE)
endif ()
if (NOT EXISTS ${CMAKE_BINARY_DIR}/Build)
file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Build)
endif ()
include (AddFileDependencies)
include (compiler)
add_definitions (-DINCLUDE_TEMPLATES)
if (WIN32)
set (OPENFLIPPER_APPDIR ".")
set (OPENFLIPPER_DATADIR ".")
set (OPENFLIPPER_PLUGINDIR "Plugins")
set (OPENFLIPPER_LIBDIR ".")
set (OPENFLIPPER_BINDIR ".")
add_definitions(
-D_USE_MATH_DEFINES -DNOMINMAX
-DOPENFLIPPER_APPDIR="${OPENFLIPPER_APPDIR}"
-DOPENFLIPPER_PLUGINDIR="${OPENFLIPPER_PLUGINDIR}"
-DOPENFLIPPER_DATADIR="${OPENFLIPPER_DATADIR}"
)
else ()
set (OPENFLIPPER_APPDIR "..")
set (OPENFLIPPER_DATADIR "share/OpenFlipper")
set (OPENFLIPPER_PLUGINDIR "lib/OpenFlipper/plugins")
set (OPENFLIPPER_LIBDIR "lib/OpenFlipper")
set (OPENFLIPPER_BINDIR "bin")
add_definitions(
-DOPENFLIPPER_APPDIR="${OPENFLIPPER_APPDIR}"
-DOPENFLIPPER_PLUGINDIR="${OPENFLIPPER_PLUGINDIR}"
-DOPENFLIPPER_DATADIR="${OPENFLIPPER_DATADIR}"
)
endif ()
macro (set_target_props target)
if (WIN32)
set_target_properties (
${target} PROPERTIES
BUILD_WITH_INSTALL_RPATH 1
SKIP_BUILD_RPATH 0
)
else ()
set_target_properties (
${target} PROPERTIES
INSTALL_RPATH "$ORIGIN/../lib/OpenFlipper"
BUILD_WITH_INSTALL_RPATH 1
SKIP_BUILD_RPATH 0
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_BINDIR}"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_LIBDIR}"
)
endif ()
endmacro ()
if (NOT QT4_FOUND)
find_package (Qt4 REQUIRED 4.5)
set (QT_USE_QTOPENGL 1)
set (QT_USE_QTNETWORK 1)
set (QT_USE_QTSCRIPT 1)
set (QT_USE_QTSQL 1)
set (QT_USE_QTWEBKIT 1)
set (QT_USE_QTUITOOLS 1)
include (${QT_USE_FILE})
endif ()
# unsets the given variable
macro (of_unset var)
set (${var} "" CACHE INTERNAL "")
endmacro ()
# sets the given variable
macro (of_set var value)
set (${var} ${value} CACHE INTERNAL "")
endmacro ()
if (NOT OPENMP_NOTFOUND)
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
add_definitions(-DUSE_OPENMP)
else ()
set (OPENMP_NOTFOUND 1)
endif ()
endif ()
macro (ftgl)
find_package (Freetype)
if (FREETYPE_FOUND)
find_package (FTGL)
if (FTGL_FOUND)
add_definitions (-DUSE_FTGL)
include_directories (${FTGL_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIR_freetype2})
set (FTGL_LIBS ${FREETYPE_LIBRARIES} ${FTGL_LIBRARIES})
endif ()
endif ()
endmacro ()
# append all files with extension "ext" in the "dirs" directories to "ret"
macro (append_files ret ext)
foreach (_dir ${ARGN})
file (GLOB _files "${_dir}/${ext}")
list (APPEND ${ret} ${_files})
endforeach ()
endmacro ()
macro (append_files_recursive ret ext)
foreach (_dir ${ARGN})
file (GLOB_RECURSE _files "${_dir}/${ext}")
list (APPEND ${ret} ${_files})
endforeach ()
endmacro ()
macro (drop_templates list)
foreach (_file ${${list}})
if (_file MATCHES "T.cc$")
list (REMOVE_ITEM ${list} ${_file})
endif ()
endforeach ()
endmacro ()
macro (qt4_automoc moc_SRCS)
qt4_get_moc_flags (_moc_INCS)
set (_matching_FILES )
foreach (_current_FILE ${ARGN})
get_filename_component (_abs_FILE ${_current_FILE} ABSOLUTE)
# if "SKIP_AUTOMOC" is set to true, we will not handle this file here.
# here. this is required to make bouic work correctly:
# we need to add generated .cpp files to the sources (to compile them),
# but we cannot let automoc handle them, as the .cpp files don't exist yet when
# cmake is run for the very first time on them -> however the .cpp files might
# exist at a later run. at that time we need to skip them, so that we don't add two
# different rules for the same moc file
get_source_file_property (_skip ${_abs_FILE} SKIP_AUTOMOC)
if ( NOT _skip AND EXISTS ${_abs_FILE} )
file (READ ${_abs_FILE} _contents)
get_filename_component (_abs_PATH ${_abs_FILE} PATH)
string (REGEX MATCHALL "Q_OBJECT" _match "${_contents}")
if (_match)
get_filename_component (_basename ${_current_FILE} NAME_WE)
set (_header ${_abs_FILE})
set (_moc ${CMAKE_CURRENT_BINARY_DIR}/moc_${_basename}.cpp)
add_custom_command (OUTPUT ${_moc}
COMMAND ${QT_MOC_EXECUTABLE}
ARGS ${_moc_INCS} ${_header} -o ${_moc}
DEPENDS ${_header}
)
add_file_dependencies (${_abs_FILE} ${_moc})
set (${moc_SRCS} ${${moc_SRCS}} ${_moc})
endif ()
endif ()
endforeach ()
endmacro ()
macro (qt4_autouic uic_SRCS)
set (_matching_FILES )
foreach (_current_FILE ${ARGN})
get_filename_component (_abs_FILE ${_current_FILE} ABSOLUTE)
if ( EXISTS ${_abs_FILE} )
file (READ ${_abs_FILE} _contents)
get_filename_component (_abs_PATH ${_abs_FILE} PATH)
get_filename_component (_basename ${_current_FILE} NAME_WE)
string (REGEX REPLACE "Ui$" "" _cbasename ${_basename})
set (_outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${_basename}.hh)
set (_header ${_basename}.hh)
set (_source ${_abs_PATH}/${_cbasename}.cc)
add_custom_command (OUTPUT ${_outfile}
COMMAND ${QT_UIC_EXECUTABLE}
ARGS -o ${_outfile} ${_abs_FILE}
DEPENDS ${_abs_FILE})
add_file_dependencies (${_source} ${_outfile})
set (${uic_SRCS} ${${uic_SRCS}} ${_outfile})
endif ()
endforeach ()
endmacro ()
function (add_plugins)
file (
GLOB _plugins_in
RELATIVE "${CMAKE_SOURCE_DIR}"
"${CMAKE_SOURCE_DIR}/Plugin-*/CMakeLists.txt"
)
foreach (_plugin ${_plugins_in})
get_filename_component (_plugin_dir ${_plugin} PATH)
add_subdirectory (${CMAKE_SOURCE_DIR}/${_plugin_dir})
endforeach ()
endfunction ()
################################################################################
# Custom settings for compiler flags and similar
################################################################################
if (UNIX)
set (CMAKE_CFLAGS_RELEASE "-O3 -DINCLUDE_TEMPLATES -W -Wall -Wno-unused -DNDEBUG")
set (CMAKE_CXX_FLAGS_RELEASE "-O3 -DINCLUDE_TEMPLATES -ftemplate-depth-100 -W -Wall -Wno-unused -DNDEBUG")
set (CMAKE_C_FLAGS_DEBUG "-g -DINCLUDE_TEMPLATES -W -Wall -Wno-unused -DDEBUG")
set (CMAKE_CXX_FLAGS_DEBUG "-g -DINCLUDE_TEMPLATES -ftemplate-depth-100 -W -Wall -Wno-unused -DDEBUG")
if (APPLE)
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wno-non-virtual-dtor)")
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wno-non-virtual-dtor)")
endif ()
endif ()
\ No newline at end of file
# This module provides the following macro:
#
# openflipper_plugin ( [DIRS dir1 dir2 ...]
# [DEPS dep1 dep2 ...]
# [OPTDEPS dep1 dep2 ...]
# [LDFLAGSADD flag1 flag2 ...]
# [CFLAGSADD flag1 flag2 ...]
# [LIBRARIES lib1 lib2 ...]
# [LIBDIRS dir1 dir2 ...]
# [INCDIRS dir1 dir2 ...])
#
# DIRS = additional directories with source files
# DEPS = required dependencies for find_package macro
# OPTDEPS = optional dependencies for find_package macro
# LDFLAGSADD = flags added to the link command
# CFLAGSADD = flags added to the compile command
# LIBRARIES = libraries added to link command
# LIBDIRS = additional link directories
# INCDIRS = additional include directories
include (common)
# get plugin name from directory name
macro (_get_plugin_name var)
string (REGEX MATCH "Plugin-.+[/\\]?$" _dir ${CMAKE_CURRENT_SOURCE_DIR})
string (REPLACE "Plugin-" "" ${var} ${_dir})
endmacro ()
# parse plugin macro parameter
macro (_get_plugin_parameters _prefix)
set (_current_var _foo)
set (_supported_var DIRS DEPS OPTDEPS LDFLAGSADD CFLAGSADD LIBRARIES LIBDIRS INCDIRS)
foreach (_val ${_supported_var})
set (${_prefix}_${_val})
endforeach ()
foreach (_val ${ARGN})
set (_found FALSE)
foreach (_find ${_supported_var})
if ("${_find}" STREQUAL "${_val}")
set (_found TRUE)
endif ()
endforeach ()
if (_found)
set (_current_var ${_prefix}_${_val})
else ()
list (APPEND ${_current_var} ${_val})
endif ()
endforeach ()
endmacro ()
# check dependencies
macro (_check_plugin_deps _prefix)
set (${_prefix}_HAS_DEPS TRUE)
foreach (_val ${ARGN})
string (TOUPPER ${_val} _VAL)
find_package(${_val})
if (${_val}_FOUND OR ${_VAL}_FOUND)
foreach (_name ${_val} ${_VAL})
if (DEFINED ${_name}_INCLUDE_DIRS)
list (APPEND ${_prefix}_DEPS_INCDIRS "${${_name}_INCLUDE_DIRS}")
endif ()
if (DEFINED ${_name}_LIBRARY_DIRS)
list (APPEND ${_prefix}_DEPS_LIBDIRS "${${_name}_LIBRARY_DIRS}")
endif ()
if (DEFINED ${_name}_LIBRARIES)
list (APPEND ${_prefix}_DEPS_LIBRARIES "${${_name}_LIBRARIES}")
endif ()
if (DEFINED ${_name}_LINKER_FLAGS)
list (APPEND ${_prefix}_DEPS_LINKER_FLAGS "${${_name}_LINKER_FLAGS}")
endif ()
endforeach ()
else ()
set (${_prefix}_HAS_DEPS FALSE)
of_set (_${_prefix}_MISSING_DEPS "${_${_prefix}_MISSING_DEPS} ${_val}")
endif ()
endforeach ()
endmacro ()
# main function
function (_build_openflipper_plugin plugin)
find_package (OpenGL)
find_package (GLUT)
find_package (GLEW)
string (TOUPPER ${plugin} _PLUGIN)
_get_plugin_parameters (${_PLUGIN} ${ARGN})
# check dependencies
of_unset (_${_PLUGIN}_MISSING_DEPS)
set (${_PLUGIN}_HAS_DEPS)
_check_plugin_deps (${_PLUGIN} ${${_PLUGIN}_OPTDEPS})
of_unset (_${_PLUGIN}_MISSING_DEPS)
set (${_PLUGIN}_HAS_DEPS)
_check_plugin_deps (${_PLUGIN} ${${_PLUGIN}_DEPS})
if (${_PLUGIN}_HAS_DEPS)
include_directories (
.
${CMAKE_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${${_PLUGIN}_DEPS_INCDIRS}
${${_PLUGIN}_INCDIRS}
${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}
${GLUT_INCLUDE_DIR}
)
link_directories (
${${_PLUGIN}_DEPS_LIBDIRS}
${${_PLUGIN}_LIBDIRS}
)
set (directories
.
${${_PLUGIN}_DIRS}