CMakeLists.txt
author Peter Kovacs <kpeter@inf.elte.hu>
Tue, 16 Jun 2009 18:47:21 +0200
changeset 3 efa883909c06
parent 2 76d160eba8d4
child 4 6de89926e594
permissions -rw-r--r--
Slightly improve help comments
alpar@0
     1
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
alpar@0
     2
alpar@2
     3
## Here comes the name of your project:
alpar@2
     4
alpar@0
     5
SET(PROJECT_NAME "LEMON-PROJECT-TEMPLATE")
alpar@2
     6
alpar@2
     7
## Change 'hg-tip' to the current version number of your project if you wish.
kpeter@3
     8
## Optionally, you can leave it as is and set PROJECT_VERSION from
kpeter@3
     9
## the cmake-gui when you make a release.
alpar@2
    10
## The last parameter is a help string displayed by CMAKE.
alpar@2
    11
alpar@0
    12
SET(PROJECT_VERSION "hg-tip"
kpeter@3
    13
    CACHE STRING "${PROJECT_NAME} version string")
alpar@0
    14
alpar@2
    15
## Do not edit this.
alpar@0
    16
PROJECT(${PROJECT_NAME})
alpar@0
    17
alpar@0
    18
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
alpar@0
    19
alpar@2
    20
## The next part looks for LEMON. Typically, you don't want to modify it.
alpar@2
    21
##
alpar@2
    22
## First, it checks if there exists a 'lemon' subdirectory which should contain
alpar@2
    23
## the LEMON source tree. If it is there, then it will compile it locally and
alpar@2
    24
## use it as a subproject. If it isn't, then CMAKE will try to find an
alpar@2
    25
## installed version of LEMON. If it is installed to some non-standard place,
alpar@2
    26
## then you must tell its location to 'cmake-gui' in the LEMON_ROOT_DIR
alpar@2
    27
## config variable. (Do not hard code it into your config! Others may keep
alpar@2
    28
## LEMON at different places.)
alpar@2
    29
ladanyi@1
    30
IF(EXISTS ${CMAKE_SOURCE_DIR}/lemon)
ladanyi@1
    31
  ADD_SUBDIRECTORY(lemon)
ladanyi@1
    32
  SET(LEMON_INCLUDE_DIRS
ladanyi@1
    33
    ${CMAKE_SOURCE_DIR}/lemon
ladanyi@1
    34
    ${CMAKE_BINARY_DIR}/lemon
ladanyi@1
    35
  )
ladanyi@1
    36
  SET(LEMON_LIBRARIES lemon)
ladanyi@1
    37
ELSE()
ladanyi@1
    38
  FIND_PACKAGE(LEMON QUIET NO_MODULE)
ladanyi@1
    39
  FIND_PACKAGE(LEMON REQUIRED)
ladanyi@1
    40
ENDIF()
ladanyi@1
    41
alpar@2
    42
## This line finds doxygen (for document creation)
alpar@2
    43
alpar@0
    44
FIND_PACKAGE(Doxygen)
alpar@0
    45
alpar@2
    46
## These are the include directories used by the compiler.
alpar@2
    47
alpar@0
    48
INCLUDE_DIRECTORIES(
alpar@0
    49
  ${PROJECT_SOURCE_DIR}
alpar@0
    50
  ${PROJECT_BINARY_DIR}
alpar@0
    51
  ${LEMON_INCLUDE_DIRS}
alpar@0
    52
)
alpar@0
    53
alpar@2
    54
## Here we define an executable target. Its name is 'lemon-project' and
alpar@2
    55
## is compiled from 'main.cc'. You can add more source files separated
alpar@2
    56
## with whitespaces (including newlines). If you want to build more
alpar@2
    57
## executables, simple repeat (and edit) the following ADD_EXECUTABLE and
alpar@2
    58
## TARGET_LINK_LIBRARIES statements.
alpar@2
    59
alpar@0
    60
ADD_EXECUTABLE(lemon-project main.cc)
alpar@0
    61
TARGET_LINK_LIBRARIES(lemon-project ${LEMON_LIBRARIES})
alpar@2
    62
alpar@2
    63
## This tells cmake to install 'lemon-project' to $PREFIX/bin when
alpar@2
    64
## 'make install' is executed. You can give more targets separated
alpar@2
    65
## by whitespaces.
alpar@2
    66
