-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
105 lines (86 loc) · 3.35 KB
/
CMakeLists.txt
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
103
104
105
cmake_minimum_required(VERSION 2.8)
PROJECT(libsdo)
FIND_PACKAGE(BISON REQUIRED)
FIND_PACKAGE(FLEX REQUIRED)
FIND_PACKAGE(Boost COMPONENTS system filesystem locale REQUIRED)
IF(BISON_FOUND AND FLEX_FOUND)
FOREACH(Prefix Mdl Voc Vpd Vop)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${Prefix}Parser.cpp
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/sdo/${Prefix}Parser.y
COMMAND ${BISON_EXECUTABLE} -v
-d -o ${CMAKE_CURRENT_BINARY_DIR}/${Prefix}Parser.cpp
--name-prefix ${Prefix}
${CMAKE_CURRENT_SOURCE_DIR}/sdo/${Prefix}Parser.y
COMMENT "Generating ${Prefix}Parser.cpp"
)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${Prefix}Lexer.cpp
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/sdo/${Prefix}Lexer.l
COMMAND ${FLEX_EXECUTABLE}
-o ${CMAKE_CURRENT_BINARY_DIR}/${Prefix}Lexer.cpp
-P ${Prefix}
${CMAKE_CURRENT_SOURCE_DIR}/sdo/${Prefix}Lexer.l
COMMENT "Generating ${Prefix}Lexer.cpp"
)
ENDFOREACH(Prefix)
ENDIF()
# add a target to generate API documentation with Doxygen
find_package(Doxygen)
if(DOXYGEN_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
endif(DOXYGEN_FOUND)
INCLUDE_DIRECTORIES(
${Boost_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/sdo
)
ADD_LIBRARY(sdo STATIC
sdo/ButcherTableau.cpp
sdo/ReadFile.cpp
sdo/RandomUniform.cpp
sdo/FileStatus.cpp
sdo/ExpressionGraph.cpp
${CMAKE_CURRENT_BINARY_DIR}/MdlParser.cpp
${CMAKE_CURRENT_BINARY_DIR}/MdlLexer.cpp
${CMAKE_CURRENT_BINARY_DIR}/VpdParser.cpp
${CMAKE_CURRENT_BINARY_DIR}/VpdLexer.cpp
${CMAKE_CURRENT_BINARY_DIR}/VocParser.cpp
${CMAKE_CURRENT_BINARY_DIR}/VocLexer.cpp
${CMAKE_CURRENT_BINARY_DIR}/VopParser.cpp
${CMAKE_CURRENT_BINARY_DIR}/VopLexer.cpp
)
set_target_properties( sdo PROPERTIES COMPILE_FLAGS "-std=c++11 -pedantic-errors -Wall -Wextra -Wno-unused-parameter" )
set( libsdo_LIBRARY sdo )
TARGET_LINK_LIBRARIES(sdo ${Boost_LIBRARIES})
FILE( GLOB header_files "${CMAKE_CURRENT_SOURCE_DIR}/sdo/*.hpp")
INSTALL( FILES ${header_files} DESTINATION include/sdo)
INSTALL( TARGETS sdo EXPORT sdo-targets LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
set ( libsdo_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" )
set ( CMAKE_CONFIG_DEST "share/cmake/libsdo" )
include ( CMakePackageConfigHelpers )
configure_package_config_file (
"${CMAKE_CURRENT_SOURCE_DIR}/libsdo-config.cmake.in"
"${CMAKE_BINARY_DIR}/libsdo-config.cmake"
INSTALL_DESTINATION "${CMAKE_CONFIG_DEST}"
PATH_VARS libsdo_INCLUDE_DIRS )
export ( TARGETS sdo FILE ${CMAKE_BINARY_DIR}/libsdo-targets.cmake )
export ( PACKAGE libsdo )
set ( libsdo_INCLUDE_DIRS "include" )
configure_package_config_file (
"${CMAKE_CURRENT_SOURCE_DIR}/libsdo-config.cmake.in"
"${CMAKE_BINARY_DIR}/export/libsdo-config.cmake"
INSTALL_DESTINATION "${CMAKE_CONFIG_DEST}"
PATH_VARS libsdo_INCLUDE_DIRS )
install (
EXPORT sdo-targets
DESTINATION ${CMAKE_CONFIG_DEST} FILE "libsdo-targets.cmake" )
INSTALL(
FILES ${CMAKE_BINARY_DIR}/export/libsdo-config.cmake
DESTINATION ${CMAKE_CONFIG_DEST}
)