lemon-project-template-glpk

changeset 5:723af8fef529

Configurable LEMON source dir location (when used as a subproject)
author Alpar Juttner <alpar@cs.elte.hu>
date Fri, 26 Nov 2010 17:59:31 +0100
parents 6de89926e594
children b995b17cd52b
files CMakeLists.txt
diffstat 1 files changed, 20 insertions(+), 10 deletions(-) [+]
line diff
     1.1 --- a/CMakeLists.txt	Wed Jun 24 11:22:23 2009 +0100
     1.2 +++ b/CMakeLists.txt	Fri Nov 26 17:59:31 2010 +0100
     1.3 @@ -19,21 +19,31 @@
     1.4  
     1.5  ## The next part looks for LEMON. Typically, you don't want to modify it.
     1.6  ##
     1.7 -## First, it checks if there exists a 'lemon' subdirectory which should contain
     1.8 -## the LEMON source tree. If it is there, then it will compile it locally and
     1.9 -## use it as a subproject. If it isn't, then CMAKE will try to find an
    1.10 -## installed version of LEMON. If it is installed to some non-standard place,
    1.11 -## then you must tell its location to 'cmake-gui' in the LEMON_ROOT_DIR
    1.12 -## config variable. (Do not hard code it into your config! Others may keep
    1.13 +## First, it tries to use LEMON as a CMAKE subproject by looking for
    1.14 +## it in the 'lemon' or 'deps/lemon' subdirectories or in directory
    1.15 +## given by the LEMON_SOURCE_ROOT_DIR variable.
    1.16 +## If LEMON isn't there, then CMAKE will try to find an installed
    1.17 +## version of LEMON. If it is installed at some non-standard place,
    1.18 +## then you must tell its location in the LEMON_ROOT_DIR CMAKE config
    1.19 +## variable. (Do not hard code it into your config! Others may keep
    1.20  ## LEMON at different places.)
    1.21  
    1.22 -IF(EXISTS ${CMAKE_SOURCE_DIR}/lemon)
    1.23 -  ADD_SUBDIRECTORY(lemon)
    1.24 +FIND_PATH(LEMON_SOURCE_ROOT_DIR CMakeLists.txt
    1.25 +  PATHS ${CMAKE_SOURCE_DIR}/lemon ${CMAKE_SOURCE_DIR}/deps/lemon
    1.26 +  NO_DEFAULT_PATH
    1.27 +  DOC "Location of LEMON source as a CMAKE subproject")
    1.28 +
    1.29 +IF(EXISTS ${LEMON_SOURCE_ROOT_DIR})
    1.30 +  ADD_SUBDIRECTORY(${LEMON_SOURCE_ROOT_DIR} deps/lemon)
    1.31    SET(LEMON_INCLUDE_DIRS
    1.32 -    ${CMAKE_SOURCE_DIR}/lemon
    1.33 -    ${CMAKE_BINARY_DIR}/lemon
    1.34 +    ${LEMON_SOURCE_ROOT_DIR}
    1.35 +    ${CMAKE_BINARY_DIR}/deps/lemon
    1.36    )
    1.37    SET(LEMON_LIBRARIES lemon)
    1.38 +  UNSET(LEMON_ROOT_DIR CACHE)
    1.39 +  UNSET(LEMON_DIR CACHE)
    1.40 +  UNSET(LEMON_INCLUDE_DIR CACHE)
    1.41 +  UNSET(LEMON_LIBRARY CACHE)
    1.42  ELSE()
    1.43    FIND_PACKAGE(LEMON QUIET NO_MODULE)
    1.44    FIND_PACKAGE(LEMON REQUIRED)