forked from gdoglz/MAF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UseMAF.cmake.in
102 lines (86 loc) · 4.21 KB
/
UseMAF.cmake.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#
# This file sets up the include directories, link directories and compiler
# settings for a project to use MAF. Such projects could provide new
# MAF modules built against a MAF build tree or a MAF installation.
#
# Relax some constraints related to the build settings file. This was
# preventing people from using the same compiler but with a different generator,
# or just the same compiler installed in a non-standard location.
# Add compiler flags needed to use MAF.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MAF_REQUIRED_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MAF_REQUIRED_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MAF_REQUIRED_LINK_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${MAF_REQUIRED_LINK_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${MAF_REQUIRED_LINK_FLAGS}")
if(NOT DEFINED BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ${MAF_BUILD_SHARED})
endif(NOT DEFINED BUILD_SHARED_LIBS)
# Add include directories needed to use MAF.
include_directories(BEFORE
${MAF_INCLUDE_DIRS}
)
# Add link directories needed to use MAF.
link_directories(
${MAF_LIBRARY_DIRS}
)
# Some people use Mesa instead of the default system OpenGL.
# Try to help them a little.
#if(NOT WIN32)
# foreach(dependency ${vtkftgl_LIB_DEPENDS})
# get_filename_component(dependency_lib "${dependency}" NAME_WE)
# if(dependency_lib STREQUAL "libGL")
# get_filename_component(OPENGL_gl_LIBRARY_PATH "${dependency}" PATH)
# link_directories("${OPENGL_gl_LIBRARY_PATH}")
# endif(dependency_lib STREQUAL "libGL")
# endforeach(dependency)
#endif(NOT WIN32)
#
INCLUDE(ExternalProject)
get_filename_component(CUR_ABSOLUTE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
include("${CUR_ABSOLUTE_DIR}/../MAFConfig.cmake")
# Add cmake module path.
set(CMAKE_MODULE_PATH "${MAF_ROOT_DIR}/CMake")
include(${CMAKE_MODULE_PATH}/mafCopySharedLibrariesInInstallDir.cmake)
include(${CMAKE_MODULE_PATH}/mafMacroInitProject.cmake)
include(${CMAKE_MODULE_PATH}/mafMacroInstallProject.cmake)
include(${CMAKE_MODULE_PATH}/mafMacroInstallPlugin.cmake)
include(${CMAKE_MODULE_PATH}/mafMacroSetupQt.cmake)
include(${CMAKE_MODULE_PATH}/mafMacroWrapTargetFiles.cmake)
include(${CMAKE_MODULE_PATH}/mafMacroTargetLibraries.cmake)
include(${CMAKE_MODULE_PATH}/mafCopyFilesFromExtension.cmake)
#############################################################################################
# QT
#############################################################################################
mafMacroSetupQt()
# Update MAF_BASE_LIBRARIES with QT libraries
IF(QT4_FOUND)
SET(MAF_BASE_LIBRARIES ${QT_LIBRARIES} CACHE INTERNAL "MAF base libraries" FORCE)
ENDIF()
#############################################################################################
### SET the target directories for libraries and executables
#############################################################################################
SET (LIBRARY_OUTPUT_PATH ${MAF_BIN_DIRS_CONFIG} CACHE INTERNAL
"Single output directory for building all libraries.")
SET (EXECUTABLE_OUTPUT_PATH ${MAF_BIN_DIRS_CONFIG} CACHE INTERNAL
"Single output directory for building all executables.")
SET(ep_base "${CMAKE_BINARY_DIR}/ExternalLibraries")
#############################################################################################
### find project subdirs and add include directories to the project
#############################################################################################
FILE(GLOB dir_list "${MAF_SRC_DIRS}/*")
FOREACH(dir_name ${dir_list})
FILE(RELATIVE_PATH local_dir_name "${PROJECT_SOURCE_DIR}" ${dir_name})
IF(IS_DIRECTORY ${dir_name})
INCLUDE_DIRECTORIES("${dir_name}")
ENDIF(IS_DIRECTORY ${dir_name})
ENDFOREACH(dir_name ${dir_list})
FOREACH(dir_name ${dir_list})
get_filename_component(internal_path ${dir_name} NAME)
IF(IS_DIRECTORY "${MAF_INTERNAL_BUILD_DIR}/src/${internal_path}")
INCLUDE_DIRECTORIES("${MAF_INTERNAL_BUILD_DIR}/src/${internal_path}")
#message(STATUS ">>>>>> ${MAF_INTERNAL_BUILD_DIR}/src/${internal_path}")
ENDIF(IS_DIRECTORY "${MAF_INTERNAL_BUILD_DIR}/src/${internal_path}")
ENDFOREACH(dir_name ${dir_list})
IF(PYTHONLIBS_FOUND)
INCLUDE_DIRECTORIES("${PYTHON_INCLUDE_DIR}")
ENDIF(PYTHONLIBS_FOUND)