forked from objectcomputing/mFAST
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmFASTConfig.cmake.in
95 lines (74 loc) · 3.2 KB
/
mFASTConfig.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
# Config file for the mFAST package
# It defines the following variables
# MFAST_INCLUDE_DIR - include directories for mFAST
# MFAST_LIBRARY_DIRS - library directories for mFAST
# MFAST_LIBRARIES - libraries to link against
# MFAST_COMPONENTS - installed components
# MFAST_<component>_LIBRARY - particular component library
# MFAST_EXECUTABLE - the fast_type_gen executable
# Compute paths
get_filename_component(MFAST_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
include("${MFAST_CMAKE_DIR}/mFASTTargets.cmake")
find_package( Boost 1.55.0 )
set(MFAST_INCLUDE_DIR ${Boost_INCLUDE_DIR} "@CONF_INCLUDE_DIRS@")
set(MFAST_LIBRARY_DIRS "@CONF_LIBRARY_DIRS@")
list(REMOVE_DUPLICATES MFAST_INCLUDE_DIR)
set(MFAST_EXECUTABLE @FAST_TYPE_GEN_INSTALL_LOCATION@)
# These are IMPORTED targets created by mFASTTargets.cmake
set(MFAST_FOUND "TRUE")
if (NOT DEFINED MFAST_USE_STATIC_LIBS OR MFAST_USE_STATIC_LIBS)
set(STATIC_SUFFIX "_static")
set(components @MFAST_STATIC_COMPONENTS@)
else()
add_definitions(-DMFAST_DYN_LINK)
set(components @MFAST_DYNAMIC_COMPONENTS@)
endif()
foreach(entry ${mFAST_FIND_COMPONENTS})
foreach(component ${components})
if ("${entry}${STATIC_SUFFIX}" STREQUAL ${component})
set(MFAST_${entry}_FOUND Yes)
endif()
endforeach()
if (MFAST_${entry}_FOUND)
list(REMOVE_ITEM mFAST_FIND_COMPONENTS ${entry})
list(APPEND MFAST_LIBRARIES mfast_${entry}${STATIC_SUFFIX})
set(MFAST_USED_COMPONENTS "${MFAST_USED_COMPONENTS} ${entry}")
set(MFAST_${entry}_LIBRARY mfast_${entry}${STATIC_SUFFIX})
else()
message( SEND_ERROR "mFAST component ${entry} NOT FOUND! Available components: ${components}" )
endif()
endforeach()
list(APPEND MFAST_LIBRARIES "mfast${STATIC_SUFFIX}")
#============================================================
# FASTTYPEGEN_TARGET (public macro)
#============================================================
#
macro(FASTTYPEGEN_TARGET Name)
set(FASTTYPEGEN_TARGET_usage "FASTTYPEGEN_TARGET(<Name> Input1 Input2 ...]")
foreach (input ${ARGN})
get_filename_component(noext_name ${input} NAME_WE)
set(FASTTYPEGEN_${Name}_INPUTS_NOEXT ${FASTTYPEGEN_${Name}_INPUTS_NOEXT} ${noext_name})
endforeach(input)
foreach(var ${FASTTYPEGEN_${Name}_INPUTS_NOEXT})
set(FASTTYPEGEN_${Name}_OUTPUTS ${FASTTYPEGEN_${Name}_OUTPUTS} ${CMAKE_CURRENT_BINARY_DIR}/${var}.cpp ${CMAKE_CURRENT_BINARY_DIR}/${var}.h ${CMAKE_CURRENT_BINARY_DIR}/${var}.inl)
endforeach(var)
foreach (input ${ARGN})
set(INPUTS ${INPUTS} ${CMAKE_CURRENT_SOURCE_DIR}/${input})
endforeach(input)
add_custom_command(
OUTPUT ${FASTTYPEGEN_${Name}_OUTPUTS}
COMMAND ${MFAST_EXECUTABLE}
ARGS ${INPUTS}
DEPENDS ${ARGN}
COMMENT "[FASTTYPEGEN][${Name}] Building Fast Application Types"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
set(FASTTYPEGEN_${Name}_DEFINED TRUE)
set(FASTTYPEGEN_${Name}_INPUTS ${ARGN})
endmacro()
#============================================================
message("mFAST Found! Used components:${MFAST_USED_COMPONENTS}")
message("Used libraries: ${MFAST_LIBRARIES}")
if (CMAKE_COMPILER_IS_GNUCXX OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
add_definitions(-std=c++11)
endif()