The Higher Education and Research forge

Home My Page Projects Code Snippets Project Openings MMD
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

1 cmake_minimum_required(VERSION 2.8.5 FATAL_ERROR)
2 if(POLICY CMP0025)
3   cmake_policy(SET CMP0025 NEW) # CMake 3.0
4 endif()
5 if(POLICY CMP0053)
6   cmake_policy(SET CMP0053 NEW) # CMake 3.1
7 endif()
8 ## #include(optimizeArch.cmake)
10 project(MMD)
11 file(GLOB SRC_FILES ${CMAKE_SOURCE_DIR}/src/*.c  ${CMAKE_SOURCE_DIR}/src/*.cpp)
13 if(NOT CMAKE_BUILD_TYPE)
14   set(CMAKE_BUILD_TYPE Release)
15 endif()
17 set(CMAKE_C_FLAGS "-Wall -Wextra")
18 set(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG -march=skylake      -mtune=skylake")
19 set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG -march=skylake  -mtune=skylake")
21 if(CMAKE_BUILD_TYPE EQUAL "Debug")
22     set(CMAKE_C_FLAGS_RELEASE "-g -DNDEBUG -march=skylake       -mtune=skylake")
23 endif()
26 if(CMAKE_BUILD_TYPE EQUAL "Release")
27     set(CMAKE_C_FLAGS_RELEASE "-03 -march=skylake       -mtune=skylake")
28 endif()
31 find_package(VTK REQUIRED)
32 vtk_module_config(VTK
33   vtkCommonCore
34   vtkCommonDataModel
35   vtkFiltersSources
36   vtkInteractionStyle
37   vtkRendering${VTK_RENDERING_BACKEND}
38 )
39 include(${VTK_USE_FILE})
40  
41 #find_package(VTK REQUIRED)
42 #find_package(VTK COMPONENTS
43 #  vtkCommonCore
44 #  vtkCommonDataModel
45 #  vtkIOLegacy 
46 #  QUIET)
47 #include(${VTK_USE_FILE})
48 #IF(VTK_FOUND)
49 #  message("found VTK. Version:" ${VTK_VERSION}. VTK_DIR: ${VTK_DIR})
50 #ELSE(VTK_FOUND)
51 #  MESSAGE(FATAL_ERROR
52 #    "Cannot build the executable without VTK. Please set the VTK_DIR")
53 #ENDIF(VTK_FOUND)
54  
55 add_executable(${PROJECT_NAME} ${SRC_FILES})
56 target_link_libraries(${PROJECT_NAME} m ${VTK_LIBRARIES})
58 message("CXXFLAGS:" ${CMAKE_CXX_FLAGS})
59 message("CFLAGS  :" ${CMAKE_C_FLAGS})
62 include(CTest)
63 ENABLE_TESTING()
65 set ( TESTS ${CMAKE_SOURCE_DIR}/test )
66 add_subdirectory(${TESTS})
70 ### DOCUMENTATION
72 ## first we can indicate the documentation build as an option and set it to ON by default
73 #option(BUILD_DOC "Build documentation" ON)
75 ## check if Doxygen is installed
76 #find_package(Doxygen)
77 #if (DOXYGEN_FOUND)
78 #    # set input and output files
79 #    set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile.in)
80 #    set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
82 #    # request to configure the file
83 #    configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
84 #    message("Doxygen build started")
86 #    # note the option ALL which allows to build the docs together with the application
87 #    add_custom_target( doc_doxygen ALL
88 #        COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
89 #        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
90 #        COMMENT "Generating API documentation with Doxygen"
91 #        VERBATIM )
92 #else (DOXYGEN_FOUND)
93 #  message("Doxygen need to be installed to generate the doxygen documentation")
94 #endif (DOXYGEN_FOUND)