alpar@0
    67
INSTALL(
alpar@0
    68
  TARGETS lemon-project
alpar@0
    69
  RUNTIME DESTINATION bin
alpar@0
    70
  COMPONENT bin
alpar@0
    71
)
alpar@0
    72
alpar@2
    73
## Sometimes MSVC overwhelms you with compiler warnings which are impossible to
alpar@2
    74
## avoid. Then comment out these sections. Normally you won't need it as the
alpar@2
    75
## LEMON include headers suppress these warnings anyway.
alpar@2
    76
alpar@2
    77
#IF(MSVC)
alpar@2
    78
#  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}
alpar@2
    79
#      /wd4250 /wd4355 /wd4503 /wd4800 /wd4996")
alpar@0
    80
# # Suppressed warnings:
alpar@0
    81
# # C4250: 'class1' : inherits 'class2::member' via dominance
alpar@0
    82
# # C4355: 'this' : used in base member initializer list
alpar@0
    83
# # C4503: 'function' : decorated name length exceeded, name was truncated
alpar@2
    84
# # C4800: 'type' : forcing value to bool 'true' or 'false'
alpar@2
    85
# #        (performance warning)
alpar@0
    86
# # C4996: 'function': was declared deprecated
alpar@0
    87
# ENDIF(MSVC)
alpar@0
    88
alpar@0
    89
ENABLE_TESTING()
alpar@0
    90
kpeter@3
    91
## The auxiliary doxygen files (.dox) should be placed in the 'doc'
alpar@2
    92
## subdirectory. The next line includes the CMAKE config of that directory.
alpar@2
    93
alpar@0
    94
ADD_SUBDIRECTORY(doc)
alpar@0
    95
alpar@2
    96
#######################################################################
alpar@2
    97
## CPACK configuration
alpar@2
    98
##
alpar@2
    99
## It is used to configure the .exe installer created by CPACK.
alpar@2
   100
## Consider editing these values:
alpar@2
   101
## - CPACK_PACKAGE_VENDOR
alpar@2
   102
## - CPACK_PACKAGE_DESCRIPTION_SUMMARY
alpar@2
   103
## - CPACK_NSIS_HELP_LINK
alpar@2
   104
## - CPACK_NSIS_URL_INFO_ABOUT
alpar@2
   105
## - CPACK_NSIS_CONTACT
alpar@2
   106
#######################################################################
alpar@0
   107
alpar@0
   108
IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
alpar@0
   109
  SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
alpar@0
   110
  SET(CPACK_PACKAGE_VENDOR "EGRES")
alpar@0
   111
  SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY
alpar@0
   112
      "LEMON PROJECT TEMPLATE - A Template Build Environment for LEMON")
alpar@0
   113
  SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
alpar@0
   114
alpar@0
   115
  SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
alpar@0
   116
alpar@0
   117
  SET(CPACK_PACKAGE_INSTALL_DIRECTORY
alpar@0
   118
      "${PROJECT_NAME}")
alpar@0
   119
  SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
alpar@0
   120
      "${PROJECT_NAME}")
alpar@0
   121
alpar@0
   122
  SET(CPACK_COMPONENTS_ALL
alpar@0
   123
      html_documentation
alpar@0
   124
      bin)
alpar@0
   125
alpar@0
   126
  SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities")
alpar@0
   127
  SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation")
alpar@0
   128
alpar@0
   129
  SET(CPACK_COMPONENT_BIN_DESCRIPTION
alpar@0
   130
      "Command line utilities")
alpar@0
   131
  SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION
alpar@0
   132
      "Doxygen generated documentation")
alpar@0
   133
alpar@0
   134
  SET(CPACK_GENERATOR "NSIS")
alpar@0
   135
  SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}")
alpar@0
   136
  SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu")
alpar@0
   137
  SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu")
alpar@0
   138
  SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu")
alpar@0
   139
  SET(CPACK_NSIS_CREATE_ICONS_EXTRA "
alpar@0
   140
      CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\"
alpar@0
   141
      ")
alpar@0
   142
  SET(CPACK_NSIS_DELETE_ICONS_EXTRA "
alpar@0
   143
      !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
alpar@0
   144
      Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\"
alpar@0
   145
      ")
alpar@0
   146
alpar@0
   147
  INCLUDE(CPack)
alpar@0
   148
ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})