1 cmake_minimum_required (VERSION 2.8)
6 set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
7 set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall")
9 # Appends the cmake/modules path to MAKE_MODULE_PATH variable.
10 set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
12 # Make a version file containing the current version from git.
13 include (GetGitRevisionDescription)
14 git_describe (VERSION "--tags")
15 if ("x_${VERSION}" STREQUAL "x_GIT-NOTFOUND")
16 message (WARNING " - Install git to compile a production libmaa!")
17 set (VERSION "v0.2.5-dirty")
20 message (INFO " - MAA Version ${VERSION}")
22 #parse the version information into pieces.
23 string (REGEX REPLACE "^v([0-9]+)\\..*" "\\1" VERSION_MAJOR "${VERSION}")
24 string (REGEX REPLACE "^v[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${VERSION}")
25 string (REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${VERSION}")
26 string (REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+(.*)" "\\1" VERSION_SHA1 "${VERSION}")
27 set (VERSION_SHORT "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
29 configure_file (${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/version.c.in
30 ${CMAKE_CURRENT_BINARY_DIR}/src/version.c)
32 # this is the library version, independant of git revision
33 set (maa_VERSION_MAJOR ${VERSION_MAJOR})
34 set (maa_VERSION_MINOR ${VERSION_MINOR})
35 set (maa_VERSION_PATCH ${VERSION_PATCH})
36 set (maa_VERSION_STRING ${maa_VERSION_MAJOR}.${maa_VERSION_MINOR}.${maa_VERSION_PATCH})
38 set (CMAKE_SWIG_FLAGS "")
40 option (GTEST "Build all gtests." OFF)
41 option (BUILDDOC "Build all doc." OFF)
45 add_subdirectory (tests)
49 # add a target to generate API documentation with Doxygen
50 find_package (Doxygen)
52 configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
53 add_custom_target (doc
54 ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
55 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
56 COMMENT "Generating API documentation with Doxygen" VERBATIM
61 add_subdirectory (src)
62 add_subdirectory (examples)