CMakeLists.txt
changeset 2 76d160eba8d4
parent 1 4721c71fdbfc
child 3 efa883909c06
equal deleted inserted replaced
1:dbb344c6085c 2:91e2626f4144
     1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
     1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
     2 
     2 
       
     3 ## Here comes the name of your project:
       
     4 
     3 SET(PROJECT_NAME "LEMON-PROJECT-TEMPLATE")
     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 as set PROJECT_VERSION from the cmake-gui
       
     9 ## when you make a release.
       
    10 ## The last parameter is a help string displayed by CMAKE.
       
    11 
     4 SET(PROJECT_VERSION "hg-tip"
    12 SET(PROJECT_VERSION "hg-tip"
     5                     CACHE STRING "LEMON PROJECT TEMPLATE version string.")
    13     CACHE STRING "LEMON PROJECT TEMPLATE version string.")
     6 
    14 
       
    15 ## Do not edit this.
     7 PROJECT(${PROJECT_NAME})
    16 PROJECT(${PROJECT_NAME})
     8 
    17 
     9 SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
    18 SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
       
    19 
       
    20 ## The next part looks for LEMON. Typically, you don't want to modify it.
       
    21 ##
       
    22 ## First, it checks if there exists a 'lemon' subdirectory which should contain
       
    23 ## the LEMON source tree. If it is there, then it will compile it locally and
       
    24 ## use it as a subproject. If it isn't, then CMAKE will try to find an
       
    25 ## installed version of LEMON. If it is installed to some non-standard place,
       
    26 ## then you must tell its location to 'cmake-gui' in the LEMON_ROOT_DIR
       
    27 ## config variable. (Do not hard code it into your config! Others may keep
       
    28 ## LEMON at different places.)
    10 
    29 
    11 IF(EXISTS ${CMAKE_SOURCE_DIR}/lemon)
    30 IF(EXISTS ${CMAKE_SOURCE_DIR}/lemon)
    12   ADD_SUBDIRECTORY(lemon)
    31   ADD_SUBDIRECTORY(lemon)
    13   SET(LEMON_INCLUDE_DIRS
    32   SET(LEMON_INCLUDE_DIRS
    14     ${CMAKE_SOURCE_DIR}/lemon
    33     ${CMAKE_SOURCE_DIR}/lemon
    18 ELSE()
    37 ELSE()
    19   FIND_PACKAGE(LEMON QUIET NO_MODULE)
    38   FIND_PACKAGE(LEMON QUIET NO_MODULE)
    20   FIND_PACKAGE(LEMON REQUIRED)
    39   FIND_PACKAGE(LEMON REQUIRED)
    21 ENDIF()
    40 ENDIF()
    22 
    41 
       
    42 ## This line finds doxygen (for document creation)
       
    43 
    23 FIND_PACKAGE(Doxygen)
    44 FIND_PACKAGE(Doxygen)
       
    45 
       
    46 ## These are the include directories used by the compiler.
    24 
    47 
    25 INCLUDE_DIRECTORIES(
    48 INCLUDE_DIRECTORIES(
    26   ${PROJECT_SOURCE_DIR}
    49   ${PROJECT_SOURCE_DIR}
    27   ${PROJECT_BINARY_DIR}
    50   ${PROJECT_BINARY_DIR}
    28   ${LEMON_INCLUDE_DIRS}
    51   ${LEMON_INCLUDE_DIRS}
    29 )
    52 )
    30 
    53 
       
    54 ## Here we define an executable target. Its name is 'lemon-project' and
       
    55 ## is compiled from 'main.cc'. You can add more source files separated
       
    56 ## with whitespaces (including newlines). If you want to build more
       
    57 ## executables, simple repeat (and edit) the following ADD_EXECUTABLE and
       
    58 ## TARGET_LINK_LIBRARIES statements.
       
    59 
    31 ADD_EXECUTABLE(lemon-project main.cc)
    60 ADD_EXECUTABLE(lemon-project main.cc)
    32 TARGET_LINK_LIBRARIES(lemon-project ${LEMON_LIBRARIES})
    61 TARGET_LINK_LIBRARIES(lemon-project ${LEMON_LIBRARIES})
       
    62 
       
    63 ## This tells cmake to install 'lemon-project' to $PREFIX/bin when
       
    64 ## 'make install' is executed. You can give more targets separated
       
    65 ## by whitespaces.
       
    66 
    33 INSTALL(
    67 INSTALL(
    34   TARGETS lemon-project
    68   TARGETS lemon-project
    35   RUNTIME DESTINATION bin
    69   RUNTIME DESTINATION bin
    36   COMPONENT bin
    70   COMPONENT bin
    37 )
    71 )
    38 
    72 
    39 # IF(MSVC)
    73 ## Sometimes MSVC overwhelms you with compiler warnings which are impossible to
    40 #   SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4250 /wd4355 /wd4503 /wd4800 /wd4996")
    74 ## avoid. Then comment out these sections. Normally you won't need it as the
       
    75 ## LEMON include headers suppress these warnings anyway.
       
    76 
       
    77 #IF(MSVC)
       
    78 #  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}
       
    79 #      /wd4250 /wd4355 /wd4503 /wd4800 /wd4996")
    41 # # Suppressed warnings:
    80 # # Suppressed warnings:
    42 # # C4250: 'class1' : inherits 'class2::member' via dominance
    81 # # C4250: 'class1' : inherits 'class2::member' via dominance
    43 # # C4355: 'this' : used in base member initializer list
    82 # # C4355: 'this' : used in base member initializer list
    44 # # C4503: 'function' : decorated name length exceeded, name was truncated
    83 # # C4503: 'function' : decorated name length exceeded, name was truncated
    45 # # C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning)
    84 # # C4800: 'type' : forcing value to bool 'true' or 'false'
       
    85 # #        (performance warning)
    46 # # C4996: 'function': was declared deprecated
    86 # # C4996: 'function': was declared deprecated
    47 # ENDIF(MSVC)
    87 # ENDIF(MSVC)
    48 
    88 
    49 ENABLE_TESTING()
    89 ENABLE_TESTING()
    50 
    90 
       
    91 ## This auxiliary doxygen files (.dox) should be placed in the 'doc'
       
    92 ## subdirectory. The next line includes the CMAKE config of that directory.
       
    93 
    51 ADD_SUBDIRECTORY(doc)
    94 ADD_SUBDIRECTORY(doc)
    52 
    95 
    53 ######################################################################
    96 #######################################################################
    54 # CPACK configuration 
    97 ## CPACK configuration
    55 ######################################################################
    98 ##
       
    99 ## It is used to configure the .exe installer created by CPACK.
       
   100 ## Consider editing these values:
       
   101 ## - CPACK_PACKAGE_VENDOR
       
   102 ## - CPACK_PACKAGE_DESCRIPTION_SUMMARY
       
   103 ## - CPACK_NSIS_HELP_LINK
       
   104 ## - CPACK_NSIS_URL_INFO_ABOUT
       
   105 ## - CPACK_NSIS_CONTACT
       
   106 #######################################################################
    56 
   107 
    57 IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
   108 IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
    58   SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
   109   SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
    59   SET(CPACK_PACKAGE_VENDOR "EGRES")
   110   SET(CPACK_PACKAGE_VENDOR "EGRES")
    60   SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY
   111   SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY