Help comments in CMakeLists.txt
authorAlpar Juttner <alpar@cs.elte.hu>
Tue, 02 Jun 2009 16:27:06 +0100
changeset 276d160eba8d4
parent 1 4721c71fdbfc
child 3 efa883909c06
Help comments in CMakeLists.txt
CMakeLists.txt
README
     1.1 --- a/CMakeLists.txt	Tue Jun 02 14:55:23 2009 +0100
     1.2 +++ b/CMakeLists.txt	Tue Jun 02 16:27:06 2009 +0100
     1.3 @@ -1,13 +1,32 @@
     1.4  CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
     1.5  
     1.6 +## Here comes the name of your project:
     1.7 +
     1.8  SET(PROJECT_NAME "LEMON-PROJECT-TEMPLATE")
     1.9 +
    1.10 +## Change 'hg-tip' to the current version number of your project if you wish.
    1.11 +## Optionally, you can leave it as is as set PROJECT_VERSION from the cmake-gui
    1.12 +## when you make a release.
    1.13 +## The last parameter is a help string displayed by CMAKE.
    1.14 +
    1.15  SET(PROJECT_VERSION "hg-tip"
    1.16 -                    CACHE STRING "LEMON PROJECT TEMPLATE version string.")
    1.17 +    CACHE STRING "LEMON PROJECT TEMPLATE version string.")
    1.18  
    1.19 +## Do not edit this.
    1.20  PROJECT(${PROJECT_NAME})
    1.21  
    1.22  SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
    1.23  
    1.24 +## The next part looks for LEMON. Typically, you don't want to modify it.
    1.25 +##
    1.26 +## First, it checks if there exists a 'lemon' subdirectory which should contain
    1.27 +## the LEMON source tree. If it is there, then it will compile it locally and
    1.28 +## use it as a subproject. If it isn't, then CMAKE will try to find an
    1.29 +## installed version of LEMON. If it is installed to some non-standard place,
    1.30 +## then you must tell its location to 'cmake-gui' in the LEMON_ROOT_DIR
    1.31 +## config variable. (Do not hard code it into your config! Others may keep
    1.32 +## LEMON at different places.)
    1.33 +
    1.34  IF(EXISTS ${CMAKE_SOURCE_DIR}/lemon)
    1.35    ADD_SUBDIRECTORY(lemon)
    1.36    SET(LEMON_INCLUDE_DIRS
    1.37 @@ -20,39 +39,71 @@
    1.38    FIND_PACKAGE(LEMON REQUIRED)
    1.39  ENDIF()
    1.40  
    1.41 +## This line finds doxygen (for document creation)
    1.42 +
    1.43  FIND_PACKAGE(Doxygen)
    1.44  
    1.45 +## These are the include directories used by the compiler.
    1.46 +
    1.47  INCLUDE_DIRECTORIES(
    1.48    ${PROJECT_SOURCE_DIR}
    1.49    ${PROJECT_BINARY_DIR}
    1.50    ${LEMON_INCLUDE_DIRS}
    1.51  )
    1.52  
    1.53 +## Here we define an executable target. Its name is 'lemon-project' and
    1.54 +## is compiled from 'main.cc'. You can add more source files separated
    1.55 +## with whitespaces (including newlines). If you want to build more
    1.56 +## executables, simple repeat (and edit) the following ADD_EXECUTABLE and
    1.57 +## TARGET_LINK_LIBRARIES statements.
    1.58 +
    1.59  ADD_EXECUTABLE(lemon-project main.cc)
    1.60  TARGET_LINK_LIBRARIES(lemon-project ${LEMON_LIBRARIES})
    1.61 +
    1.62 +## This tells cmake to install 'lemon-project' to $PREFIX/bin when
    1.63 +## 'make install' is executed. You can give more targets separated
    1.64 +## by whitespaces.
    1.65 +
    1.66  INSTALL(
    1.67    TARGETS lemon-project
    1.68    RUNTIME DESTINATION bin
    1.69    COMPONENT bin
    1.70  )
    1.71  
    1.72 -# IF(MSVC)
    1.73 -#   SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4250 /wd4355 /wd4503 /wd4800 /wd4996")
    1.74 +## Sometimes MSVC overwhelms you with compiler warnings which are impossible to
    1.75 +## avoid. Then comment out these sections. Normally you won't need it as the
    1.76 +## LEMON include headers suppress these warnings anyway.
    1.77 +
    1.78 +#IF(MSVC)
    1.79 +#  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}
    1.80 +#      /wd4250 /wd4355 /wd4503 /wd4800 /wd4996")
    1.81  # # Suppressed warnings:
    1.82  # # C4250: 'class1' : inherits 'class2::member' via dominance
    1.83  # # C4355: 'this' : used in base member initializer list
    1.84  # # C4503: 'function' : decorated name length exceeded, name was truncated
    1.85 -# # C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning)
    1.86 +# # C4800: 'type' : forcing value to bool 'true' or 'false'
    1.87 +# #        (performance warning)
    1.88  # # C4996: 'function': was declared deprecated
    1.89  # ENDIF(MSVC)
    1.90  
    1.91  ENABLE_TESTING()
    1.92  
    1.93 +## This auxiliary doxygen files (.dox) should be placed in the 'doc'
    1.94 +## subdirectory. The next line includes the CMAKE config of that directory.
    1.95 +
    1.96  ADD_SUBDIRECTORY(doc)
    1.97  
    1.98 -######################################################################
    1.99 -# CPACK configuration 
   1.100 -######################################################################
   1.101 +#######################################################################
   1.102 +## CPACK configuration
   1.103 +##
   1.104 +## It is used to configure the .exe installer created by CPACK.
   1.105 +## Consider editing these values:
   1.106 +## - CPACK_PACKAGE_VENDOR
   1.107 +## - CPACK_PACKAGE_DESCRIPTION_SUMMARY
   1.108 +## - CPACK_NSIS_HELP_LINK
   1.109 +## - CPACK_NSIS_URL_INFO_ABOUT
   1.110 +## - CPACK_NSIS_CONTACT
   1.111 +#######################################################################
   1.112  
   1.113  IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
   1.114    SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/README	Tue Jun 02 16:27:06 2009 +0100
     2.3 @@ -0,0 +1,47 @@
     2.4 +Setup and Build the Template
     2.5 +============================
     2.6 +
     2.7 +This is fairly easy. First, clone the project template repository and step
     2.8 +into the dir, as follows (you've probably done it already if you read this
     2.9 +file).
    2.10 +
    2.11 +$ hg clone http://lemon.cs.elte.hu/hg/lemon-project-template myproject
    2.12 +$ cd myproject
    2.13 +
    2.14 +As you probably want to use LEMON in your project, you will need it
    2.15 +too. For this you have to options. You can either install is somewhere
    2.16 +or use a local copy of lemon dedicated to your project. This later
    2.17 +option is especially usefull if you also modify/develop LEMON along
    2.18 +with your project, or want to use a specific version.
    2.19 +
    2.20 +Use a preinstalled version.
    2.21 +
    2.22 +    See http://lemon.cs.elte.hu/trac/lemon/wiki/InstallGuide for
    2.23 +    instructions on how to install LEMON. If you installed it to a
    2.24 +    non-standard place, you must let CMAKE know where to find it in
    2.25 +    the LEMON_ROOT_DIR config variable.
    2.26 +
    2.27 +Use LEMON as a subproject.
    2.28 +
    2.29 +    Just simply coping the lemon source code into the 'lemon' subdir
    2.30 +    will do the job. Namely, you can either extract a release tarball
    2.31 +
    2.32 +    $ wget http://lemon.cs.elte.hu/pub/sources/lemon-1.1.tar.gz
    2.33 +    $ tar xzf lemon-1.1.tar.gz
    2.34 +    $ mv lemon-1.1 lemon
    2.35 +
    2.36 +    or - even better - you can check out the mercurial LEMON repository
    2.37 +
    2.38 +    $ hg clone http://lemon.cs.elte.hu/hg/lemon-main lemon
    2.39 +
    2.40 +Then run CMAKE to create the makefiles as usual.
    2.41 +
    2.42 +$ mkdir build
    2.43 +$ cd build
    2.44 +$ cmake-gui ..
    2.45 +
    2.46 +Setup Your Own Project
    2.47 +======================
    2.48 +
    2.49 +Edit CMakeLists.txt to change the name of the project and the source
    2.50 +files. Simply follow the instructions in CMakeLists.txt.