1
1
# The name of our project is "mFAST". CMakeLists files in this project can
2
2
# refer to the root source directory of the project as ${MFAST_SOURCE_DIR} and
3
3
# to the root binary directory of the project as ${MFAST_BINARY_DIR}.
4
- if (WIN32 )
4
+
5
+ if (MSVC_IDE )
5
6
cmake_minimum_required (VERSION 2.8.8)
6
7
else ()
7
8
cmake_minimum_required (VERSION 2.6.4)
@@ -10,7 +11,7 @@ endif()
10
11
project (mFAST)
11
12
12
13
set (MFAST_MAJOR_VERSION 1)
13
- set (MFAST_MINOR_VERSION 0 )
14
+ set (MFAST_MINOR_VERSION 2 )
14
15
set (MFAST_PATCH_VERSION 0)
15
16
set (MFAST_VERSION ${MFAST_MAJOR_VERSION} .${MFAST_MINOR_VERSION} .${MFAST_PATCH_VERSION} )
16
17
@@ -63,9 +64,9 @@ LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
63
64
# Select flags.
64
65
# Initialize CXXFLAGS.
65
66
if (CMAKE_COMPILER_IS_GNUCXX OR ("${CMAKE_CXX_COMPILER_ID} " STREQUAL "Clang" ))
66
- set (CMAKE_CXX_FLAGS "-W -Wall ${CMAKE_CXX_FLAGS} " )
67
+ set (CMAKE_CXX_FLAGS "-W -Wall ${CMAKE_CXX_FLAGS} " )
67
68
elseif (MSVC )
68
- add_definitions (/D_SCL_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS)
69
+ add_definitions (/D_SCL_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS)
69
70
endif ()
70
71
71
72
# variables to be used later
@@ -83,11 +84,11 @@ link_directories (${PROJECT_BINARY_DIR}/src)
83
84
# Install fast_type_gen batch file to set up the PATH environment
84
85
# variable for using BOOST libraries
85
86
86
- if (WIN32 )
87
+ if (MSVC_IDE )
87
88
configure_file (invoke.bat.in
88
89
"${PROJECT_BINARY_DIR} /bin/invoke.bat"
89
90
@ONLY)
90
- endif (WIN32 )
91
+ endif (MSVC_IDE )
91
92
92
93
#============================================================
93
94
# FASTTYPEGEN_TARGET (public macro)
@@ -96,26 +97,26 @@ endif(WIN32)
96
97
97
98
macro (FASTTYPEGEN_TARGET Name )
98
99
set (FASTTYPEGEN_TARGET_usage "FASTTYPEGEN_TARGET(<Name> Input1 Input2 ...]" )
99
-
100
+ set (INPUTS)
100
101
foreach (input ${ARGN} )
101
- get_filename_component (noext_name ${input} NAME_WE )
102
- set (FASTTYPEGEN_${Name} _INPUTS_NOEXT ${FASTTYPEGEN_${Name} _INPUTS_NOEXT} ${noext_name} )
102
+ get_filename_component (noext_name ${input} NAME_WE )
103
+ set (FASTTYPEGEN_${Name} _INPUTS_NOEXT ${FASTTYPEGEN_${Name} _INPUTS_NOEXT} ${noext_name} )
103
104
endforeach (input )
104
105
105
106
foreach (var ${FASTTYPEGEN_${Name} _INPUTS_NOEXT})
106
- 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)
107
+ 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)
107
108
endforeach (var)
108
109
109
110
foreach (input ${ARGN} )
110
- set (INPUTS ${INPUTS} ${CMAKE_CURRENT_SOURCE_DIR} /${input} )
111
+ set (INPUTS ${INPUTS} ${CMAKE_CURRENT_SOURCE_DIR} /${input} )
111
112
endforeach (input )
112
113
113
-
114
114
## Notice that the file copy operator is performed at the time when "cmake" is called and "Makefiles" are generated.
115
115
## Not at the time when "make" is called.
116
116
# file(COPY ${ARGN} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
117
117
118
- if (WIN32 )
118
+
119
+ if (MSVC_IDE )
119
120
add_custom_command (
120
121
OUTPUT ${FASTTYPEGEN_${Name} _OUTPUTS}
121
122
COMMAND ${PROJECT_BINARY_DIR} /bin/invoke.bat
@@ -145,14 +146,15 @@ endmacro()
145
146
# Recurse into the "src" and "unit-tests" subdirectories. This does not actually
146
147
# cause another cmake executable to run. The same process will walk through
147
148
# the project's entire directory structure.
149
+ enable_testing ()
148
150
149
151
add_subdirectory (tests)
150
152
151
153
if (BUILD_SHARED_LIBS )
152
- set (MFAST_LIBRARIES mfast_coder mfast)
154
+ set (MFAST_LIBRARIES mfast_coder mfast_xml_parser mfast)
153
155
add_definitions ( -DMFAST_DYN_LINK )
154
156
else ()
155
- set (MFAST_LIBRARIES mfast_coder_static mfast_static)
157
+ set (MFAST_LIBRARIES mfast_coder_static mfast_xml_parser_static mfast_static)
156
158
endif ()
157
159
158
160
add_subdirectory (examples)
@@ -170,11 +172,14 @@ add_custom_target(dist
170
172
# Provide mfast-config.cmake and mfast-config.version to be used by other applications
171
173
# ===============================
172
174
173
- export (PACKAGE ${CMAKE_PROJECT_NAME} )
175
+ if (NOT ${CMAKE_MAJOR_VERSION} .${CMAKE_MINOR_VERSION} LESS 2.8)
176
+ export (PACKAGE ${CMAKE_PROJECT_NAME} )
177
+ endif (NOT ${CMAKE_MAJOR_VERSION} .${CMAKE_MINOR_VERSION} LESS 2.8)
178
+
174
179
export (TARGETS fast_type_gen ${MFAST_LIBRARIES} FILE "${PROJECT_BINARY_DIR} /mFASTTargets.cmake" )
175
180
176
181
# Create the mFASTConfig.cmake for the build tree
177
- set (CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR} " "${PROJECT_BINARY_DIR} " )
182
+ set (CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR} /src " "${PROJECT_BINARY_DIR} " )
178
183
configure_file (mFASTConfig.cmake.in
179
184
"${PROJECT_BINARY_DIR} /mFASTConfig.cmake"
180
185
@ONLY)
@@ -199,3 +204,9 @@ install(FILES
199
204
200
205
# Install the export set for use with the install-tree
201
206
install (EXPORT mFASTTargets DESTINATION "${INSTALL_CMAKE_DIR} " COMPONENT dev)
207
+
208
+ FILE (GLOB schema_files "${CMAKE_CURRENT_SOURCE_DIR} /schema/*.*" )
209
+
210
+ install (FILES
211
+ ${schema_files}
212
+ DESTINATION ${INSTALL_DATA_DIR} /mfast)
0 commit comments