project(proteus) cmake_minimum_required(VERSION 2.6) if(NOT CMAKE_INSTALL_PREFIX) set(CMAKE_INSTALL_PREFIX /usr) endif(NOT CMAKE_INSTALL_PREFIX) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) link_directories(${CMAKE_CURRENT_BINARY_DIR}/lib) # Define the absolute path to the images so we load them properly. if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") add_definitions(-DIMAGE_PATH="${CMAKE_CURRENT_SOURCE_DIR}/images/sprites") add_definitions(-Wall -pedantic) else(${CMAKE_BUILD_TYPE} STREQUAL "Debug") add_definitions(-DIMAGE_PATH="${CMAKE_INSTALL_PREFIX}/images/sprites") endif(${CMAKE_BUILD_TYPE} STREQUAL "Debug") add_subdirectory(lib) add_subdirectory(src) # Modify these to be proper install paths down the line. install(DIRECTORY doc DESTINATION ${CMAKE_INSTALL_PREFIX}) install(DIRECTORY images DESTINATION ${CMAKE_INSTALL_PREFIX}) # uninstall target configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake" IMMEDIATE @ONLY) add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake") # Only build tests if we are debugging. if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") # Unit test running. enable_testing() add_subdirectory(test) endif(${CMAKE_BUILD_TYPE} STREQUAL "Debug") # Documentation # check if doxygen is even installed find_package(Doxygen) if (DOXYGEN_FOUND STREQUAL "NO") message(FATAL_ERROR "Doxygen not found. Please get a copy http://www.doxygen.org") endif (DOXYGEN_FOUND STREQUAL "NO") # prepare doxygen configuration file configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) # add doxygen as target add_custom_target(doxygen ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) # cleanup $build/api-doc on "make clean" set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES api-doc) # add doxygen as dependency to doc-target get_target_property(DOC_TARGET doc TYPE) if(NOT DOC_TARGET) add_custom_target(doc) endif() add_dependencies(doc doxygen) # install HTML API documentation and manual pages set(DOC_PATH "share/doc/${CPACK_PACKAGE_NAME}-${VERSION}") install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/api-doc/html DESTINATION ${DOC_PATH}) # install man pages into packages, scope is now # project root.. install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/api-doc/man/man3 DESTINATION share/man/man3/)