-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
116 lines (91 loc) · 3.36 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
106
107
108
109
110
111
112
113
114
115
116
project(smurf_parser)
set(PROJECT_VERSION 1.0)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR} "${PROJECT_SOURCE_DIR}/cmake")
cmake_minimum_required(VERSION 2.6)
include(scripts/cmake/smurf_parser.cmake)
#set(CMAKE_BUILD_TYPE Debug)
add_definitions(-std=c++11)
MACRO(CMAKE_USE_FULL_RPATH install_rpath)
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH ${install_rpath})
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
ENDMACRO(CMAKE_USE_FULL_RPATH)
CMAKE_USE_FULL_RPATH("${CMAKE_INSTALL_PREFIX}/lib")
cmake_minimum_required(VERSION 2.6)
include(FindPkgConfig)
find_package(lib_manager)
define_module_info()
#find_package(Doxygen)
#if(DOXYGEN_FOUND)
#configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/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)
find_package(Boost REQUIRED filesystem system thread)
include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIRS})
#find_package(Qt5Widgets)
#if (${Qt5Widgets_FOUND})
# set(USE_QT5 1)
# find_package(Qt5Widgets REQUIRED)
# include_directories(${Qt5Widgets_INCLUDES})
# add_definitions(-DUSE_QT5)
# add_definitions(${Qt5Widgets_DEFINITIONS})
# set(CMAKE_CXX_FLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
#else (${Qt5Widgets_FOUND})
# find_package(Qt4 REQUIRED)
# include(${QT_USE_FILE})
# include_directories(${QT_INCLUDE_DIR} ${QT_QTXML_INCLUDE_DIR})
#endif (${Qt5Widgets_FOUND})
#Get linker and compiler flags from pkg-config
pkg_check_modules(PKGCONFIG REQUIRED
configmaps
urdfdom
tinyxml
)
include_directories(${PKGCONFIG_INCLUDE_DIRS})
link_directories(${PKGCONFIG_LIBRARY_DIRS})
add_definitions(${PKGCONFIG_CFLAGS_OTHER}) #flags excluding the ones with -I
#set(ADD_INCLUDES "-I${QT_INCLUDE_DIR} -I${QT_QTXML_INCLUDE_DIR}")
include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/src )
set(SOURCES_H
src/SMURFParser.h
)
set(TARGET_SRC ${SOURCES_H_MOC}
src/SMURFParser.cpp
)
add_library(${PROJECT_NAME} SHARED ${TARGET_SRC})
if (${USE_QT5})
qt5_use_modules(${PROJECT_NAME} Xml)
endif (${USE_QT5})
set(_INSTALL_DESTINATIONS
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
ARCHIVE DESTINATION lib
)
TARGET_LINK_LIBRARIES(${PROJECT_NAME}
${QT_LIBRARIES}
${QT_QTXML_LIBRARY}
${PKGCONFIG_LIBRARIES}
${WIN_LIBS}
${Boost_LIBRARIES}
)
#------------------------------------------------------------------------------
if(WIN32)
set(LIB_INSTALL_DIR bin) # .dll are in PATH, like executables
else(WIN32)
set(LIB_INSTALL_DIR lib)
endif(WIN32)
set(_INSTALL_DESTINATIONS
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
ARCHIVE DESTINATION lib
)
# Install the library
install(TARGETS ${PROJECT_NAME} ${_INSTALL_DESTINATIONS})
# Install headers into mars include directory
install(FILES ${SOURCES_H} DESTINATION include/smurf_parser)
configure_file(${PROJECT_NAME}.pc.in ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)