You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.0 KiB

  1. cmake_minimum_required (VERSION 2.6)
  2. project (MRMC-cpp CXX C)
  3. # The version number.
  4. set (MRMC_CPP_VERSION_MAJOR 1)
  5. set (MRMC_CPP_VERSION_MINOR 0)
  6. # configure a header file to pass some of the CMake settings
  7. # to the source code
  8. configure_file (
  9. "${PROJECT_SOURCE_DIR}/src/MRMCConfig.h.in"
  10. "${PROJECT_BINARY_DIR}/MRMCConfig.h"
  11. )
  12. # add the binary tree to the search path for include files
  13. # so that we will find TutorialConfig.h
  14. include_directories("${PROJECT_BINARY_DIR}")
  15. #add_executable(MRMC-cpp src/mrmc-cpp.cpp)
  16. FILE(GLOB_RECURSE MRMCSources ${PROJECT_SOURCE_DIR}/src/*.cpp)
  17. FILE(GLOB_RECURSE MRMCHeaders ${PROJECT_SOURCE_DIR}/src/*.h)
  18. SOURCE_GROUP(Headers FILES ${MRMCHeaders})
  19. SOURCE_GROUP(Sources FILES ${MRMCSources})
  20. ADD_EXECUTABLE(MRMC-cpp ${MRMCSources} ${MRMCHeaders})
  21. # Add base folder for better inclusion pathes
  22. include_directories("${PROJECT_SOURCE_DIR}")
  23. include_directories("${PROJECT_SOURCE_DIR}/src")
  24. # external packages
  25. FIND_PACKAGE(GTest REQUIRED)
  26. FIND_PACKAGE(Boost REQUIRED)
  27. FIND_PACKAGE(Doxygen REQUIRED)
  28. if(Boost_FOUND)
  29. include_directories(${Boost_INCLUDE_DIRS})
  30. endif(Boost_FOUND)
  31. # add a target to generate API documentation with Doxygen
  32. if(DOXYGEN_FOUND)
  33. SET(CMAKE_DOXYGEN_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doc")
  34. STRING(REGEX REPLACE ";" " " CMAKE_DOXYGEN_INPUT_LIST "${PROJECT_SOURCE_DIR}/src")
  35. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
  36. add_custom_target(doc ALL
  37. ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
  38. DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
  39. COMMENT "Generating API documentation with Doxygen" VERBATIM
  40. )
  41. endif(DOXYGEN_FOUND)
  42. if (GTEST_FOUND)
  43. # For make-based builds, defines make target named test.
  44. # For Visual Studio builds, defines Visual Studio project named RUN_TESTS.
  45. enable_testing()
  46. add_executable(MRMC-tests ${PROJECT_SOURCE_DIR}/test/mrmc-tests.cpp)
  47. include_directories(${GTEST_INCLUDE_DIRS})
  48. target_link_libraries(MRMC-tests ${GTEST_LIBRARIES})
  49. add_test(
  50. NAME MRMC-tests
  51. COMMAND MRMC-tests
  52. )
  53. endif(GTEST_FOUND)