# HG changeset patch # User Alpar Juttner # Date 1243956426 -3600 # Node ID 76d160eba8d44b6e92f5ff5f4f06c57e0961fd62 # Parent 4721c71fdbfc8e66d5e503c6fb8e6884bd458565 Help comments in CMakeLists.txt diff -r 4721c71fdbfc -r 76d160eba8d4 CMakeLists.txt --- a/CMakeLists.txt Tue Jun 02 14:55:23 2009 +0100 +++ b/CMakeLists.txt Tue Jun 02 16:27:06 2009 +0100 @@ -1,13 +1,32 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +## Here comes the name of your project: + SET(PROJECT_NAME "LEMON-PROJECT-TEMPLATE") + +## Change 'hg-tip' to the current version number of your project if you wish. +## Optionally, you can leave it as is as set PROJECT_VERSION from the cmake-gui +## when you make a release. +## The last parameter is a help string displayed by CMAKE. + SET(PROJECT_VERSION "hg-tip" - CACHE STRING "LEMON PROJECT TEMPLATE version string.") + CACHE STRING "LEMON PROJECT TEMPLATE version string.") +## Do not edit this. PROJECT(${PROJECT_NAME}) SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) +## The next part looks for LEMON. Typically, you don't want to modify it. +## +## First, it checks if there exists a 'lemon' subdirectory which should contain +## the LEMON source tree. If it is there, then it will compile it locally and +## use it as a subproject. If it isn't, then CMAKE will try to find an +## installed version of LEMON. If it is installed to some non-standard place, +## then you must tell its location to 'cmake-gui' in the LEMON_ROOT_DIR +## config variable. (Do not hard code it into your config! Others may keep +## LEMON at different places.) + IF(EXISTS ${CMAKE_SOURCE_DIR}/lemon) ADD_SUBDIRECTORY(lemon) SET(LEMON_INCLUDE_DIRS @@ -20,39 +39,71 @@ FIND_PACKAGE(LEMON REQUIRED) ENDIF() +## This line finds doxygen (for document creation) + FIND_PACKAGE(Doxygen) +## These are the include directories used by the compiler. + INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR} ${LEMON_INCLUDE_DIRS} ) +## Here we define an executable target. Its name is 'lemon-project' and +## is compiled from 'main.cc'. You can add more source files separated +## with whitespaces (including newlines). If you want to build more +## executables, simple repeat (and edit) the following ADD_EXECUTABLE and +## TARGET_LINK_LIBRARIES statements. + ADD_EXECUTABLE(lemon-project main.cc) TARGET_LINK_LIBRARIES(lemon-project ${LEMON_LIBRARIES}) + +## This tells cmake to install 'lemon-project' to $PREFIX/bin when +## 'make install' is executed. You can give more targets separated +## by whitespaces. + INSTALL( TARGETS lemon-project RUNTIME DESTINATION bin COMPONENT bin ) -# IF(MSVC) -# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4250 /wd4355 /wd4503 /wd4800 /wd4996") +## Sometimes MSVC overwhelms you with compiler warnings which are impossible to +## avoid. Then comment out these sections. Normally you won't need it as the +## LEMON include headers suppress these warnings anyway. + +#IF(MSVC) +# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} +# /wd4250 /wd4355 /wd4503 /wd4800 /wd4996") # # Suppressed warnings: # # C4250: 'class1' : inherits 'class2::member' via dominance # # C4355: 'this' : used in base member initializer list # # C4503: 'function' : decorated name length exceeded, name was truncated -# # C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning) +# # C4800: 'type' : forcing value to bool 'true' or 'false' +# # (performance warning) # # C4996: 'function': was declared deprecated # ENDIF(MSVC) ENABLE_TESTING() +## This auxiliary doxygen files (.dox) should be placed in the 'doc' +## subdirectory. The next line includes the CMAKE config of that directory. + ADD_SUBDIRECTORY(doc) -###################################################################### -# CPACK configuration -###################################################################### +####################################################################### +## CPACK configuration +## +## It is used to configure the .exe installer created by CPACK. +## Consider editing these values: +## - CPACK_PACKAGE_VENDOR +## - CPACK_PACKAGE_DESCRIPTION_SUMMARY +## - CPACK_NSIS_HELP_LINK +## - CPACK_NSIS_URL_INFO_ABOUT +## - CPACK_NSIS_CONTACT +####################################################################### IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) SET(CPACK_PACKAGE_NAME ${PROJECT_NAME}) diff -r 4721c71fdbfc -r 76d160eba8d4 README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README Tue Jun 02 16:27:06 2009 +0100 @@ -0,0 +1,47 @@ +Setup and Build the Template +============================ + +This is fairly easy. First, clone the project template repository and step +into the dir, as follows (you've probably done it already if you read this +file). + +$ hg clone http://lemon.cs.elte.hu/hg/lemon-project-template myproject +$ cd myproject + +As you probably want to use LEMON in your project, you will need it +too. For this you have to options. You can either install is somewhere +or use a local copy of lemon dedicated to your project. This later +option is especially usefull if you also modify/develop LEMON along +with your project, or want to use a specific version. + +Use a preinstalled version. + + See http://lemon.cs.elte.hu/trac/lemon/wiki/InstallGuide for + instructions on how to install LEMON. If you installed it to a + non-standard place, you must let CMAKE know where to find it in + the LEMON_ROOT_DIR config variable. + +Use LEMON as a subproject. + + Just simply coping the lemon source code into the 'lemon' subdir + will do the job. Namely, you can either extract a release tarball + + $ wget http://lemon.cs.elte.hu/pub/sources/lemon-1.1.tar.gz + $ tar xzf lemon-1.1.tar.gz + $ mv lemon-1.1 lemon + + or - even better - you can check out the mercurial LEMON repository + + $ hg clone http://lemon.cs.elte.hu/hg/lemon-main lemon + +Then run CMAKE to create the makefiles as usual. + +$ mkdir build +$ cd build +$ cmake-gui .. + +Setup Your Own Project +====================== + +Edit CMakeLists.txt to change the name of the project and the source +files. Simply follow the instructions in CMakeLists.txt.