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.

81 lines
2.3 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. FIND_PACKAGE(Threads REQUIRED)
  29. if(Boost_FOUND)
  30. include_directories(${Boost_INCLUDE_DIRS})
  31. endif(Boost_FOUND)
  32. # add a target to generate API documentation with Doxygen
  33. if(DOXYGEN_FOUND)
  34. SET(CMAKE_DOXYGEN_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doc")
  35. STRING(REGEX REPLACE ";" " " CMAKE_DOXYGEN_INPUT_LIST "${PROJECT_SOURCE_DIR}/src")
  36. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
  37. add_custom_target(doc ALL
  38. ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
  39. DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
  40. COMMENT "Generating API documentation with Doxygen" VERBATIM
  41. )
  42. endif(DOXYGEN_FOUND)
  43. if (GTEST_FOUND)
  44. # For make-based builds, defines make target named test.
  45. # For Visual Studio builds, defines Visual Studio project named RUN_TESTS.
  46. enable_testing()
  47. add_executable(MRMC-tests ${PROJECT_SOURCE_DIR}/test/mrmc-tests.cpp)
  48. include_directories(${GTEST_INCLUDE_DIRS})
  49. target_link_libraries(MRMC-tests ${GTEST_LIBRARIES})
  50. add_test(
  51. NAME MRMC-tests
  52. COMMAND MRMC-tests
  53. )
  54. # GTest needs pThreads, so it is linked into MRMC-tests.
  55. if (THREADS_FOUND)
  56. include_directories(${THREADS_INCLUDE_DIRS})
  57. target_link_libraries (MRMC-tests ${CMAKE_THREAD_LIBS_INIT})
  58. endif(THREADS_FOUND)
  59. endif(GTEST_FOUND)