doudou / orocos-rtt forked from psoetens/orocos-rtt

Orocos Real-Time Toolkit

This URL has Read+Write access

Janosch Machowinski (author)
Wed Nov 26 07:50:12 -0800 2008
Sylvain Joyeux (committer)
Fri Dec 19 07:31:38 -0800 2008
orocos-rtt / CMakeLists.txt
05192383 » wmeeusse 2006-10-23 add cmake file 1 #
2 # Test CMake version
3 #
4 CMAKE_MINIMUM_REQUIRED(VERSION 2.2)
5 #MARK_AS_ADVANCED( FORCE CMAKE_BACKWARDS_COMPATIBILITY )
6
8f6d7ffa » psoetens 2008-08-28 Applied patch #346 from Bug... 7 # for CMake 2.6 corrected behaviour (see "cmake --help-policy CMP0003")
8 IF(COMMAND cmake_policy AND ${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
9 CMAKE_POLICY(SET CMP0003 NEW)
10 ENDIF(COMMAND cmake_policy AND ${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
11
05192383 » wmeeusse 2006-10-23 add cmake file 12 ###################################################
13 # #
14 # Start project customization section #
15 # #
16 ###################################################
17
ddf4b115 » psoetens 2007-10-05 Create a 'targets' subdirec... 18 PROJECT(orocos-rtt)
05192383 » wmeeusse 2006-10-23 add cmake file 19
9cf118d4 » psoetens 2008-09-29 Bump trunk version number t... 20 SET( RTT_VERSION 1.6.99 )
e27fff9e » psoetens 2007-04-17 Fix for Bug #322: Do not us... 21 STRING( REGEX MATCHALL "[0-9]+" RTT_VERSIONS ${RTT_VERSION} )
22 LIST( GET RTT_VERSIONS 0 RTT_VERSION_MAJOR)
23 LIST( GET RTT_VERSIONS 1 RTT_VERSION_MINOR)
24 LIST( GET RTT_VERSIONS 2 RTT_VERSION_PATCH)
25
26 MESSAGE( "Orocos RTT version ${VERSION} (${RTT_VERSION_MAJOR}.${RTT_VERSION_MINOR}.${RTT_VERSION_PATCH})" )
05192383 » wmeeusse 2006-10-23 add cmake file 27
28 # Do not rely on environment variables to find the path, because that's confusing
29 IF(NOT CMAKE_INSTALL_PREFIX)
c2e72ba3 » psoetens 2007-05-08 Install RTT by default in /... 30 SET( CMAKE_INSTALL_PREFIX /usr/local CACHE PATH "Installation directory" FORCE)
05192383 » wmeeusse 2006-10-23 add cmake file 31 MESSAGE( STATUS "Setting installation directory to ${CMAKE_INSTALL_PREFIX}" )
32 ENDIF(NOT CMAKE_INSTALL_PREFIX)
33
ddf4b115 » psoetens 2007-10-05 Create a 'targets' subdirec... 34 SET( PROJ_SOURCE_DIR ${orocos-rtt_SOURCE_DIR} )
35 SET( PROJ_BINARY_DIR ${orocos-rtt_BINARY_DIR} )
05192383 » wmeeusse 2006-10-23 add cmake file 36
37 # Set the default build type to debug.
9837156d » psoetens 2007-02-08 Build system cleanup: 38 #
39 # Set the build type (affects debugging symbols and optimization)
40 #
41 IF ( NOT CMAKE_BUILD_TYPE )
42 SET( CMAKE_BUILD_TYPE "RTT" CACHE STRING "Build type: None (Use CMAKE_C_FLAGS and CMAKE_CXX_FLAGS), RTT (Recommended), Release, Debug, RelWithDebInfo, MinSizeRel." FORCE )
43 MESSAGE( "Setting build type to '${CMAKE_BUILD_TYPE}'" )
44 SET( CMAKE_C_FLAGS_RTT "-O2 -DNDEBUG" CACHE STRING "The CFLAGS for RTT" )
45 SET( CMAKE_CXX_FLAGS_RTT "-O2 -DNDEBUG" CACHE STRING "The CXXFLAGS flags for RTT" )
46 ELSE ( NOT CMAKE_BUILD_TYPE )
47 MESSAGE( "Build type set to '${CMAKE_BUILD_TYPE}' by user." )
48 IF ( NOT CMAKE_BUILD_TYPE STREQUAL "RTT" )
49 MARK_AS_ADVANCED(FORCE CMAKE_C_FLAGS_RTT CMAKE_CXX_FLAGS_RTT)
50 ELSE ( NOT CMAKE_BUILD_TYPE STREQUAL "RTT" )
51 MARK_AS_ADVANCED(CLEAR CMAKE_C_FLAGS_RTT CMAKE_CXX_FLAGS_RTT)
52 ENDIF ( NOT CMAKE_BUILD_TYPE STREQUAL "RTT" )
53
54 ENDIF ( NOT CMAKE_BUILD_TYPE )
05192383 » wmeeusse 2006-10-23 add cmake file 55
fd3f246c » psoetens 2007-04-23 Added the CMAKE_CXX_FLAGS_A... 56 #Use these variables to store build-local flags.
57 #They are used when the targets are configured.
58 IF ( NOT CMAKE_BUILD_TYPE STREQUAL "None")
59 SET ( CMAKE_CXX_FLAGS_ADD "${CMAKE_CXX_FLAGS}" CACHE STRING "Specify here your additional flags.")
60 SET ( CMAKE_C_FLAGS_ADD "${CMAKE_C_FLAGS}" CACHE STRING "Specify here your additional flags.")
61 ENDIF ( NOT CMAKE_BUILD_TYPE STREQUAL "None")
62
63
64 # Make compilation verbose
41df0bd6 » psoetens 2007-11-21 Add idl target to avoid cod... 65 #SET(CMAKE_VERBOSE_MAKEFILE TRUE)
05192383 » wmeeusse 2006-10-23 add cmake file 66
67 ###################################################
68 # #
69 # End project customization section #
70 # #
71 ###################################################
72
73 #
74 # Set the build type (affects debugging symbols and optimization)
75 #
76 IF ( NOT CMAKE_BUILD_TYPE )
77 SET( CMAKE_BUILD_TYPE Release )
78 MESSAGE( STATUS "Setting build type to '${CMAKE_BUILD_TYPE}'" )
79 ELSE ( NOT CMAKE_BUILD_TYPE )
80 MESSAGE( STATUS "Build type set to '${CMAKE_BUILD_TYPE}' by user." )
81 ENDIF ( NOT CMAKE_BUILD_TYPE )
82
83 # MESSAGE("Looking for compiler:")
84 INCLUDE (${CMAKE_ROOT}/Modules/CMakeDetermineCXXCompiler.cmake)
85
86 ###################################################
87 # #
88 # Do some global set-up & checking #
89 # #
90 ###################################################
91
92 # Put your 'flags' inhere if you want them to apear in the
f1525c7c » rsmits 2006-10-25 wrong include in taskthread... 93 # rtt.pc file. Various .cmake scripts below do
fd3f246c » psoetens 2007-04-23 Added the CMAKE_CXX_FLAGS_A... 94 # this. These flags should ONLY by -I or -D flags, NOT -O..
95 # -W... or alike. The user's application is compiled with these flags !
18056357 » rsmits 2006-10-27 fixed buffers-test compile bug 96 SET( RTT_CFLAGS "" CACHE INTERNAL "")
97 SET( RTT_LINKFLAGS "" CACHE INTERNAL "")
7072258e » psoetens 2008-10-17 Reset RTT_USER_LINKFLAGS at... 98 SET( RTT_USER_LINKFLAGS "" CACHE INTERNAL "")
05192383 » wmeeusse 2006-10-23 add cmake file 99
9837156d » psoetens 2007-02-08 Build system cleanup: 100 INCLUDE(config/check_depend.cmake)
05192383 » wmeeusse 2006-10-23 add cmake file 101 INCLUDE(config/global_setup.cmake)
102
103 ## Uninstall target
104 CONFIGURE_FILE(
bcf548e4 » psoetens 2007-02-28 Move cmake uninstall file t... 105 "${CMAKE_CURRENT_SOURCE_DIR}/config/cmake_uninstall.cmake.in"
05192383 » wmeeusse 2006-10-23 add cmake file 106 "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
107 IMMEDIATE @ONLY)
108
109 ADD_CUSTOM_TARGET(uninstall
110 "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
111
112 ###########################################################
113 # #
9837156d » psoetens 2007-02-08 Build system cleanup: 114 # Look for dependencies required by individual components #
05192383 » wmeeusse 2006-10-23 add cmake file 115 # #
116 ###########################################################
117
223fac8d » psoetens 2007-02-17 Improved build: 118 INCLUDE(config/rtt_macros.cmake)
9837156d » psoetens 2007-02-08 Build system cleanup: 119
05192383 » wmeeusse 2006-10-23 add cmake file 120 ###########################################################
121 # #
9837156d » psoetens 2007-02-08 Build system cleanup: 122 # Create build #
05192383 » wmeeusse 2006-10-23 add cmake file 123 # #
124 ###########################################################
125
8541e4e3 » psoetens 2007-01-26 Fixed CORBA build, moved so... 126 ADD_DEFINITIONS( "-Wall" )
ce3a3091 » psoetens 2007-02-19 Reverted major part of patc... 127 INCLUDE_DIRECTORIES(${PROJ_SOURCE_DIR}/src ${PROJ_BINARY_DIR}/src ${PROJ_BINARY_DIR}/src/os ${PROJ_BINARY_DIR}/src/os/${OROCOS_TARGET})
128 #INCLUDE_DIRECTORIES(${PROJ_SOURCE_DIR}/src ${PROJ_BINARY_DIR}/src ${PROJ_BINARY_DIR}/src/os)
05192383 » wmeeusse 2006-10-23 add cmake file 129 ADD_SUBDIRECTORY(src)
9837156d » psoetens 2007-02-08 Build system cleanup: 130 ADD_SUBDIRECTORY(doc)
131 ADD_SUBDIRECTORY(tests)
05192383 » wmeeusse 2006-10-23 add cmake file 132
55e5c20a » psoetens 2007-11-06 Apply patch by Leopold Palo... 133 #CONFIGURE_FILE( orocos-rtt.pc.in orocos-rtt-${OROCOS_TARGET}.pc @ONLY)
134 #INSTALL_FILES( /lib/pkgconfig FILES orocos-rtt-${OROCOS_TARGET}.pc)
05192383 » wmeeusse 2006-10-23 add cmake file 135 CONFIGURE_FILE(Doxyfile.in Doxyfile @ONLY)
136
a717581c » psoetens 2007-04-11 Beautified doxygen generati... 137 # provide a link to src. Used by Doxygen.
dea93e4e » psoetens 2007-04-13 Fix rtt symlink for Doxygen... 138 EXECUTE_PROCESS(COMMAND ln -nfs ${PROJ_SOURCE_DIR}/src ${PROJ_BINARY_DIR}/rtt ERROR_QUIET)
a717581c » psoetens 2007-04-11 Beautified doxygen generati... 139
05192383 » wmeeusse 2006-10-23 add cmake file 140 ############################################################
141 ## #
142 ## Setup PACKAGING #
143 ## #
144 ############################################################
145
146 IF ( "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" STREQUAL "2.4" )
147 OPTION( CPACK_PACKAGES "Set to ON to build the packages. Requires cmake >2.4" OFF )
148 IF (CPACK_PACKAGES)
149
150 INCLUDE(InstallRequiredSystemLibraries)
151
152 # ATTENTION: There is sometimes a _SOURCE_ version of an
153 # option as well, set both if necessary !
154
155 # Create .tar.gz and .tar.tbz2 files:
156 SET(CPACK_GENERATOR "TBZ2")
157 SET(CPACK_SOURCE_GENERATOR "TBZ2")
158
159 # The plain 'package' target works correctly.
160 SET(CPACK_IGNORE_FILES "/CVS/;/.svn/;.swp$;.#;/#;/build/")
161 # Since the 'package_source' target does a bold copy, define a list of
162 # files which should be excluded. Note that 'subpattern' matching is used,
163 # thus to exclude a directory use /mydir/
164 SET(CPACK_SOURCE_IGNORE_FILES "/CVS/;/.svn/;.swp$;.#;/#;/build/;~")
165
166 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Orocos RTT")
167 SET(CPACK_PACKAGE_VENDOR "The Orocos Community")
168 SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
169 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
c2e72ba3 » psoetens 2007-05-08 Install RTT by default in /... 170 SET(CPACK_PACKAGE_MAJOR_VERSION RTT_VERSION_MAJOR)
171 SET(CPACK_PACKAGE_MINOR_VERSION RTT_VERSION_MINOR)
172 SET(CPACK_PACKAGE_VERSION_PATCH RTT_VERSION_PATCH)
05192383 » wmeeusse 2006-10-23 add cmake file 173 SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMAKE ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}")
174 SET(CPACK_STRIP_FILES "bin/cmake")
175 SET(CPACK_PACKAGE_EXECUTABLES "OrocosExec" "Orocos Executable")
176 INCLUDE(CPack)
177 ENDIF (CPACK_PACKAGES)
178 ELSE ( "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" STREQUAL "2.4" )
179
180 MESSAGE ( "Disabling packaging for version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}")
181
182 ENDIF ( "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" STREQUAL "2.4" )
183
184
185 #############################
186 # #
187 # Building Doxygen documents#
188 # #
189 #############################
190
dea93e4e » psoetens 2007-04-13 Fix rtt symlink for Doxygen... 191 ADD_CUSTOM_TARGET(docs echo "Documentation built.")
192 ADD_DEPENDENCIES(docs dochtml docpdf)
193
9837156d » psoetens 2007-02-08 Build system cleanup: 194 IF (DOXYGEN)
dea93e4e » psoetens 2007-04-13 Fix rtt symlink for Doxygen... 195 ADD_CUSTOM_TARGET(docapi "doxygen" "Doxyfile")
196 ADD_DEPENDENCIES(docs docapi)
9837156d » psoetens 2007-02-08 Build system cleanup: 197 ENDIF (DOXYGEN)
198
f0ec9a39 » wmeeusse 2006-10-24 almost compiling version.. ... 199