CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Sun, 11 Dec 2011 18:43:33 +0100
changeset 13 0ab493e5250e
parent 9 7768d68909e8
permissions -rw-r--r--
Add build id field to running time logs

Configurable by BENCHMARK_BUILD_ID cmake variable,
which defaults to the last component of the build directory.
     1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
     2 
     3 ## Here comes the name of your project:
     4 
     5 SET(PROJECT_NAME "LEMON-PROJECT-TEMPLATE")
     6 
     7 ## Change 'hg-tip' to the current version number of your project if you wish.
     8 ## Optionally, you can leave it as is and set PROJECT_VERSION from
     9 ## the cmake-gui when you make a release.
    10 ## The last parameter is a help string displayed by CMAKE.
    11 
    12 SET(PROJECT_VERSION "hg-tip"
    13     CACHE STRING "${PROJECT_NAME} version string")
    14 
    15 GET_FILENAME_COMPONENT(BUILD_DIR_NAME ${CMAKE_BINARY_DIR} NAME)
    16 
    17 SET(BENCHMARK_BUILD_ID ${BUILD_DIR_NAME} CACHE STRING "Benchmark build id")
    18 
    19 ## Do not edit this.
    20 PROJECT(${PROJECT_NAME})
    21 
    22 SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
    23 
    24 ## The next part looks for LEMON. Typically, you don't want to modify it.
    25 ##
    26 ## First, it tries to use LEMON as a CMAKE subproject by looking for
    27 ## it in the 'lemon' or 'deps/lemon' subdirectories or in directory
    28 ## given by the LEMON_SOURCE_ROOT_DIR variable.
    29 ## If LEMON isn't there, then CMAKE will try to find an installed
    30 ## version of LEMON. If it is installed at some non-standard place,
    31 ## then you must tell its location in the LEMON_ROOT_DIR CMAKE config
    32 ## variable. (Do not hard code it into your config! Others may keep
    33 ## LEMON at different places.)
    34 
    35 FIND_PATH(LEMON_SOURCE_ROOT_DIR CMakeLists.txt
    36   PATHS ${CMAKE_SOURCE_DIR}/lemon ${CMAKE_SOURCE_DIR}/deps/lemon
    37   NO_DEFAULT_PATH
    38   DOC "Location of LEMON source as a CMAKE subproject")
    39 
    40 IF(EXISTS ${LEMON_SOURCE_ROOT_DIR})
    41   ADD_SUBDIRECTORY(${LEMON_SOURCE_ROOT_DIR} deps/lemon)
    42   SET(LEMON_INCLUDE_DIRS
    43     ${LEMON_SOURCE_ROOT_DIR}
    44     ${CMAKE_BINARY_DIR}/deps/lemon
    45   )
    46   SET(LEMON_LIBRARIES lemon)
    47   UNSET(LEMON_ROOT_DIR CACHE)
    48   UNSET(LEMON_DIR CACHE)
    49   UNSET(LEMON_INCLUDE_DIR CACHE)
    50   UNSET(LEMON_LIBRARY CACHE)
    51 ELSE()
    52   FIND_PACKAGE(LEMON QUIET NO_MODULE)
    53   FIND_PACKAGE(LEMON REQUIRED)
    54 ENDIF()
    55 
    56 ## This line finds doxygen (for document creation)
    57 
    58 FIND_PACKAGE(Doxygen)
    59 
    60 ## These are the include directories used by the compiler.
    61 
    62 INCLUDE_DIRECTORIES(
    63   ${PROJECT_SOURCE_DIR}
    64   ${PROJECT_BINARY_DIR}
    65   ${LEMON_INCLUDE_DIRS}
    66 )
    67 
    68 ## Sometimes MSVC overwhelms you with compiler warnings which are impossible to
    69 ## avoid. Then comment out these sections. Normally you won't need it as the
    70 ## LEMON include headers suppress these warnings anyway.
    71 
    72 #IF(MSVC)
    73 #  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}
    74 #      /wd4250 /wd4355 /wd4503 /wd4800 /wd4996")
    75 # # Suppressed warnings:
    76 # # C4250: 'class1' : inherits 'class2::member' via dominance
    77 # # C4355: 'this' : used in base member initializer list
    78 # # C4503: 'function' : decorated name length exceeded, name was truncated
    79 # # C4800: 'type' : forcing value to bool 'true' or 'false'
    80 # #        (performance warning)
    81 # # C4996: 'function': was declared deprecated
    82 # ENDIF(MSVC)
    83 
    84 ENABLE_TESTING()
    85 
    86 ## The auxiliary doxygen files (.dox) should be placed in the 'doc'
    87 ## subdirectory. The next line includes the CMAKE config of that directory.
    88 
    89 ADD_SUBDIRECTORY(doc)
    90 
    91 ADD_SUBDIRECTORY(generators/netgen)
    92 ADD_SUBDIRECTORY(data)
    93 
    94 ADD_SUBDIRECTORY(tests)
    95 
    96 #######################################################################
    97 ## CPACK configuration
    98 ##
    99 ## It is used to configure the .exe installer created by CPACK.
   100 ## Consider editing these values:
   101 ##
   102 ## - CPACK_PACKAGE_VENDOR
   103 ## - CPACK_PACKAGE_DESCRIPTION_SUMMARY
   104 ## - CPACK_NSIS_HELP_LINK
   105 ## - CPACK_NSIS_URL_INFO_ABOUT
   106 ## - CPACK_NSIS_CONTACT
   107 ##
   108 ## Additionally, you may want to change the icons/images used by the
   109 ## NSIS installer, i.e. these variables:
   110 ##
   111 ## - CPACK_NSIS_MUI_ICON
   112 ## - CPACK_PACKAGE_ICON
   113 ## - CPACK_NSIS_INSTALLED_ICON_NAME
   114 ##
   115 ## and/or the files they point to.
   116 #######################################################################
   117 
   118 IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
   119   SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
   120   SET(CPACK_PACKAGE_VENDOR "EGRES")
   121   SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY
   122       "LEMON PROJECT TEMPLATE - A Template Build Environment for LEMON")
   123   SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
   124 
   125   SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
   126 
   127   SET(CPACK_PACKAGE_INSTALL_DIRECTORY
   128       "${PROJECT_NAME}")
   129   SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
   130       "${PROJECT_NAME}")
   131 
   132   SET(CPACK_COMPONENTS_ALL
   133       html_documentation
   134       bin)
   135 
   136   SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities")
   137   SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation")
   138 
   139   SET(CPACK_COMPONENT_BIN_DESCRIPTION
   140       "Command line utilities")
   141   SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION
   142       "Doxygen generated documentation")
   143 
   144   SET(CPACK_GENERATOR "NSIS")
   145 
   146   SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon-project.ico")
   147   SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico")
   148   SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp")
   149   SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon-project.ico")
   150 
   151   SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}")
   152   SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu")
   153   SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu")
   154   SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu")
   155   SET(CPACK_NSIS_CREATE_ICONS_EXTRA "
   156       CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\"
   157       ")
   158   SET(CPACK_NSIS_DELETE_ICONS_EXTRA "
   159       !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
   160       Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\"
   161       ")
   162 
   163   INCLUDE(CPack)
   164 ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})