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